-
Notifications
You must be signed in to change notification settings - Fork 0
/
player-html5.html
81 lines (57 loc) · 1.73 KB
/
player-html5.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>🦸 Cassettator Forbidden Adventures</title>
<link rel="stylesheet" href="style.css">
</head>
<style>
video {
width: 100%;
max-width: 640px;
height: 360px;
}
input {
border: none;
width: 100%;
max-width: 640px;
height: 30px;
outline: none;
margin: 5px 0 0 0;
padding: 10px;
font-size: 15px;
}
button {
border: none;
width: 100%;
max-width: 120px;
height: 30px;
font-size: 15px;
margin: 5px 0 0 0;
padding: 0;
}
</style>
<body>
<video playsinline="playsinline" id="player" controls autoplay class="player"></video>
<input title="Video source" type="text" name="src" id="src">
<button class="btn">Load src</button>
<script>
const url = new URL(location.toString());
const mediaSource = url.searchParams.has('url') ? url.searchParams.get('url') : undefined;
const player = document.querySelector('#player');
const input = document.querySelector('#src');
const bnt = document.querySelector('.btn');
const defaultSource = 'https://d2zihajmogu5jn.cloudfront.net/bipbop-advanced/bipbop_16x9_variant.m3u8';
player.src = mediaSource || defaultSource;
input.value = input.value || mediaSource || defaultSource;
bnt.addEventListener('click', (e) => {
e.preventDefault();
if (!!input.value.trim()) {
player.src = input.value;
return;
}
});
</script>
</body>
</html>