forked from blaise-io/acelink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.html
38 lines (38 loc) · 1.48 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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Ace Link</title>
<link href="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.14.1/video-js.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.14.1/video.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-media-sources/4.7.2/videojs-contrib-media-sources.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/5.15.0/videojs-contrib-hls.min.js"></script>
<style>
body, html, video, .video-js {
margin: 0;
padding: 0;
width: 100vw;
height: 100vh;
}
.video-js .vjs-big-play-button {
top: 45%;
left: 50%;
transform: translate(-50% -50%);
}
</style>
</head>
<body>
<video id="v" class="video-js vjs-default-skin" controls autoplay preload width="100%" height="100%"></video>
<script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/7.6.5/video.js"></script>
<script>
const player = videojs("v");
const id = new URL(location.href).searchParams.get('id') || alert('Missing ?id=');
const manifest = encodeURIComponent(`http://127.0.0.1:6878/ace/getstream?id=${id}`);
player.src({
src: `http://127.0.0.1:6878/hls/manifest.m3u8?manifest_url=${manifest}`,
type: 'application/x-mpegURL',
});
document.title += ` – ${id.substr(0, 7)}`;
</script>
</body>
</html>