-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathplay.js
More file actions
38 lines (35 loc) · 1.1 KB
/
play.js
File metadata and controls
38 lines (35 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import syncApi from "./config.js";
// https://api.dogecloud.com/player/get.flv?vcode=5ac682e6f8231991&userId=17&ext=.flv https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd
const createPlayer = (v, url, type = 'auto', curTime = 0) => {
if (!type || type == 'auto') type = uu.getPlayType(url);
const p = new DPlayer({
video: { url, type },
theme: "#00B3FF",
autoplay: true,
screenshot: true,
contextmenu: [
{
text: '刷新',
click(player) {
const s = new URL(location.href);
s.searchParams.set('curTime', ~~player.video.currentTime);
location.replace(s.href);
}
}
],
container: v
});
p.video.addEventListener('durationchange', function() {
if (this.duration == Infinity) return;
p.speed(+localStorage.mvPlayRate || 1.4);
curTime && p.seek(+curTime);
}, {once: true});
return p;
};
const mvUrl = location.hash.slice(1);
const ps = new URLSearchParams(location.search);
(async function(){
uu.hookHls(await syncApi.read({hlsCache:!1,buffSize:60}));
window.dp = createPlayer(uu.q('#player'), mvUrl, ps.get('vType'), ps.get('curTime'));
dp.video.click()
})();