Viki

Viki 写东西的地方

努力上进且优秀
github
email
x
steam
bilibili
douban

Someone actually rewarded me for this impromptu Greasemonkey script.

Update in 2022: Baidu Netdisk web version has been updated, the mentioned script and example code in this article are no longer valid. If you still have a need for playback speed, you can use the browser extension Global Speed for Google Chrome.

The day before yesterday (June 15, 2020), when I was watching online course videos on Baidu Netdisk (really just studying for online courses!! Unfortunately, as a college student, I'm preparing for final exams), I found that ordinary users cannot play videos at a faster speed, which greatly reduces the efficiency of learning and troubles me.

As someone who likes to tinker around, I googled for a solution and found that the video player used by Baidu Netdisk is an open-source videojs. By entering the following line of code in the browser console to obtain the instance and call the relevant API, you can easily achieve video playback at a faster speed:

window.videojs.getPlayers('video-player').html5Player.tech_.setPlaybackRate(2.0)

Although it does work, I felt that it was quite troublesome to manually open the developer tools and copy the code to the console every time. At the same time, I thought of Tampermonkey, which I have been using. I wondered if I could write a similar script myself.

So I started working on it. I performed simple DOM operations to add a few buttons (using the CSS class styles provided by the original webpage). This way, it looks simple, beautiful, and does not conflict with the original design. Then I changed the button click event to the code mentioned above and modified the corresponding playback rate. That's it. Afterwards, I open-sourced the code on GitHub and also published it on Greasy Fork for easy installation.

Last night (June 16, 2020), I actually received a 5 yuan reward on WeChat. The sender did not leave any comments, just added a line: "The netdisk playback speed is great!" I checked the name of the person who rewarded me: "*Sheng". It should not be someone I know personally.

Although the 💰 amount is not much, the core code of the script is only about forty lines and does not require much technical expertise. But through something I created myself, I was able to help others and received their recognition (which is still materialistic). For me, it is still a very, very big encouragement.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.