-
Notifications
You must be signed in to change notification settings - Fork 206
/
Copy pathplayer.html
98 lines (98 loc) · 2.93 KB
/
player.html
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>亦搜 视频播放器</title>
<style>
body {
padding: 0;
margin: 0;
}
</style>
</head>
<body>
<!-- <h1></h1> -->
<div id="dplayer"></div>
<script src="https://cdn.bootcdn.net/ajax/libs/hls.js/1.1.5-0.canary.8240/hls.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/dplayer/1.26.0/DPlayer.min.js"></script>
<script>
function loadVideo(){
try {
var url = window.location.hash.substring(1);
var dp = new DPlayer({
autoplay: true,
theme: "#FADFA3",
loop: true,
lang: "zh-cn",
hotkey: true,
preload: "auto",
// logo: "logo.png",
volume: 0.7,
mutex: true,
container: document.getElementById("dplayer"),
video: {
url: decodeURIComponent(url),
// pic: "https://i.loli.net/2019/06/06/5cf8c5d9c57b510947.png",
// thumbnails: "https://i.loli.net/2019/06/06/5cf8c5d9c57b510947.png",
type: "auto",
},
screenshot: true,
// subtitle: {
// url: "dplayer.vtt",
// type: "webvtt",
// fontSize: "25px",
// bottom: "10%",
// color: "#b7daff",
// },
// danmaku: {
// id: "9E2E3368B56CDBB4",
// api: "https://api.prprpr.me/dplayer/",
// token: "tokendemo",
// maximum: 1000,
// addition: ["https://api.prprpr.me/dplayer/v3/bilibili?aid=4157142"],
// user: "DIYgod",
// bottom: "15%",
// unlimited: true,
// },
// contextmenu: [
// {
// text: "custom1",
// link: "https://github.com/DIYgod/DPlayer",
// },
// {
// text: "custom2",
// click: (player) => {
// console.log(player);
// },
// },
// ],
highlight: [
{
text: "marker for 20s",
time: 20,
},
{
text: "marker for 2mins",
time: 120,
},
],
});
dp.on("fullscreen_cancel", function () {
dp.fullScreen.request("web");
});
dp.fullScreen.request("web");
} catch (error) {
alert(`${error}`);
}
dp.fullScreen.request("web");
}
loadVideo();
window.onhashchange = function () {
console.log("URL发生变化了");
loadVideo();
};
</script>
</body>
</html>