You need to make use of the iFrame API, otherwise you cannot interact with the video due to cross-domain policy:
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('player', {
height: '390',
width: '640',
videoId: 'M7lc1UVf-VE',
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
$('#maximage').maximage({
cycleOptions: {
fx: 'fade',
speed: 600,
timeout: 0,
prev: '.prev',
next: '.next',
pause: 1,
before: function(last,current){
if(player != null) player.playVideo()
},
after: function(last,current){
if(player != null) player.pauseVideo()
},
onFirstImageLoaded: function(){
jQuery('#loader').hide();
jQuery('#maximage').fadeIn(200);
}
});