home-assistant.io/source/_integrations/media_source.markdown
2021-04-03 12:42:58 +02:00

2.3 KiB

title description ha_category ha_release ha_domain ha_codeowners ha_iot_class ha_quality_scale
Media Source Instructions on how to access your media with Home Assistant.
Media Source
0.115 media_source
@hunterjm
internal

The Media Source integration platform allows integrations to expose media for use inside Home Assistant through the Media Browser panel or through supported media players like Google Cast. This integration is configured automatically through default_config or if another integration implements a media source.

If your configuration does not contain any of the above, you can add the below to your configuration file:

# Example configuration.yaml entry
media_source:

Local Media

By default, the integration looks for media in a specified folder. If other media_dirs are not declared you need to use /media/local path for example in companion app notification.

For Home Assistant OS, Supervised and Container users, this folder is by default configured in the path /media.

Home Assistant OS and Supervised users can access this folder by using, for example, the Samba add-on. Users of Home Assistant Container can mount a volume of their choice to /media.

If you are a Home Assistant Core user, the default directory called is called media under the configuration path (where your configuration.yaml is located).

Files served from media are protected by Home Assistant authentication unlike those served from www.

Using custom or additional media folders

It is also possible to set up custom and additional media directories. To do so, you'll need to adjust the core configuration.

This example makes two different folders available to the integration:

# Example configuration.yaml
homeassistant:
  media_dirs:
    local: /media
    recording: /mnt/recordings

Playing media from a Media Source

To play media from a media source via a service call, use the uri scheme media-source://media_source/<media_dir>/<path>. Default media_diris local.

Example:

service: media_player.play_media
target:
  entity_id: media_player.living_room_tv
data:
  media_content_type: video/mp4
  media_content_id: media-source://media_source/local/videos/favourites/Epic Sax Guy 10 Hours.mp4