Add extra dict possible for send to Chromecast (#16268)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Pawel 2021-01-25 14:17:27 +01:00 committed by GitHub
parent c3b4704f57
commit 2ec766ffb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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`. | | `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_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`. | | `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` #### Service `media_player.select_source`