-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
184 lines (175 loc) · 6.84 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
180
181
182
183
184
<!DOCTYPE html>
<html lang="ru">
<head>
<title>localix.ru</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta charset="UTF-8">
</head>
<link href="vendor/videojs/7.6/video-js.css" rel="stylesheet">
<link href="vendor/videojs-playlist-ui/3.6.0/videojs-playlist-ui.css" rel="stylesheet">
<link href="css/examples.css" rel="stylesheet">
<script src="vendor/videojs/7.6/video.js"></script>
<!-- increase browser support with MSE polyfill -->
<script src="vendor/videojs-contrib-media-sources/4.4.4/videojs-contrib-media-sources.min.js"></script>
<script src="vendor/hls/0.12.4/hls.js"></script>
<script src="vendor/videojs-hlsjs/1.0.13/videojs-hlsjs-plugin.js"></script>
<script src="vendor/p2p-media-loader/0.6.2/p2p-media-loader-core.min.js"></script>
<script src="vendor/p2p-media-loader/0.6.2/p2p-media-loader-hlsjs.min.js"></script>
<script src="vendor/videojs-playlist/4.3.1/videojs-playlist.js"></script>
<script src="vendor/videojs-playlist-ui/3.6.0/videojs-playlist-ui.js"></script>
<body>
<div class="player-container">
<video-js id="player" class="vjs-default-skin video-js" controls autoplay loop preload="auto" width="580" height="300">
<source src='https://tv.localix.ru/channel_01/stream.m3u8' type='application/x-mpegURL'>
</video-js>
<div class="playlist-holder">
<div class="vjs-playlist">
</div>
</div>
</div>
<p id="version"></p>
<script>
document.querySelector('#version').innerText = `hls.js version: ${Hls.version}, engine supported: ${p2pml.hlsjs.Engine.isSupported()}`;
var engine = new p2pml.hlsjs.Engine();
p2pml.hlsjs.initVideoJsHlsJsPlugin();
// setup beforeinitialize hook
var player = videojs('#player', {
autoplay: true,
controls: true,
loop: true,
muted: true,
preload: 'auto',
html5: {
hlsjsConfig: {
debug: false,
enableWorker: true,
// Other hlsjsConfig options provided by hls.js
loader: engine.createLoaderClass()
}
}
});
videojs.Html5Hlsjs.addHook('beforeinitialize', (videojsPlayer, hlsjsInstance) => {
hlsjsInstance.on(Hls.Events.MANIFEST_PARSED, function() {
// player.play();
});
hlsjsInstance.on(Hls.Events.ERROR, function (event, data) {
if (data.fatal) {
switch(data.type) {
case Hls.ErrorTypes.NETWORK_ERROR:
console.log("fatal network error encountered, try to recover");
break;
case Hls.ErrorTypes.MEDIA_ERROR:
hlsjsInstance.recoverMediaError();
break;
}
}
});
});
player.reloadSourceOnError();
player.src({ src: 'https://tv.localix.ru/channel_01/stream.m3u8',
type: 'application/x-mpegURL' });
player.playlist([{
name: '01. ПЕРВЫЙ КАНАЛ',
sources: [{ src: 'https://tv.localix.ru/channel_01/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/01.png'}]
}, {
name: '02. ВТОРОЙ КАНАЛ',
sources: [{ src: 'https://tv.localix.ru/channel_02/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/02.png'}]
}, {
name: '03. МАТЧ!',
sources: [{ src: 'https://tv.localix.ru/channel_03/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/03.png'}]
}, {
name: '04. НТВ',
sources: [{ src: 'https://tv.localix.ru/channel_04/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/04.png'}]
}, {
name: '05. ПЯТЫЙ КАНАЛ',
sources: [{ src: 'https://tv.localix.ru/channel_05/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/05.png'}]
}, {
name: '06. РОССИЯ-К',
sources: [{ src: 'https://tv.localix.ru/channel_06/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/06.png'}]
}, {
name: '07. РОССИЯ-24',
sources: [{ src: 'https://tv.localix.ru/channel_07/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/07.png'}]
}, {
name: '08. КАРУСЕЛЬ',
sources: [{ src: 'https://tv.localix.ru/channel_08/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/08.png'}]
}, {
name: '09. ОТР',
sources: [{ src: 'https://tv.localix.ru/channel_09/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/09.png'}]
}, {
name: '10. ТВ Центр',
sources: [{ src: 'https://tv.localix.ru/channel_10/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/10.png'}]
}, {
name: '11. РЕН ТВ',
sources: [{ src: 'https://tv.localix.ru/channel_11/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/11.png'}]
}, {
name: '12. Спас',
sources: [{ src: 'https://tv.localix.ru/channel_12/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/12.png'}]
}, {
name: '13. СТС',
sources: [{ src: 'https://tv.localix.ru/channel_13/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/13.png'}]
}, {
name: '14. Домашний',
sources: [{ src: 'https://tv.localix.ru/channel_14/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/14.png'}]
}, {
name: '15. ТВ3',
sources: [{ src: 'https://tv.localix.ru/channel_15/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/15.png'}]
}, {
name: '16. Пятница',
sources: [{ src: 'https://tv.localix.ru/channel_16/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/16.png'}]
}, {
name: '17. Звезда',
sources: [{ src: 'https://tv.localix.ru/channel_17/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/17.png'}]
}, {
name: '18. Мир',
sources: [{ src: 'https://tv.localix.ru/channel_18/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/18.png'}]
}, {
name: '19. ТНТ',
sources: [{ src: 'https://tv.localix.ru/channel_19/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/19.png'}]
}, {
name: '20. МУЗ ТВ',
sources: [{ src: 'https://tv.localix.ru/channel_20/stream.m3u8',
type: 'application/x-mpegURL' }],
thumbnail: [{src: 'icon/20.png'}]
}]);
player.playlistUi();
</script>
</body>
</html>