File: test.py

package info (click to toggle)
mkchromecast 0.3.9~git20200902%2Bdb2964a-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 17,636 kB
  • sloc: python: 4,654; makefile: 47; sh: 43; javascript: 34
file content (26 lines) | stat: -rw-r--r-- 693 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python

# This file is part of mkchromecast.

from __future__ import print_function
import time
import pychromecast

cast = pychromecast.get_chromecast(friendly_name="CCA")
print("Connected to Chromecast")
mc = cast.media_controller
print("Playing BigBuckBunny.mp4 (video)")
mc.play_media(
    "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4",
    "video/mp4",
)
time.sleep(15)
print("Stopping video and sleeping for 5 secs")
mc.stop()
time.sleep(5)
print("Playing Canon mp3 (audio)")
mc.play_media("http://www.stephaniequinn.com/Music/Canon.mp3", "audio/mp3")
time.sleep(15)
print("Stopping audio and quitting app")
mc.stop()
cast.quit_app()