前情提要: 【分享】本地视频时间戳,基于 http+ 油猴,无需 quicker
需提前在电脑上开启 everything 的 http 服务(默认端口 80),或提前启动 alist(默认端口 5244)。
可安装我写好的油猴脚本:https://greasyfork.org/zh-CN/scripts/479104
或者按下面的源代码新建:
// ==UserScript== // @name 视频时间戳(支持everything和alist) // @namespace http://tampermonkey.net/ // @version 0.4 // @description 在视频链接后面加上后缀 ?t=30 ,那么进入视频链接就会自动跳转到30秒。(everthing默认端口80。alist默认端口5244) // @author openAI // @match http://localhost/* // @match http://127.0.0.1/* // @match http://localhost:5244/* // @match http://127.0.0.1:5244/* // @icon https://img.icons8.com/?size=160&id=BiA4DdLOEKBN&format=png // @license MIT // @grant none // ==/UserScript== class myclass{ static start(){ return myclass.wait_video() } // 等待播放器加载 static wait_video() { 'use strict'; let wait_video_interval = setInterval(() => { if(document.getElementsByTagName('video').length) { clearInterval(wait_video_interval) return myclass.modif_time() } }, 500); } static modif_time() { 'use strict'; //获取url参数 const paramsStr = window.location.search const params = new URLSearchParams(paramsStr) const seconds = parseInt(params.get('t')) //进度条跳转 let myVideo = document.getElementsByTagName("video")[0] if(seconds){ myVideo.currentTime = seconds myVideo.play() } } } // 相当于主函数 (function() { 'use strict'; myclass.start() })();
附上演示视频:
https://www.bilibili.com/video/BV1L84y1Q7Nq/
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于