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.
Thank you, that worked. But edpuzzle is now detecting that I'm skipping ahead, even at a 2x speed(Edit: I got it to work at 2x speed, but anything like 4x speed won't work). This will cause the video to be paused very often, and the final result is that it's actually slower than watching it normally. Is there a way to bypass this problem?