youtube videos on iphone phonegap app

后端 未结 4 822
一生所求
一生所求 2021-01-07 06:19

I\'m sorry to come back to this topic again, but i\'m really frustrated!! I\'ve read every resource i\'ve found, googling around the web, but i couldn\'t come up with a def

相关标签:
4条回答
  • 2021-01-07 06:39

    Apart from using <iframe> ... </iframe> you also need to set the property OpenAllWhitelistURLsInWebView to YES in your PhoneGap.plist. This would show and play the video inside the PhoneGap application itself. It is tried and tested.

    0 讨论(0)
  • 2021-01-07 06:42

    You could try embedding the YouTube video as an iframe, I believe that is the recommended way to do it now:

    http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html

    <iframe src="http://www.youtube.com/embed/VIDEO_ID" class="youtube-player" type="text/html" width="640" height="385"  frameborder="0">
    </iframe>
    
    0 讨论(0)
  • 2021-01-07 06:43

    Here is a component I've end up using in my app. Done with a help of YouTube iFrame API.

    0 讨论(0)
  • 2021-01-07 06:48

    Here is a nice tutorial Which Saved my Day

    http://eisabainyo.net/weblog/2012/01/24/embed-a-youtube-video-iframe-in-phonegap-app/

    Also i m posting some codes For a quick Access.

    <html>
        <head>
            <title>YouTube video</title>
            <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
            <meta name="apple-mobile-web-app-capable" content="yes" />
            <meta name="apple-mobile-web-app-status-bar-style" content="black" />
            <script src="phonegap-1.2.0.js"></script>
        </head>
        <body>
    
            <iframe width="560" height="315" src="http://www.youtube.com/embed/9HDeEbJyNK8" frameborder="0" allowfullscreen></iframe>
    
        </body>
    </html>
    

    Then make the following changes in Phonegap.plist

    MediaPlaybackRequiresUserAction: NO
    AllowInlineMediaPlayback: YES
    OpenAllWhitelistURLsInWebView: YES
    ExternalHosts
              *.youtube.com
              *.ytimg.com
    

    Video will play on your Simulator Also.

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