Making youtube.com/embed URLs work on iOS

后端 未结 4 1475
慢半拍i
慢半拍i 2020-12-05 08:06

For a given video on YouTube, you can visit http://youtube.com/watch?v=[code] on any iOS device to see the video.

However, if you use the http://youtube.com/embed/[c

相关标签:
4条回答
  • 2020-12-05 08:18

    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.

    0 讨论(0)
  • 2020-12-05 08:33

    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>
    
    0 讨论(0)
  • 2020-12-05 08:37

    I have a website that uses youtube api v3 to find videos and then play them. I host the web in gdrive. Get the link, pass the link to the adress bar of the FIREFOX ios app. Save this html in FF app. It works just as well as when using a desktop. But ios FF is very unfriendly, it doesn’t share the html source to anywhere else.

    Better than FF, you can use ios Aloha browser. And best of all, after saving html to ALOHA, share it into the ios KODER html editor. Inside KODER, you can edit the html (for example, add <base href=“...”> and ect ...), you can perfectly render this html. Finally you can share (upload) the html to Dropbox, then export it to gDrive.

    0 讨论(0)
  • 2020-12-05 08:40

    @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&amp;enablejsapi=1&amp;origin=https%3A%2F%2Ftinybitegames.com&amp;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

    0 讨论(0)
提交回复
热议问题