home-assistant / architecture

Repo to discuss Home Assistant architecture
315 stars 99 forks source link

Cross-integration media_player playback #444

Closed jjlawren closed 1 year ago

jjlawren commented 3 years ago

Context

Some integrations are able to provide media which could be played by other integrations' media_player entities.

Proposal

The behavior to allow the integration domain in the media_content_type of the current payload of media_player.play_media could be extended across integrations to convey this information.

Example service call for media_player.play_media:

entity_id: media_player.chromecast
media_content_type: plex
media_content_id: <plex-specific-media-id>

I see a couple potential ways this could be implemented:

  1. Implement a special handler in the play_media handler for integrations which can accept another integration's media. For example, cast would need to know how to handle a plex media item above.
  2. Redirect service calls back to the source integration for handling via <domain>.play_media. It would be up to the media source's integration to handle. This might involve modifying the payload to fit the playback destination and re-calling media_player.play_media on the player entity.

Consequences

  1. Adding cross-integration interactions adds complexity and dependencies.
  2. This may be forcing to fit the existing type/id payload model of the media_player.play_media when a completely new approach could be warranted.
  3. Users may expect this to work between more integrations than actually possible/implemented and cause frustration.
jjlawren commented 3 years ago

This method also fits the media browser/source payload model to allow browsing from other integrations' media collections as it can just return type/id pairs that can be used by the media_player.play_media service directly, even across integrations.

jjlawren commented 3 years ago

Following the prior art from Media Source, prefixing the media_content_id with a domain identifier seems like the cleanest way forward. I've put a draft together here that allows Cast media players to accept Plex media_player.play_media payloads.

frenck commented 1 year ago

This architecture issue is old, stale, and possibly obsolete. Things changed a lot over the years. Additionally, we have been moving to discussions for these architectural discussions.

For that reason, I'm going to close this issue.

../Frenck