Some YouTube iframe embeds not working in HTML5 mode - javascript

A YouTube iframe can play a video using an HTML5 player instead of Flash, by adding "html5=1" as a URL parameter. However, this only works sometimes. For example the emebeds below are identical, except for the YouTube id in the iframe URL. The first iframe plays fine if there is no Flash player installed but the second requires flash. I've tried this in both Chrome and Firefox.
<iframe title="YouTube video player" width="720" height="720" src="http://www.youtube.com/embed/O_ceIIJeVNQ?html5=1&modestbranding=1&controls=0&title&loop=1&playlist=O_ceIIJeVNQ&enablejsapi=1&origin=http%3A%2F%2Flocalhost%3A8080"></iframe>
<iframe title="YouTube video player" width="720" height="720" src="http://www.youtube.com/embed/YmehSeNXXt4?html5=1&modestbranding=1&controls=0&title&loop=1&playlist=YmehSeNXXt4&enablejsapi=1&origin=http%3A%2F%2Flocalhost%3A8080"></iframe>
http://jsfiddle.net/judeosborn/2SAas
Any idea how I can get embeds to play in HTML5 consistently?

#Jude Osborn
"Apparently HTML5 video will not play for videos with ads, captions, or annotations"
That is impossible, the biggest part of youtube videos will have ads captions or notations
if it was true Youtube would be dead soon.
The fact that one video will play and the other not
is probably caused by if a version exists that is available
in the right format...which might depend on how old it is.
They dont convert videos on the fly..but create various versions
and send the right one to the right browser or device.
It should be that the new(er) embed code as shown below videos #Youtube
takes care of sending the right video to you.
By the way NONE of the PLAYLISTS will play anymore on iOS (iPad/iPhone)
i noticed that today, no replies are given in any yt-forum
Single videos play fine.

A colleague of mine found the answer in the original HTML5 video post announcement here:
http://youtube-global.blogspot.co.uk/2010/01/introducing-youtube-html5-supported.html
Apparently HTML5 video will not play for videos with ads, captions, or annotations.

Related

how to observe embedded youtube video

I want to embed a youtube video on my own website and I want this youtube video not to be skipped in any way, but not to adjust its speed and to track the time it watches, but I could not find any source.
I tried to use the youtube iframe api, but I can't follow the stats without stopping or starting the youtube video there.
I would suggest that you should first download the video, and then put it onto your site through a <video> tag. The youtube iframe api is designed only for having videos that function exactly like they do on the youtube website, which includes the things you don't want.

Embedded YouTube videos may not play

I have created a website that plays YouTube videos using the IFrame Player API.
Most videos played fine, but some videos didn't load properly.
One of the videos that causes problems is:
https://www.youtube.com/watch?v=mBqt_QO01bA
Website with embedded video
https://uta.inui-dondon-sukininaru.net/?sid=233
Some sites have been successfully embedded.
https://cn.noxinfluencer.com/youtube/video-analytics/mBqt_QO01bA
Therefore, you can be sure that the channel allows embedded playback of the video.
What could be the cause of embedded playback failure?

How to skip iframe video to the next

<iframe width="500" height="500" src="https://www.youtube.com/embed/OWsyrnOBsJs"></iframe>
<button>Skip Video</button>
I have set up iframe to embed the youtube video. When the video is over it gives me new recommended videos I can click and play. I was wondering how can I set up my button(skip video) to skip the video and auto play the next recommend video or perhaps the next video in the playlist?
Maybe HTML5 won't be enough so I might have to use JavaScript or Dart. What is the easiest way to go about doing this?
I advise you to use the YouTube JavaScript Player API.
There are many helpful methods to play the next video etc. It is very nice documentated.
Documentation Youtube API

iOS app playing youtube Video on Apple-TV

I would like to build an iOS app that plays youtube videos within a UIWebView window, with the UIWebView window being user selected to either play directly on the iOS device, or via AirPlay onto an AppleTV.
The website displayed in the UIWebView is my own website and will have javascript that will signal back-and-forth to the app when the youtube video ends (using the iframe api for youtube).
Question: Is the above possible?
Specifically, the iOS docs show that I need to have in the html within the UIWebView:
<video src="myPlaylist.m3u8"
height="300" width="400"
x-webkit-airplay="allow" >
<embed airplay="allow"
src="movie.mov"
width=400
height=300
mime-type="video/quicktime">
</embed>
</video>
But with YouTube iFrame api I do not have access to the < video > tag so how do I make the AirPlay icon visible to the user on the UIWebView window?
Thank you for any direction anyone can provide.
Jim
UIWebView uses it's own movie player controller to play embedded videos. It offers a setting to allow AirPlay:
[_webView setMediaPlaybackAllowsAirPlay:YES];
When set to YES, you'll get the familiar AirPlay icon when the movie plays.

MediaElementJS very buggy

Ive implemented an instance of mediaelement.js for my videos which are all in mp4 format. I cant get it to work properly, however. First here is how I have implemented it:
Video:
<video src="/video.mp4" type="video/mp4" controls preload="none" width="500" height="282"></video>
Place at the end of the body, right after including mediaelement.js itself:
$("video").mediaelementplayer({
mode:"shim",
startVolume:0.3
});
The problems I am having are:
In IE the silverlight player wont play the media. It looks like it is being loaded, since the videos length is being shown.
When mode is set to "shim," Chrome doesnt allow fullscreen.
When mode is set to "shim," iPhone users are met by a dead link.
When mode isnt set to "shim," iPhone users are met by the player that wont play the video.
Videos are .mp4 and in h.264 encoding.
Thanks in advance for any attempt to help.
The problem was that the videos had been interlaced by the media encoder. IE+iPhones dont play those.
The fullscreen was a problem with the flashplayer and only happened in some versions of Chrome.

Categories