NFSAddons Forums

Main Menu

Embedding videos from YouTube

Started by MADMAN_nfs, Feb 25, 2016, 4:47 AM

MADMAN_nfs

Hey guys,

i wondered why its not possible to embed youtube videos in the forums (or is there a way i dont know of?).
I understand HTML code is disabled for security reasons, but there are always ways to make stuff, like embedded videos, work via BBcode.
Since the embed-code is always the same, you could realize some "youtube" button, where users only have to enter the unique video code (which can be found in youtube-links after "..watch?v=") ...for example:



Thats really something i already missed here, when it would have been much easier showing something instead of long explainings.
Embedded videos do not automatically start playing - so its not really a bandwith problem either; especially by today's standards.  ;)

Greetings

Remko

Actually, there is a way to embed Youtube videos into forum posts here, I found this out myself only a few years ago and posted it in the screenshots thread, but I suppose I could have posted it in a location where it's more visible:
http://www.nfsaddons.com/forums//index.php?topic=311.msg32063#msg32063

What you do is, you click the 'share' link on a YT video, then go to the 'embed' tag, copy the link and put it between [ html]  tags like this:

[ html]<iframe width="480" height="360" src="https://www.youtube.com/embed/9MUWkO7rq_c" frameborder="0" allowfullscreen></iframe>[ /html]

(but then with the spaces between the [...] removed, of course..)


WiLL

That was a nice looking older Monti Carlo,Cop car? Yeah... Nice hack there.
Let's have a better day...?

MADMAN_nfs

#3
Thanks Remko,
i tried that, but it is not working for me. Maybe you need some special permission for the html-tags to work?

Test:

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

edit: the "html" code gets removed

Remko

Oh, I did not know that, sorry. I will check the settings and see why that is.

MADMAN_nfs

Any news regarding this matter?

Remko

Sorry for the wait, took a while before I found something. The html permission apparently cannot officially be changed, so after a while I found out that there's an alternative way. I needed to enable the 'Flash' button to the post options though, which is disabled in SMF by default. Enabling flash in forum posts supposedly poses a small security risk, but I don't think those risks are too great in a small community like ours.   ;)

It works like this: you take a standard Youtube page link like this one:
https://www.youtube.com/watch?v=nn6QoVb5s7U

No need to go to the embedding options or anything this time, but what you need to do is:
Take the part that goes /watch?v= and change it to /v/

So now the link becomes:
https://www.youtube.com/v/nn6QoVb5s7U

Then look for the new Flash button in the options: and place that link between Flash tags. By default is set at 200 x 200 pixels, but you can manually change that to, for example, '480,360' and you get this:

flash=480,360]https://www.youtube.com/v/nn6QoVb5s7U[/flash

Or, with the tags complete: ;)

https://www.youtube.com/v/nn6QoVb5s7U

XJ220

Quote from: Remko on Mar 14, 2016,  3:29 PM
Sorry for the wait, took a while before I found something. The html permission apparently cannot officially be changed, so after a while I found out that there's an alternative way. I needed to enable the 'Flash' button to the post options though, which is disabled in SMF by default. Enabling flash in forum posts supposedly poses a small security risk, but I don't think those risks are too great in a small community like ours.   ;)[...]
Unless abused by a spambot or something... can the SWF functionality be limited to members with at least, say, 10 forum posts or so? Also, I am wondering whether HTML5 embedding is possible. Flash is obsolete and its player has seen SO many security issues the past months I removed it completely.

Remko

Quote from: XJ220 on Mar 15, 2016,  9:10 AM
Quote from: Remko on Mar 14, 2016,  3:29 PM
Sorry for the wait, took a while before I found something. The html permission apparently cannot officially be changed, so after a while I found out that there's an alternative way. I needed to enable the 'Flash' button to the post options though, which is disabled in SMF by default. Enabling flash in forum posts supposedly poses a small security risk, but I don't think those risks are too great in a small community like ours.   ;)[...]
Unless abused by a spambot or something... can the SWF functionality be limited to members with at least, say, 10 forum posts or so? Also, I am wondering whether HTML5 embedding is possible. Flash is obsolete and its player has seen SO many security issues the past months I removed it completely.

Hm, good point I guess... I don't know if this isp possible without installing mods, but I'll look into it. Thanks for the feedback.

MADMAN_nfs

Hey, thanks Remko for looking into this. I guess XJ220 is right there, enabling flash completely is probably a security risk.

Maybe think about what i tried to explain in the first post: Instead of the flash button, enable a youtube-button where you can only enter the video ID (11 characters). So the site automatically interpretes the characters written within, some brakets for example - and adds https://www.youtube.com/v/ in front of it.
Example:
[/color] or [yt]7aTT7hcVpN8[/yt] etc...
converts to:
https://www.youtube.com/v/7aTT7hcVpN8
If you can implement a check for this maximum of 11 characters and deny longer ID's, i can't see any security risks.
You get the idea i hope :)

Indeed, HTML videos would be better tho.

Greetings