home-assistant.io/source/_components/media_extractor.markdown
Franck Nijhof c464056402
Making our website faster, cleaner and prettier (#9853)
* 🔥 Removes octopress.js

* 🔥 Removes use of root_url var

* 🔥 Removes Octopress generator reference from feed

* 🔥 Removes delicious support

* 🔥 Removes support for Pinboard

* 🔥 Removes support for Disqus

* 🔥 Removes support for Google Plus

* ↩️ Migrate custom after_footer to default template

* ↩️ Migrate custom footer to default template

* ↩️ Migrate custom header to default template

* 🔥 Removes unused template files

* 🚀 Places time to read directly in post template

* 🚀 Removes unneeded capture from archive_post.html template

* 🔥 🚀 Removes unused, but heaving sorting call in component page

* 🚀 Merged javascripts into a single file

* 🔥 Removes more uses of root_url

* 🚀 Removal of unneeded captures from head

* 🔥 🚀 Removal of expensive liquid HTML compressor

* 🔥 Removes unneeded templates

* 🚀 Replaces kramdown with GitHub's CommonMark 🚀

* 💄 Adds Prism code syntax highlighting

*  Adds support for redirect in Netlify

* ↩️ 🔥 Let Netlify handle all developer doc redirects

* ✏️ Fixes typo in redirects file: Netify -> Netlify

* 🔥 Removes unused .themes folder

* 🔥 Removes unused aside.html template

* 🔥 Removes Disqus config leftover

* 🔥 Removes rouge highlighter config

* 🔥 Removes Octopress 🎉

* 💄 Adjust code block font size and adds soft wraps

* 💄 Adds styling for inline code blocks

* 💄 Improve styling of note/warning/info boxes + div support

* 🔨 Rewrites all note/warning/info boxes
2019-07-15 22:17:54 +02:00

2.7 KiB

title, description, logo, ha_category, ha_release, ha_qa_scale
title description logo ha_category ha_release ha_qa_scale
Media Extractor Instructions on how to integrate the Media Extractor into Home Assistant. home-assistant.png
Media Player
0.49 internal

The media_extractor integration gets a stream URL and sends it to a media player entity. This integration can extract entity specific streams if configured accordingly.

Media extractor doesn't transcode streams, it just tries to find stream that match requested query.

To use the media extractor service in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
media_extractor:

{% configuration %} default_query: description: Set default stream query for all devices. required: false default: best type: string customize: description: Set entity specific values. required: false type: list {% endconfiguration %}

# Example configuration.yaml entry
media_extractor:
  default_query: worst
  customize:
    media_player.my_sonos:
      video: bestvideo
      music: bestaudio[ext=mp3]

This configuration sets query for all service calls like to 'bestaudio' with the mp3 extension:

{
  "entity_id": "media_player.my_sonos",
  "media_content_id": "https://soundcloud.com/bruttoband/brutto-11",
  "media_content_type": "music"
}

Query examples with explanations:

  • bestvideo: Best video only stream
  • best: Best video + audio stream
  • bestaudio[ext=m4a]: Best audio stream with m4a extension
  • worst: Worst video + audio stream
  • bestaudio[ext=m4a]/bestaudio[ext=ogg]/bestaudio: Best m4a audio, otherwise best ogg audio and only then any best audio

More info about queries here

Use the service

Use service developer tool icon Services from the Developer Tools. Choose media_extractor from the dropdown menu Domain and play_media from Service, enter something like the JSON sample from above into the Service Data field, and hit CALL SERVICE.

This will download the file from the given URL.

Service data attribute Optional Description
entity_id yes Name(s) of entities to seek media on, e.g., media_player.living_room_chromecast. Defaults to all.
media_content_id no The ID of the content to play. Platform dependent.
media_content_type no The type of the content to play. Must be one of MUSIC, TVSHOW, VIDEO, EPISODE, CHANNEL or PLAYLIST MUSIC.