Hi all,
i try to play a link from youtube inside the SmartTV.
I use YTPlayer, the code can be found at bottom section of this message.
This code can display the video, but need to be set as autoplay and HTML5.
And, somehow, this is not stable.
Sometimes, the video can be played.
Sometimes, it will display blank screen.
Another information :
At 2012 tv, this code is working .
but at 2011 tv, can't play the youtube
Any suggestion for play youtube at SmartTV will be helpful.
Code :
player2 = new YT.Player('player2', {
height:'320',
width:'520',
videoId: getYoutubeID(url),
playerVars: { 'html5':1,'autoplay': 1, 'controls': 0 },
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
var done = false;
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.PLAYING && !done) {
setTimeout(stopVideo, 6000);
done = true;
}
}
function onPlayerReady(event) {
event.target.playVideo();
}