Hocam bunun için kullandığın video player'in api'sini kullanmalısın.
Mesala YouTube için;
Böyle bir div oluştur single.php'de (video bu div'e eklenicek)
<div id="player"></div>
şu kodlarıda single.php'nin en altına ekle;
<script src="http://www.youtube.com/player_api"></script>
<script>
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
height: '390', // video yüksekliği
width: '640', // video genişliği
videoId: '0Bmhjf0rKe8', // oynatılacak video'nun id'si
events: {
'onStateChange': onPlayerStateChange
}
});
}
<?php
$next_post = get_next_post();
if (!empty( $next_post )): ?>
function onPlayerStateChange(event) {
if(event.data === 0) {
window.location = "<?php echo get_permalink( $next_post->ID ); ?>";
}
}
<?php endif; ?>
</script>