I’m looking to find a way to cast the audio from a youtube video to a sonos speaker.
Thus far I have the media_extractor integration set up to pull a video and attempt to cast it. The issue is that the returned media is a video and not an audio track - so it returns an error. I’ve tried combinations of changing the media_content_type/etc but nothing seems to work (not surprising given I’m trying to shove a video stream to an audio-only device ).
service: media_extractor.play_media
data:
media_content_type: music
media_content_id: https://www.youtube.com/watch?v=q76bMs-NwRk
target:
entity_id: media_player.kitchen
The error is Error calling SonosMediaPlayerEntity.play_media on media_player.kitchen: UPnP Error 714 received: Illegal MIME-Type from 10.50.0.60 (unknown_error). Again, unsurprising since the returned stream from the media extractor service call appears to be mp4. I’ve told it to expect music, but it receives video.
I see there is an ffmpeg integration for HA, but from what I can find online its all regarding security camera streams. Is there an option to forward the returned stream through ffmpeg and then into the speaker?
Any help would be appreciated!
Youtube Music is not an option in this case, as my wife will use this to play meditations/soundscapes/etc which I have checked a few examples of which are not on the YT Music platform.
You may find my more detailed comment on the media_extractor bug report to be helpful.
Unfortunately my code is non-transferable as I’ve made some changes that go beyond what others would use this for and it is hard-coded for my specific HA instance.