Skip to content

Commit

Permalink
Add extra dict possible for send to Chromecast (home-assistant#16268)
Browse files Browse the repository at this point in the history
Co-authored-by: Franck Nijhof <[email protected]>
  • Loading branch information
pszafer and frenck authored Jan 25, 2021
1 parent c3b4704 commit 2ec766f
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions source/_integrations/media_player.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,81 @@ Available services: `turn_on`, `turn_off`, `toggle`, `volume_up`, `volume_down`,
| `entity_id` | yes | Target a specific media player. To target all media players, use `all`. |
| `media_content_id` | no | A media identifier. The format of this is integration dependent. For example, you can provide URLs to Sonos and Cast but only a playlist ID to iTunes. |
| `media_content_type` | no | A media type. Must be one of `music`, `tvshow`, `video`, `episode`, `channel` or `playlist`. For example, to play music you would set `media_content_type` to `music`. |
| `extra` | yes | Extra dictionary data to send, e.g., title, thumbnail. Possible values can be found below.

##### Extra dictionary data

{% configuration %}
title:
type: string
description: Title of the media.
required: false
thumb:
type: string
description: Thumbnail image URL.
required: false
current_time:
type: float
description: Seconds since the beginning of the content. If the content is live content, and the position is not specified, the stream will start at the live position.
required: false
autoplay:
type: boolean
description: Whether the media will automatically play.
default: true
required: false
stream_type:
type: string
description: "Describes the type of media artifact as one of the following: `NONE`, `BUFFERED`, `LIVE`."
required: false
subtitles:
type: string
description: URL of subtitle file to be shown on chromecast.
required: false
subtitles_lang:
type: string
description: Language for subtitles.
required: false
subtitles_mime:
type: string
description: Mimetype of subtitles.
required: false
subtitle_id:
type: integer
description: ID of subtitle to be loaded.
required: false
enqueue:
type: boolean
description: If True, enqueue the media instead of play it.
default: false
required: false
media_info:
type: map
description: Additional MediaInformation attributes not explicitly listed.
required: false
metadata:
type: map
description: "Media metadata object, one of the following: `GenericMediaMetadata`, `MovieMediaMetadata`, `TvShowMediaMetadata`, `MusicTrackMediaMetadata`, `PhotoMediaMetadata`."
required: false
{% endconfiguration %}

Documentation:

- [Google Dev Documentaion MediaData](https://developers.google.com/cast/docs/reference/messages#MediaData)
- [Google Dev Documentaion MediaInformation](https://developers.google.com/cast/docs/reference/web_receiver/cast.framework.messages.MediaInformation)


Example of calling media_player service with title and image set:

```yaml
entity_id: media_player.chromecast
service: media_player.play_media
data:
media_content_type: music
media_content_id: 'https://fake-home-assistant.io.stream/aac'
extra:
thumb: 'https://brands.home-assistant.io/_/homeassistant/logo.png'
title: HomeAssitantRadio
```
#### Service `media_player.select_source`

Expand Down

0 comments on commit 2ec766f

Please sign in to comment.