当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Open source a set of minimalist front and rear end separation project scaffold
- An article taught you to use HTML5 SVG tags
- Flink's datasource Trilogy: direct API
- [forward] how to view UserData in Lua
- Understanding formatting principles
- Event monitoring problem
- Why is quicksort so fast?
- win7 APPCRASH(解决方法)(转)
- window系统 本机查找端口号占用方法
- The native API of the future trend of the front end: web components
猜你喜欢
Windows 10 蓝牙管理页面'添加蓝牙或其他设备'选项点击无响应的解决方案
How to make characters move
How does filecoin's economic model and future value support the price of fil currency breaking through thousands
An article will introduce you to CSS3 background knowledge
C and C / C + + mixed programming series 5 - GC collaboration of memory management
Basic usage of Vue codemirror: search function, code folding function, get editor value and verify in time
What are the highlights of Huawei mate 40 series with HMS?
Summary of front-end interview questions (C, s, s) that front-end engineers need to understand (2)
实验一
The native API of the future trend of the front end: web components
随机推荐
移动端像素适配方案
Those who have worked in China for six years and a million annual salary want to share these four points with you
Introduction to the development of small game cloud
迅为-iMX6ULL开发板上配置AP热点
上海巨微专用蓝牙广播芯片
The isolation level of transaction and its problems
What is the tensor in tensorflow?
Stickinengine architecture 12 communication protocol
MRAM高速缓存的组成
C and C / C + + mixed programming series 5 - GC collaboration of memory management
An article will take you to understand CSS alignment
2020-08-18:介绍下MR过程?
How about small and medium-sized enterprises choose shared office?
The role of theme music in games
[forward] how to view UserData in Lua
CloudQuery V1.2.0 版本发布
STM32F030K6T6兼容替换灵动MM32F031K6T6
2020-08-17:详细说下数据倾斜怎么解决?
Small program introduction to proficient (2): understand the four important files of small program development
Js字符串-String字符串对象方法