Making youtube.com/embed URLs work on iOS Making youtube.com/embed URLs work on iOS ios ios

Making youtube.com/embed URLs work on iOS


Try this, it just works:

<object>    <param name="movie" value="http://www.youtube.com/v/[VIDEO_ID]"></param>    <embed src="http://www.youtube.com/v/[VIDEO_ID]" type="application/x-shockwave-flash"></embed></object>

Edit:It works because Apple replaces the html tag with an embedded native movie player that can play the youtube video.


Consider using MediaElement.js. It can wrap youtube videos for display as html5 on ios, with flash fallback for other device/browser types.

One of the demos that are provided with the source shows this, and it's fairly simple:

<video width="640" height="360" id="player1">    <source type="video/youtube" src="http://www.youtube.com/watch?v=nOEw9iiopwI" /></video><script>    $('video').mediaelementplayer({        success: function(media, node, player) {            $('#' + node.id + '-mode').html('mode: ' + media.pluginType);    }    });</script>


@Hejazi's answer didn't work for me. This did:

    <iframe id="myythtml5player" frameborder="0" allowfullscreen="1" allow="autoplay; encrypted-media" width="560" height="315"    src="https://www.youtube.com/embed/XdMzPdgg6rs?widget_referrer=https%3A%2F%2Ftinybitegames.com&enablejsapi=1&origin=https%3A%2F%2Ftinybitegames.com&widgetid=1" data-tooltip-align="b,c" data-tooltip="YouTube video player" aria-label="YouTube video player" data-title="YouTube video player"></iframe>

This code was copied from YouTube's demo site: https://developers.google.com/youtube/youtube_player_demo