Embedding YouTube videos: some noteworthy facts
by, 01-06-2014 at 08:25 PM (38584 Views)
This video-url : src="http://s.ytimg.com/yts/swfbin/player-vfle5oFqK/watch_as3.swf?eurl=http://safeshare.tv&video_id=YOUTUBE-VIDEO-ID, which uses the safeshare.tv video service, shows YouTube videos without the distracting elements around them. NO ADS! (I wish I knew the safeshare-code for playing embedded videos without Flash, but I don't).
Internet Explorer (and, occasionally, Safari) may refuse to play certain videos outside the YouTube-environment. You will get a message telling you that the video can only be viewed on YouTube. (These are typically the videos that other browsers too refuse to play if the url is put directly in the address bar, but which don't present this behavior (with non-IE) in their embedded format). The workaround is to use the HTML5 compliant embed tag (or the object tag with params) for embedding the video, and to use a standard YouTube url having /v/ instead of /embed/ (no safeshare-url here, that won't work!).
This fact partially results from #2 above. If you are sure a certain video will always play in its standard embed format and if you don't want ads on your page, use the safeshare-url. Embedding can be done with an iframe or an embed tag. You won't see ads or other disturbing elements.
But if you are dealing with a video like the one mentioned in #2, use the embed tag together with a standard YouTube url having /v/ instead of /embed/: the video will play, even in IE.
I realize that both recommandations require the user to have Flash installed and / or enabled. If you think they are a disservice to people who don't have Flash, notice that we are (also) talking here about videos that don't play (in IE) without Flash in the first place. Anyhow, to serve people who don't have Flash, we could put a Flash-detection script on our page.
With the safeshare-url, you can use all the standard YouTube parameters (rel=0, modestbranding=1, vq=large, start=..., end=..., playlist=... etc.).
The safeshare-url should not be used together with the embed tag for videos like the one mentioned in #2. The video wouldn't even play in Firefox!
Demos and additional explanations here.