当前位置:网站首页>谷歌浏览器实现视频播放加速功能
谷歌浏览器实现视频播放加速功能
2020-11-06 21:45:00 【会开车的架构师】
chrome浏览器控制台创建js脚本并执行
Chrome的snippets是小脚本,还可以创作并在Chrome DevTools的来源面板中执行。您可以访问和从任何页面运行它们。当你运行一个片段,它从当前打开的页面的上下文中执行。本文主要讲如何使用,并完成一个页面自动刷新的功能。
第一步
首先f12 打开开发者工具,再打开Sources面板中,单击上Snippets选项卡,在导航器中单击鼠标右键,然后选择New。
第二步
在编辑器中输入代码。当你有未保存的更改,您的脚本名称旁边有“*”,像下面的截图。按Command+S(Mac)或Ctrl+S(Windows和Linux),以保存更改。
第三步运行你的代码片段
有三种方式:
1、在片段文件名(在左侧窗格中列出了所有的片段)右键单击并选择“RUN”。
2、点击运行按钮()。
3、按Command+Enter(Mac)或Ctrl+Enter(Windows和Linux)。
例如:视频加速播放功能实现。
// 加速播放
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;
}
};
版权声明
本文为[会开车的架构师]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4629483/blog/4529693
边栏推荐
- 【转发】查看lua中userdata的方法
- CloudQuery V1.2.0 版本发布
- 代码生成器插件与Creator预制体文件解析
- Unity性能优化整理
- image operating system windows cannot be used on this platform
- C# 调用SendMessage刷新任务栏图标(强制结束时图标未消失)
- Contract trading system development | construction of smart contract trading platform
- ORA-02292: 违反完整约束条件 (MIDBJDEV2.SYS_C0020757) - 已找到子记录
- How to play sortable JS vuedraggable to realize nested drag function of forms
- Small program introduction to proficient (2): understand the four important files of small program development
猜你喜欢

Get twice the result with half the effort: automation without cabinet

Python basic data type -- tuple analysis

ado.net和asp.net的关系

ES6 learning notes (5): easy to understand ES6's built-in extension objects

Digital city responds to relevant national policies and vigorously develops the construction of digital twin platform

ES6 learning notes (3): teach you to use js object-oriented thinking to realize the function of adding, deleting, modifying and checking tab column
![Network security engineer Demo: the original * * is to get your computer administrator rights! [maintain]](/img/14/ede1ffa7811dbc2a5b15b9a7b17a5e.jpg)
Network security engineer Demo: the original * * is to get your computer administrator rights! [maintain]

游戏开发中的新手引导与事件管理系统

Basic usage of Vue codemirror: search function, code folding function, get editor value and verify in time

Use modelarts quickly, zero base white can also play AI!
随机推荐
es创建新的索引库并拷贝旧的索引库 实践亲测有效!
Python basic data type -- tuple analysis
EOS founder BM: what's the difference between UE, UBI and URI?
小游戏云开发入门
一路踩坑,被迫聊聊 C# 代码调试技巧和远程调试
Use modelarts quickly, zero base white can also play AI!
行为型模式之解释器模式
A small goal in 2019 to become a blog expert of CSDN
The AI method put forward by China has more and more influence. Tianda et al. Mined the development law of AI from a large number of literatures
大会倒计时|2020 PostgreSQL亚洲大会-中文分论坛议程安排
How to get started with new HTML5 (2)
To Lianyun analysis: why is IPFs / filecoin mining so difficult?
Gather in Beijing! The countdown to openi 2020
Share with Lianyun: is IPFs / filecoin worth investing in?
Summary of front-end performance optimization that every front-end engineer should understand:
检测证书过期脚本
Axios learning notes (2): easy to understand the use of XHR and how to package simple Axios
StickEngine-架构12-通信协议
Look! Internet, e-commerce offline big data analysis best practice! (Internet disk link attached)
Basic usage of GDB debugging