在 Home Assistant 中使用 media_extrator 播放 youtube 直播影片
TestFlight 無法增加內部測試群組到建置版本
使用 media_extrator 播放 youtube 直播影片
若是要使用支援 Chromecast 的 media_player 播放 Youtube 指定的影片的話
我們可以使用Home Assistan 官方的 media_extrator 整合
https://www.home-assistant.io/integrations/media_extractor/
使用方式如下:
1
2
3
4
5
6
service: media_extractor.play_media
data:
media_content_type: MUSIC
media_content_id: https://www.youtube.com/watch?v=AWKzr6n0ea0
target:
entity_id: media_player.smart_tv
但若是 Youtube 影片是直播的,就沒辦法使用這個方式播放
可以改為使用 media_player.play_media 的方式播放:
1
2
3
4
5
6
service: media_player.play_media
target:
entity_id: media_player.smart_tv
data:
media_content_type: cast
media_content_id: ' { "app_name": "youtube", "media_id": "2mCSYvcfhtc" }'
其中 media_id 使用 youtube 影片網址中的 v 參數
例如:
TVBS 新聞直播的網址為 https://www.youtube.com/watch?v=2mCSYvcfhtc
media_id 則填入 2mCSYvcfhtc
本文章以 CC BY 4.0 授權
Comments powered by Disqus.