Skip to content

Instantly share code, notes, and snippets.

View GinjaNinja5197's full-sized avatar

GinjaNinja5199 GinjaNinja5197

View GitHub Profile
@GinjaNinja5197
GinjaNinja5197 / explainer.md
Last active February 25, 2022 17:06 — forked from SheepTester/explainer.md
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 =).