当前位置:网站首页>谷歌浏览器实现视频播放加速功能
谷歌浏览器实现视频播放加速功能
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
边栏推荐
- Isn't data product just a report? absolutely wrong! There are university questions in this category
- 意派Epub360丨你想要的H5模板都在这里,电子书、大转盘、红包雨、问卷调查……
- An article taught you to use HTML5 SVG tags
- An article will take you to understand CSS alignment
- Live broadcast preview | micro service architecture Learning Series live broadcast phase 3
- ES6 learning notes (4): easy to understand the new grammar of ES6
- Axios learning notes (2): easy to understand the use of XHR and how to package simple Axios
- What is alicloud's experience of sweeping goods for 100 yuan?
- 代码重构之法——方法重构分析
- How to get started with new HTML5 (2)
猜你喜欢

FastThreadLocal 是什么鬼?吊打 ThreadLocal 的存在!!

Building a new generation cloud native data lake with iceberg on kubernetes

An article will take you to understand CSS3 fillet knowledge

StickEngine-架构11-消息队列(MessageQueue)

Description of phpshe SMS plug-in

What are PLC Analog input and digital input

华为云微认证考试简介

事件监听问题

行为型模式之备忘录模式

ES6 learning notes (2): teach you to play with class inheritance and class objects
随机推荐
FastThreadLocal 是什么鬼?吊打 ThreadLocal 的存在!!
CCR coin frying robot: the boss of bitcoin digital currency, what you have to know
嘉宾专访|2020 PostgreSQL亚洲大会阿里云数据库专场:王涛
Ronglian completed US $125 million f round financing
Contract trading system development | construction of smart contract trading platform
What are manufacturing and new automation technologies?
es创建新的索引库并拷贝旧的索引库 实践亲测有效!
Some operations kept in mind by the front end foundation GitHub warehouse management
Python basic variable type -- list analysis
A small goal in 2019 to become a blog expert of CSDN
JVM内存分配 -Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m
Asp.Net Core learning notes: Introduction
Axios learning notes (2): easy to understand the use of XHR and how to package simple Axios
一部完整的游戏,需要制作哪些音乐?
Basic principle and application of iptables
To teach you to easily understand the basic usage of Vue codemirror: mainly to achieve code editing, verification prompt, code formatting
JNI-Thread中start方法的呼叫與run方法的回撥分析
Diamond standard
git远程库回退指定版本
How to turn data into assets? Attracting data scientists