[nodebb-plugin-youtube] Youtube Embed Plugin
-
Great plugin, thanks a lot
-
@psychobunny Hey buddy, I've started working on a youtube-lite plugin if you're interested in contributing, video heavy threads crash my browser due to the number of iFrames being loaded. So I'm working on integrating lazyYT, which only fires the iFrame when it's required, until then it just displays the default image of the video and a play button. I've got as far as displaying the thumbnails, but there's something wrong with it then loading the video, the iFrame code gets mangled. So fails to load.
If anyone wants to help out with this, it's https://github.com/a5mith/nodebb-plugin-youtube-lite (Don't use in live environment, it doesn't work.)
I've noticed that it requires some code be added into the body, is this something that can be done easily via the plugin? Or would it be easier to get people to add it to the custom JS?
-
I've noticed that it requires some code be added into the body, is this something that can be done easily via the plugin? Or would it be easier to get people to add it to the custom JS?
Try checking this plugin out for an example on how to embed client-side scripts in your plugins
-
@psychobunny Thanks dude, once I've worked out why the iFrame code is getting mangled, I'll add that in.
-
Ok, I'm officially at a loss with this... Not only is it mangling the iFrame, it's changing the video ID into all lower case, so the videos don't actually work.
I don't understand how it goes from
$el.on('click', function (e) { e.preventDefault(); if (!$el.hasClass('lazyYT-video-loaded') && $el.hasClass('lazyYT-image-loaded')) { $el.html('<iframe width="' + width + '" height="' + height + '" src="//www.youtube.com/embed/"' + id + '?autoplay=1&' + youtubeParameters + '"></iframe>') .removeClass('lazyYT-image-loaded') .addClass('lazyYT-video-loaded'); } });
To being output as
<iframe width="640" height="360" yuobzwf0aws?autoplay="1&"" src="//www.youtube.com/embed/"></iframe>
Sense, it doesn't make it.
-
How reduce size of video?
-
@Master-Antonio, try @a_5mith's Youtube-Lite plugin. It may be more suited to your needs if the video is appearing to large.
-
I have the RSS Feed poster plugin and the feeds posts YouTube videos in iFrames instead of just a standard URL.
Example: <iframe width="560" height="315" src="https://www.youtube.com/embed/vzNErWJWxTo" frameborder="0" allowFullScreen=""></iframe>
How would I modify this YouTube plugin work with posts that contain YouTube videos in an iFrame tag?
-
@Hero Ah seems like the REGEX is detecting the link in the rss feed. I will look into this now, and maybe also @psychobunny
Also @Hero could you test with this plugin also https://github.com/a5mith/nodebb-plugin-youtube-lite
-
@Hero the iframes are added by the plugin, to make the youtube embed, and as the youtube plugin checks the postcontent for youtube links this is why it is added.
@psychobunny @a_5mith would be able to help more, as ive only just started making nodebb plugins
-
@xCausxn said:
@Hero the iframes are added by the plugin, to make the youtube embed, and as the youtube plugin checks the postcontent for youtube links this is why it is added.
Thanks for the reply. The RSS feed already includes the iframe/embed code so for some reason the YouTube plugin doesn't parse it. The result of the RSS post including a YouTube video is the actual embed code itself. The only way I've been able to get around it is by allowing HTML on all posts which isn't the safest thing
-