hello,
thanks for the info - but i don't know how i should do this - i
believe my hole page would work if i would receive the youtube api
events - but it looks like i do not get them maybe because i only have
the ipad simulator and i found this post here:
http://groups.google.com/group/phonegap/browse_thread/thread/1d5f5b3752b249e4/331b1d2f9a516c70?lnk=gst&q=iframe#331b1d2f9a516c70
?
here a short example:
i do on device ready within my index.html:
function onDeviceReady() {
inityt();
}
</script>
somewhere after body i have a div like this:
<div id='player'></div>
this i would use for the create player funciton in my api ready event.
the inityt is within my javascript file and it is called and running
because i put some console.log messages and i can see this function
runs completly without any error as far i know - the function looks
like this:
function iniyt(){
//console.log('crytapi debug#1');
var tag = document.createElement('script');
//console.log('crytapi debug#2');
tag.src = "
http://www.youtube.com/player_api";
//
tag.id = 'ytmHoHaSo' + plid;
// console.log('crytapi debug#3');
var firstScriptTag = document.getElementsByTagName('script')[0];
// console.log('crytapi debug#4');
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
//console.log('crytapi debug#5');
}
this function should fire an event 'onYouTubePlayerReady' - but i
don't get this event anymore and so i believe this is the reason i can
not create the player afterwards:
function onYouTubePlayerReady(playerId) {
console.log('onYouTubePlayerReady' + playerId);
createPlayer();
}
any idea why i don't get this event - is it because i'm only running
on the simulator?
i can open the complete page with the safari browser on the ipad
simulator and everything works great - but i can not build an app...
i also tried to figure out the ChildBrowser plugin - but i don't have
an idea how and where i need to change my simple page - if i could get
a code example i should be able to figure it out on my own - but id
need some help/starting point to make this page an app.
thanks
holli
PS: here is the createPlayer function:
function createLeftPlayer(ytid) {
console.log('player create function');
var ytid = ytid;
if (ytid === 'startup'){
var ytid = 'EV0qAQ9uyzY';
}
playerl = new YT.Player('pll', {
//frameborder: '1',
//align: 'middle',
height: hgtv,
width: '395',
videoId: ytid,
playerVars: { 'enablejsapi': plvar1, 'playerapiid': 'playerl',
'hd': plvar2, 'autoplay': plvar3, 'controls': plvar4, 'showinfo':
plvar5, 'showsearch': plvar6, 'rel': plvar7},
events: {
'onReady': onPlayerReadyL,
'onPlaybackQualityChange': onPlayerPlaybackQualityChangeL,
'onStateChange': onPlayerStateChangeL,
'onError': onPlayerErrorL
}
});
$('#player > iframe').attr('id', 'pl');
$('#pl').attr('frameborder', 0);
$('#pl').attr('title', 'YOUTUBE PLAYER');
console.log('creatPlayer end');