Skip to content

Instantly share code, notes, and snippets.

@SheepTester
Created May 4, 2020 19:35
Show Gist options
  • Save SheepTester/a5009c402d58117b167049faa274de52 to your computer and use it in GitHub Desktop.
Save SheepTester/a5009c402d58117b167049faa274de52 to your computer and use it in GitHub Desktop.
Change speed of Edpuzzle video

Edpuzzle aggressively reverts the playbackRate of a <video> element, so you can't simply change it to increase the speed. Thus, a more aggressive response is necessary to combat it.

Firstly, we get the <video> element:

video = document.querySelector('video')

Then, we get the setter function for the playbackRate property using Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'playbackRate').set. It is called with the <video> element as this and with speed as the new value. This way, the <video> element is properly notified of the speed change by simulating assigning a value to playBackRate directly (ie using =).

Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'playbackRate').set.call(video, speed)

After that, to prevent Edpuzzle from changing it back, we make playbackRate unwritable, so they can't simply set it:

Object.defineProperty(video, 'playbackRate', { writable: false })

Of course, if we can change the speed this way, so can Edpuzzle, so this might not work in the future.

// Paste the following code in the console (right click > inspect element, then click on the Console tab) on the Edpuzzle page
speed = 2 // Change this to the speed (eg 2 for 2x speed)
video = document.querySelector('video')
Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'playbackRate').set.call(video, speed)
Object.defineProperty(video, 'playbackRate', { writable: false })
@SheepTester
Copy link
Author

SheepTester commented Jan 26, 2022

javascript:(() => { const speed = prompt('Speed', 2), video = document.querySelector('video'); Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, 'playbackRate').set.call(video, speed); Object.defineProperty(video, 'playbackRate', { writable: false }) })()

@anhdq201
Copy link

Can you help me rewind the video?

@SheepTester
Copy link
Author

Rewind? Does Edpuzzle block seeking previous parts of the video?

@GinjaNinja5197
Copy link

this dont work no more

@SheepTester
Copy link
Author

oh well. it's an arms race

@GinjaNinja5197
Copy link

have you fixed it i have a 40 minute long video to watch

@SheepTester
Copy link
Author

lazy

@kickturn
Copy link

Use the method to skip to the end, that one just worked for me on a 24 minute video.

@GinjaNinja5197
Copy link

my school blocked inspect element

@GinjaNinja5197
Copy link

you alive @SheepTester

@SheepTester
Copy link
Author

that sucks

@GinjaNinja5197
Copy link

have you figured out a fix for it because i know nothing about coding

@SheepTester
Copy link
Author

no

@GinjaNinja5197
Copy link

I found a fix using a Inspect element bookmarklet and deleting a lot of stuff around the video which unlocks the video so i just skip through refresh the page and answer the questions.

@rsangimino335
Copy link

can you make it so a can fast forward throught the video

@treeesswebsite
Copy link

Yes pls Fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment