问题
<iframe allowfullscreen="" frameborder="0" height="500" src="https://www.youtube.com/live_chat?v=XX71LoT8AME&embed_domain=localhost" width="480"></iframe>
This is the Iframe code for the youtube live chat embed. It works fine in desktop view but return a javascript error in mobile view and no content is shown
回答1:
We just wanted to embed the youtube chat and found this on Google Support.
Unfortunately, Youtube chat embed isn’t available on mobile web according to google: https://support.google.com/youtube/answer/2524549?hl=en
Take care, I.
回答2:
Official YouTube documentation
Embed Live chat
Note: embedding live chat isn't available on mobile web.
During a live stream, you can embed live chat on your own site by using an iframe.
- Get the video ID for the live stream. You can get the video ID from the watch page URL (youtube.com/watch?v=12345). In this case, the video ID is ‘12345’. If you chose "Stream now," right-click on the player and select Copy video URL to get the video URL.
- Get the domain URL for the site you want to embed chat on. If you're embedding chat on www.example.com/youtube_chat, your embedding domain is "www.example.com."
- Combine the embedded URL in the following way: https://www.youtube.com/live_chat?v=12345&embed_domain=www.example.com.
- This is the URL for your iframe. Note the embed_domain must match the the URL of the page you’re embedding the chat on. If they are different, the embedded chat will not load.
来源:https://stackoverflow.com/questions/55120923/youtube-live-chat-embed-not-working-in-mobile