Doidgey Doidgey - 2 months ago 48
iOS Question

How to embed youtube video in Phonegap ios app

I've been searching for a long time for a solution but all i can find are things related to the old versions of phonegap.

I basically need to include some youtubes videos on my app, but currently using a include code such as:

<iframe width="240" height="180" src="http://www.youtube.com/embed/PEfxz7PuI0g" allowfullscreen></iframe>


This doesn't display anything apart from the space the video would take up, just a grey box. I'm using phonegap 2.9.0 and the latest version of xCode. I've tried setting the domains to allow youtube, but this didn't help:

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


I believe that was for previous versions of phonegap apps for ios. Can anyone help, it would be appreciated.

Answer

try the below code hope it will help full for you

var video_embeded='PEfxz7PuI0g';

<object><param name="movie" value="https://www.youtube.com/v/'+video_embeded+'&hl=en_US&feature=player_embedded&version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="https://www.youtube.com/v/'+video_embeded+'?suggestedQuality=medium&hl=en_US&feature=player_embedded&version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always"></embed></object>

this is help full for me....

Comments