问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/39204757/youtube-live-streaming-embed-code-keeps-changing