当前位置:网站首页>Google browser realizes video playback acceleration function
Google browser realizes video playback acceleration function
2020-11-06 21:45:00 【Architects who can drive】
chrome Browser console creation js Script and execute
Chrome Of snippets It's a little script , You can also create and create in Chrome DevTools In the source panel of the . You can access and run them from any page . When you run a clip , It is executed from the context of the currently open page . This article mainly talks about how to use , And complete a page auto refresh function .
First step
First f12 Open developer tools , And on again Sources The palette , Click on Snippets tab , Right click in navigator , And then choose New.
The second step
Enter the code in the editor . When you have unsaved changes , Next to your script name is “*”, Like the screenshot below . Press Command+S(Mac) or Ctrl+S(Windows and Linux), To save changes .
The third step is to run your code fragment
There are three ways :
1、 In the fragment file name ( All the clips are listed 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 : Speed up the video playback function to achieve .
// Speed up the playback
document.getElementById(“tcPlayer_html5_api”).playbackRate = 3
// The space bar controls playback
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;
}
};
版权声明
本文为[Architects who can drive]所创,转载请带上原文链接,感谢
边栏推荐
- Markdown tricks
- 行为型模式之解释器模式
- The legality of IPFs / filecoin: protecting personal privacy from disclosure
- Contract trading system development | construction of smart contract trading platform
- Road to simple HTML + JS to achieve the most simple game Tetris
- 迅为-iMX6ULL开发板上配置AP热点
- 2020-08-30:裸写算法:二叉树两个节点的最近公共祖先。
- Detect certificate expiration script
- 1万辆!理想汽车召回全部缺陷车:已发生事故97起,亏损将扩大
- The role of theme music in games
猜你喜欢

Those who have worked in China for six years and a million annual salary want to share these four points with you

Using an example to understand the underlying processing mechanism of JS function

2020-08-20:GO语言中的协程与Python中的协程的区别?

【涂鸦物联网足迹】涂鸦云平台全景介绍

Unexpected element.. required element

意外的元素..所需元素..

迅为-iMX6ULL开发板上配置AP热点

Markdown tricks

Zero basis to build a web search engine of its own

An article will introduce you to CSS3 background knowledge
随机推荐
STM32F030K6T6兼容替换灵动MM32F031K6T6
Hdu3974 assign the task segment tree DFS order
1万辆!理想汽车召回全部缺陷车:已发生事故97起,亏损将扩大
Big data processing black Technology: revealing the parallel computing technology of Pb level data warehouse gaussdb (DWS)
es创建新的索引库并拷贝旧的索引库 实践亲测有效!
ES6 learning notes (3): teach you to use js object-oriented thinking to realize the function of adding, deleting, modifying and checking tab column
To teach you to easily understand the basic usage of Vue codemirror: mainly to achieve code editing, verification prompt, code formatting
The native API of the future trend of the front end: web components
How much disk space does a new empty file take?
Python 100 cases
An article taught you to download cool dog music using Python web crawler
Understanding formatting principles
All the way, I was forced to talk about C code debugging skills and remote debugging
The role of theme music in games
The Interpreter pattern of behavior pattern
ES6 learning notes (5): easy to understand ES6's built-in extension objects
行为型模式之备忘录模式
Unexpected element.. required element
Road to simple HTML + JS to achieve the most simple game Tetris
递归、回溯算法常用数学基础公式