Skip to content

Commit

Permalink
Add a section about general Chromecast use cases (home-assistant#15812)
Browse files Browse the repository at this point in the history
Co-authored-by: Franck Nijhof <[email protected]>
  • Loading branch information
gemolnar and frenck committed Jan 25, 2021
1 parent 089fbb0 commit 6fc2535
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions source/_integrations/cast.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,67 @@ To cast media directly from a configured Plex server, set the fields [as documen
media_content_id: 'plex:https://{"library_name": "Movies", "title": "Groundhog Day"}'
```

### Play (almost) any kind of media

Chromecasts can play many kinds of modern [media (image/audio/video) formats](https://developers.google.com/cast/docs/media). As a rule of thumb, if a Chrome browser can play a media file a Chromecast will be able to handle that too.

The media needs to be accessible via HTTP(S). Chromecast devices do not support other protocols like DLNA or playback from an SMB file share.

You can play MP3 streams like net radios, FLAC files or videos from your local network with the `media_player.play_media` service, as long as the media is accessible via HTTP(S). You need to set the `media_content_id` to the media URL and `media_content_type` to a matching content type.

```yaml
# Play a video file from the local network:
service: media_player.play_media
data:
entity_id: media_player.chromecast
media_content_type: 'video'
media_content_id: 'http:https://192.168.0.100/movies/sample-video.mkv'
```

```yaml
# Show a jpeg image:
service: media_player.play_media
data:
entity_id: media_player.chromecast
media_content_type: 'image/jpeg'
media_content_id: 'http:https://via.placeholder.com/1024x600.jpg/0B6B94/FFFFFF/?text=Hello,%20Home%20Assistant!'
```

Extra media metadata (for example title, subtitle, artist or album name) can be passed into the service and that will be shown on the Chromecast display.
For the possible metadata types and values check [Google cast documentation > MediaInformation > metadata field](https://developers.google.com/cast/docs/reference/messages#MediaInformation).

```yaml
# Play a movie from the internet, with extra metadata provided:
service: media_player.play_media
data:
entity_id: media_player.chromecast
media_content_type: 'video/mp4'
media_content_id: 'http:https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4'
extra:
metadata:
metadataType: 1
title: 'Big Buck Bunny'
subtitle: 'By Blender Foundation, Licensed under the Creative Commons Attribution license'
images:
- url: 'https://peach.blender.org/wp-content/uploads/watchtrailer.gif'
```

```yaml
# Play a netradio, with extra metadata provided:
service: media_player.play_media
data:
entity_id: media_player.chromecast
media_content_type: 'audio/mp3'
media_content_id: 'http:https://stream.tilos.hu:8000/tilos'
extra:
metadata:
metadataType: 3
title: 'Radio TILOS'
artist: 'LIVE'
images:
- url: 'https://tilos.hu/images/kockalogo.png'
```

## Advanced use

### Manual configuration
Expand Down

0 comments on commit 6fc2535

Please sign in to comment.