-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
179 lines (173 loc) · 7.07 KB
/
index.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<head>
<!-- ... -->
<script src="https://fastly.jsdelivr.net/npm/[email protected]/dist/console-ban.min.js"></script>
<script>
// default options
ConsoleBan.init()
// custom options
ConsoleBan.init({
redirect: 'https://tsubakiawa.github.io/live/404.html'
})
</script>
</head>
<head>
<meta charset="UTF-8">
<title>EarlyDew Server</title>
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/[email protected]/dist/vuetify.min.css">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-118704626-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-118704626-1');
</script>
<style>
.html {
font-family: Noto Sans SC;
}
.v-card {
width: fit-content;
margin-left: auto;
margin-right: auto;
margin-bottom: 1px;
}
.flodiv1 {
position: absolute;
z-index: 100;
/* background-color: white; */
color: white;
padding: 1px;
opacity: 0.75
}
body::-webkit-scrollbar {
display: none;
}
</style>
</head>
<body>
<div id="app" class="hide-overflow" style="position: relative;height: 100%;"></div>
<div id="dplayer"></div>
<script src="https://fastly.jsdelivr.net/npm/vue"></script>
<script src="https://fastly.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://fastly.jsdelivr.net/npm/[email protected]/dist/vuetify.min.js"></script>
<script src="https://fastly.jsdelivr.net/npm/hls.js@latest"></script>
<script src="https://fastly.jsdelivr.net/npm/[email protected]/dist/flv.min.js"></script>
<script src="https://fastly.jsdelivr.net/npm/[email protected]/dist/DPlayer.min.js"></script>
<script src="https://fastly.jsdelivr.net/npm/vue-router/dist/vue-router.js"></script>
<script>
const router = new VueRouter({
mode: 'history',
})
var app = new Vue({
el: '#app',
router,
data: {
drawer: null,
items: [
],
dp: null,
url: 'http://localhost/test/index.m3u8',
type: 'hls',
appname: 'flv',
streamname: null,
visibility: '',
isload: false,
ratelimit: 0
},
mounted: function () {
if (this.$route.query.url != null) {
this.url = this.$route.query.url
}
if (this.$route.query.app != null) this.appname = this.$route.query.app
this.streamname = this.$route.query.stream
if (this.streamname != null) {
this.type = 'flv'
this.url = this.url + '?app=' + this.appname + '&stream=' + this.streamname
}
if (this.$route.query.ratelimit != null) {
this.ratelimit = parseFloat(this.$route.query.ratelimit)
}
this.$nextTick(function () {
// Code that will run only after the
// entire view has been rendered
this.dp = new DPlayer({
container: document.getElementById('dplayer'),
live: true,
autoplay: true,
volume: 1,
video: {
url: this.url,
type: this.type
},
contextmenu: [
{
text: 'Open Menu',
click: (player) => {
this.drawer = !this.drawer
}
},
{
text: 'Change URL',
click: (player) => {
this.changeurl()
}
}
],
});
this.dp.on('contextmenu_show', () => {
this.visibility = 'visibility: visible;'
});
this.dp.fullScreen.request('web');
this.dp.on('contextmenu_hide', () => {
this.visibility = 'visibility: hidden;'
});
setTimeout(() => { this.visibility = 'visibility: hidden;' }, 3000)
this.isload = true
if (this.ratelimit != 2) {//建议为2
setInterval(() => {
if (app.dp.video.buffered.length == 0) return
//console.log(this.dp.video.buffered.end(0) - this.dp.video.currentTime)
if (this.dp.video.buffered.end(0) - this.dp.video.currentTime > this.ratelimit + 1) {
this.dp.video.playbackRate = 1.2
//console.log('rate:1.2')
}
if (this.dp.video.buffered.end(0) - this.dp.video.currentTime <= this.ratelimit) {
this.dp.video.playbackRate = 1
//console.log('rate:1')
}
}, 100)
}
})
},
methods: {
itemclick: function (id) {
if (this.items[id].link == null) {
this.changeurl()
return
}
window.open(this.items[id].link)
},
cardclick: function (id) {
window.open(this.cardscpd[id].link)
},
changeurl: function () {
var tmp = prompt("输入播放地址", this.url)
if (tmp != null) this.url = tmp
this.dp.switchVideo({ url: this.url }, {})
}
},
watch: {
url: function (newvalue, oldvalue) {
//if (this.isload) {this.dp.switchVideo({ url: newvalue }, {})}
}
},
})
</script>
</body>
</html>