Google browser video playback acceleration to achieve

chrome browser console to create and execute js script
Chrome is small snippets of a script, you can also create and execute in the source panel Chrome DevTools. You can access and run them from any page. When you run a segment, it performs the context of the currently open page. This article focuses on how to use and complete a page auto-refresh function.

first step

First f12 open Developer Tools, and then open the Sources panel, click on the Snippets tab in the Navigator, right-click and select New.

The second step

Enter the code editor. When you have unsaved changes, next to the name of your script with "*", like the following screenshot. Press Command + S (Mac) or Ctrl + S (Windows and Linux), to save the changes.

The third step is to run your code snippets

There are three ways:
1, in the clip file name (lists all of the segments in the left pane), right-click and select "RUN".
2, click the Run button (▶).
3, press Command + Enter (Mac) or Ctrl + Enter (Windows and Linux).

For example: video playback acceleration to achieve.

// accelerated playback
document.getElementById ( "tcPlayer_html5_api"). PlaybackRate = 3

// 空格键控制播放
document.onkeyup = function (event) {
var e = event || window.event || arguments.callee.caller.arguments[0];
var obj = document.getElementById(“tcPlayer_html5_api”);
if (e && e.keyCode == 32) {
obj.paused === true ? obj.play() : obj.pause();
return false;
} else if (e && e.keyCode == 37) {
obj.currentTime !== 0 ? obj.currentTime -= 20 : 1;
return false;
} else if (e && e.keyCode == 39) {
obj.currentTime !== obj.duration ? obj.currentTime += 20 : 1;
return false;
} else if (e && e.keyCode == 38) {
obj.volume <= 0.9 ? obj.volume += 0.1 : 1;
return false;
} else if (e && e.keyCode == 40) {
obj.volume >= 0.1 ? obj.volume -= 0.1 : 1;
return false;
}
};

Published 21 original articles · won praise 23 · views 90000 +

Guess you like

Origin blog.csdn.net/mdw0730/article/details/104490188