Glodenox / twitch-chat-monitor

Twitch Chat Monitor that allows the chat to be shown comfortably on a big monitor. Useful for room-scale streaming where the chat needs to be readable from a distance.
37 stars 9 forks source link

Make it possible to show any linked YouTube videos in the chat #20

Closed Glodenox closed 2 years ago

Glodenox commented 4 years ago

Try to obtain the maximum resolution image, but be ready to fall back to the high quality resolution picture or medium quality resolution picture if one is unavailable (generally only the case for older videos).

https://img.youtube.com/vi/<video id>/maxresdefault.jpg
https://img.youtube.com/vi/<video id>/hqdefault.jpg
https://img.youtube.com/vi/<video id>/mqdefault.jpg

YouTube responds with an HTTP 404 if an image is not found, but it does provide a replacement image. It is best to check whether this actually triggers an error event. If not: it is possible to check the naturalWidth of the image after loading to check whether the src needs to be adjusted.

It would also be nice to investigate whether it is plausible to show the first x frames of the video or even have the video start automatically. All optional, of course.

Glodenox commented 4 years ago

It is possible to load and autostart the YouTube video, as detailed here. This requires using the iframe JavaScript API, so make sure to load this only once this option gets activated in the settings.

Glodenox commented 2 years ago

I've split off the autoplay feature from this issue to #33, allowing this issue to be closed.