How to Change YouTube Rollers on Each Video
I can download and play Youtube Video through the iFrame API, but I cannot figure out how to change the player parameter for the second video. I don't want any controls on the first video, and then when the user clicks on my custom Play Video, I want to play the second video with a control bar. I can set playerVars to initialize the player, but I don't know how to change it when the player is already loaded. Any ideas?
Many thanks.
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
videoId: 'M7lc1UVf-VE',
playerVars: { 'autoplay': 1, 'controls': 0 },
events: {
'onReady': onPlayerReady,
'onPlaybackQualityChange': onPlayerPlaybackQualityChange,
'onStateChange': onPlayerStateChange,
'onError': onPlayerError
}
});
}
function onPlayerReady {
var $btn = '<button id="play">Play Button</button>';
$('#nav').prepend($btn);
$('#play').click(function() {
player.loadVideoByUrl('http://youtu.be/GBHxL-LXJbs?controls=1');
});
}
+3
source to share
No one has answered this question yet
Check out similar questions: