From 2724f453eb18f782b665943bf09bebb9bdb68d57 Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 29 Apr 2021 09:28:20 +0200 Subject: [PATCH] Improve cast documentation with BubbleUPNP example (#17631) Co-authored-by: Hmmbob <33529490+hmmbob@users.noreply.github.com> Co-authored-by: Franck Nijhof --- source/_integrations/cast.markdown | 189 ++++++++++++++++++----------- 1 file changed, 119 insertions(+), 70 deletions(-) diff --git a/source/_integrations/cast.markdown b/source/_integrations/cast.markdown index a105dc26655..a6ec820d9c6 100644 --- a/source/_integrations/cast.markdown +++ b/source/_integrations/cast.markdown @@ -48,78 +48,11 @@ Home Assistant Cast requires your Home Assistant installation to be accessible v -## Casting other apps +## Playing media -### YouTube +### Using the built in media player app (Default Media Receiver) -- `app_name`: `youtube` -- `media_id`: YouTube video ID - -Optional: -- `enqueue`: Enqueue only -- `playlist_id`: Play video with `media_id` from this playlist - -```yaml -'cast_youtube_to_my_chromecast': - alias: "Cast YouTube to My Chromecast" - sequence: - - target: - entity_id: media_player.my_chromecast - data: - media_content_type: cast - media_content_id: ' - { - "app_name": "youtube", - "media_id": "dQw4w9WgXcQ" - }' - service: media_player.play_media -``` - -### [Supla](https://www.supla.fi/) - -Example values to cast the item at https://www.supla.fi/audio/3601824 - -- `app_name`: `supla` -- `media_id`: Supla item ID - -Optional: -- `is_live`: Item is a livestream - -```yaml -'cast_supla_to_my_chromecast': - alias: "Cast supla to My Chromecast" - sequence: - - target: - entity_id: media_player.my_chromecast - data: - media_content_type: cast - media_content_id: ' - { - "app_name": "supla", - "media_id": "3601824" - }' - service: media_player.play_media -``` - -### Plex - -To cast media directly from a configured Plex server, set the fields [as documented in the Plex integration](/integrations/plex/#service-play_media) and prepend the `media_content_id` with `plex://`: - -```yaml -'cast_plex_to_chromecast': - alias: "Cast Plex to Chromecast" - sequence: - - service: media_player.play_media - target: - entity_id: media_player.chromecast - data: - media_content_type: movie - media_content_id: 'plex://{"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. +Chromecasts can play many kinds of modern [media (image/audio/video) formats](https://developers.google.com/cast/docs/media) using the built in app Default Media Receiver. 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. @@ -182,6 +115,122 @@ data: - url: "https://tilos.hu/images/kockalogo.png" ``` +### Casting with other apps + +It's possible to play with other apps than the default media receiver. +To do so, `media_content_type` should be set to `cast`, and `media_content_id` should be a JSON dict with parameters for the app, including the app name. + +### BubbleUPNP + +The BubbleUPNP app has similar functionality to the built in Default Media Receiver app, and can be used as a backup if the default app fails to play the media. + +#### Media parameters + +Mandatory: + +- `app_name`: `bubbleupnp` +- `media_id`: The URL to play + +Optional: + +- `media_type`: Media type, e.g. `video/mp4`, `audio/mp3`, `image/jpeg`, defaults to `video/mp4`. + +#### Example: + +```yaml +'cast_bubbleupnp_to_my_chromecast': + alias: "Cast a video to My Chromecast using BubbleUPNP" + sequence: + - target: + entity_id: media_player.my_chromecast + data: + media_content_type: cast + media_content_id: ' + { + "app_name": "bubbleupnp", + "media_id": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", + "media_type": "video/mp4" + }' + service: media_player.play_media +``` + +### YouTube + +#### Media parameters + +Mandatory: + +- `app_name`: `youtube` +- `media_id`: YouTube video ID + +Optional: + +- `enqueue`: Enqueue only +- `playlist_id`: Play video with `media_id` from this playlist + +#### Example: + +```yaml +'cast_youtube_to_my_chromecast': + alias: "Cast YouTube to My Chromecast" + sequence: + - target: + entity_id: media_player.my_chromecast + data: + media_content_type: cast + media_content_id: ' + { + "app_name": "youtube", + "media_id": "dQw4w9WgXcQ" + }' + service: media_player.play_media +``` + +### [Supla](https://www.supla.fi/) + +Example values to cast the item at + +- `app_name`: `supla` +- `media_id`: Supla item ID + + +Optional: +- `is_live`: Item is a livestream + +#### Example: + +```yaml +'cast_supla_to_my_chromecast': + alias: "Cast supla to My Chromecast" + sequence: + - target: + entity_id: media_player.my_chromecast + data: + media_content_type: cast + media_content_id: ' + { + "app_name": "supla", + "media_id": "3601824" + }' + service: media_player.play_media +``` + +### Plex + +To cast media directly from a configured Plex server, set the fields [as documented in the Plex integration](/integrations/plex/#service-play_media) and prepend the `media_content_id` with `plex://`: + +```yaml +'cast_plex_to_chromecast': + alias: "Cast Plex to Chromecast" + sequence: + - service: media_player.play_media + target: + entity_id: media_player.chromecast + data: + media_content_type: movie + media_content_id: 'plex://{"library_name": "Movies", "title": "Groundhog Day"}' +``` + ## Troubleshooting automatic discovery mDNS relies on UDP multicast, which may fail for various reasons. If none of the tips in this section helps, the recommended solution is to ensure all cast devices have static IPs assigned to them and configure a list of known hosts.