Skip to content
Advertisement

How to embed Youtube live chat with url permanent?

The embed URL for a channel’s live stream is:

JavaScript

and it works but if I want to embed near at it a YouTube live chat for current streaming the URL that I use for the embed is:

JavaScript

The problem is this: for every new live stream the Video ID changes. So that the embedded code isn’t valid anymore and chat isn’t displayed for next streaming.I want a permanent URL live chat valid for all my YouTube streaming without change video id manually every time. How to resolve? Perhaps with a script in PHP or javascript that read current YouTube URL and replace video id in chat embed URL? thanks

Advertisement

Answer

You could get the video ID using PHP like this:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement