Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 increase youtube speed 2x from url?

Tags:

html

youtube

send

I would like to know how to speed up a youtube video 2x without the user clicking on the HTML5 (of the video), but instead by modifying the URL.

For example, I know how to watch video starting at a specific time by appending to the URL the parameter &t=1m1s (for 1 minute and one second). Is it possible to use a similar method to speed up the video 2x?

What parameters should I add to the URL to watch video in double speed (I'm using html5)?

like image 974
tonni Avatar asked Mar 24 '14 09:03

tonni


People also ask

How do you link a YouTube video to 2X speed?

Go to a video. Tap the video once, then tap More . Tap Playback Speed. Select the speed at which you'd like the video to play.

Can I increase speed of YouTube video more than 2?

There is not much difference to increase youtube playback speed on desktop and android devices. Navigate a video on the Youtube app on your device. Click on the three vertical dots aligned vertically at the top right corner of your screen. Click on 'Playback Speed.


1 Answers

There's no way to change playback speed by URL arguments.

Anyway, if you're working with HTML, you can take advantage of the YouTube Player iFrame API.

Here's how to configure your player with all the JavaScript: https://developers.google.com/youtube/iframe_api_reference#Getting_Started

And here's the function you're looking for to set playback speed: https://developers.google.com/youtube/iframe_api_reference#Playback_rate

So you can edit your onPlayerReady function like this:

function onPlayerReady(event) {   player.setPlaybackRate(2); // This is what you're looking for   event.target.playVideo(); } 

You can of course pass on step 5 of the documentation as this will stop your video from playing after six seconds.

If you have trouble setting that up, I'll edit a JSFiddle later (couldn't do it at work as my Flash plugin won't launch).

Update :

Here's the JSFiddle working fine with this code exactly: http://jsfiddle.net/jpreynat/e11oy0eu/

like image 158
jpreynat Avatar answered Oct 04 '22 13:10

jpreynat