Skip to content Skip to sidebar Skip to footer

Playback Speed Control For YouTube Videos? HTML5?

I need to implement a video playback speed controller (e.g.: play the video at 1/2 speed) for youtube videos, and I'm thinking that HTML5 is currently the only way to do this (if i

Solution 1:

The new iframe api allows you to control the speed of the video:

iframe api reference: Setting the playback rate

The default playback rate is 1, which indicates that the video is playing at normal speed. Playback rates may include values like 0.25, 0.5, 1, 1.5, and 2.

Also:

Calling this function does not guarantee that the playback rate will actually change.

Example code:

function onYouTubeIframeAPIReady() {
  var player;
  player = new YT.Player('player', {
    videoId: 'M7lc1UVf-VE',
    playerVars: { 'autoplay': 1, 'controls': 0 },
    events: {
      'onReady': function(e){
        // e.target = player
        e.target.setPlaybackRate(0.5); // set to half speed
        e.target.playVideo(); // watch lolcats in slow motion :)
      },
    }
  });
}

Solution 2:

http://mediaelementjs.com/ is crossbrowser,uses flash or html5 depending on the browser support and has all the methods you are looking for.


Solution 3:

$('#video').playbackRate = 3.0 or $('video').playbackRate = 3.0 depending on version


Post a Comment for "Playback Speed Control For YouTube Videos? HTML5?"