8

I do live streaming with YouTube and I can watch it on my site by coping the embed code into my site

Its looks like this below

<iframe width="640" height="360" src="https://www.youtube.com/embed/gz54fede3Y" frameborder="0" allowfullscreen></iframe>

But recently I discovered that every time I do a live stream, I have to start updating the embeded code on my site each time with the one that will be generated from my live channel.

This is because it keeps regenerating a different code. Its so frustrating to do this, is there a way to get a particular embed code that will not change so I don't have to worry about this, or is there a setting that I am not aware of.

JAL
  • 41,701
  • 23
  • 172
  • 300
Plumptre Ademola
  • 103
  • 1
  • 2
  • 6

1 Answers1

21

There is a static URL to embed the video player for the "Stream now" stream. It is currently not exposed anywhere in the UI, but we will fix that soon (hopefully.)

It looks like this: https://www.youtube.com/embed/live_stream?channel=[channel ID]

You can also use a YouTube Gaming link, like so: https://gaming.youtube.com/embed/live_stream?channel=[channel ID]

You can determine your channel ID by going to https://www.youtube.com/account_advanced and copying the string after "YouTube Channel ID".

Once you've got this link, you can use it in the "src" attribute of your embed code.

Marc Chambers
  • 411
  • 4
  • 8
  • 1
    Marc thanks alot, I used the gaming link , I just added my channel Id to the gaming url so it will look something like this remember change mychannelid to your real channel id – Plumptre Ademola Aug 31 '16 at 13:48
  • Can we get a link to official documentation for this feature? – FlipMcF Sep 07 '16 at 16:50
  • Best source for this answer I see comes from https://www.reddit.com/r/youtubegaming/comments/50bw6h/how_do_i_get_stable_embed_code_for_live_stream/ By https://www.reddit.com/user/crschmidt – FlipMcF Sep 07 '16 at 17:17
  • 1
    I work at YouTube. We generated this answer internally and are socializing it (the Redditor in the linked comment works here as well.) This SO answer is our canonical source for now :) https://twitter.com/YouTubeDev/status/770709748731609088 – Marc Chambers Sep 08 '16 at 18:21
  • 1
    Does this work with the iframe player API? https://developers.google.com/youtube/iframe_api_reference#Loading_a_Video_Player – freedrull Dec 22 '16 at 02:33
  • Has this been fixed? – Jonathan Aug 21 '17 at 21:23
  • 2
    This solution does not work anymore, I did use it a while without problems, but YT must have changed something. Does anyone know of another solution because I cannot find it. @MarcChambers – Bombelman Sep 18 '18 at 13:53
  • It works. Make sure to make your stream public. It wont work on private or Unlisted stream. – Rajendra May 26 '20 at 07:16