Reputation: 4179
In normal html file, I use below code and it's working great.
var youtube;
var params = { allowScriptAccess: "always" };
var atts = { id: "youtube" };
swfobject.embedSWF("http://www.youtube.com/apiplayer?enablejsapi=1&version=3",
"ytpC", "1", "1", "8", "expressInstall.swf", null, params, atts);
.
.
youtube.loadVideoById(link);
But when I moved this html into android phonegap environment, then it gives 'cannot call loadVideoById method of undefined!'
What is the exact problem? What can I do to get success?
Upvotes: 0
Views: 1248
Reputation: 5381
Flash is not supported and is not working on Android and ios (in case you plan to deploy on ios later on)
When you mentioned that it gives cannot call loadVideoById method of undefined!, it is because you are using Flash API https://developers.google.com/youtube/flash_api_reference
Try using the iFrame API so it will use HTML5 instead https://developers.google.com/youtube/iframe_api_reference
Upvotes: 2