Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

api - Youtube live chat embed not working in mobile

<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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

  1. 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.
  2. 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."
  3. Combine the embedded URL in the following way: https://www.youtube.com/live_chat?v=12345&embed_domain=www.example.com.
  4. 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.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...