mirror of
https://github.com/bluenviron/mediamtx.git
synced 2025-12-25 12:32:01 -08:00
hls: support reading on iOS Safari
This commit is contained in:
parent
600f7bf48c
commit
ffe4a2d1e7
1 changed files with 19 additions and 14 deletions
|
|
@ -48,24 +48,29 @@ const index = `<!DOCTYPE html>
|
|||
const create = () => {
|
||||
const video = document.getElementById('video');
|
||||
|
||||
const hls = new Hls({
|
||||
progressive: false,
|
||||
});
|
||||
if (video.canPlayType('application/vnd.apple.mpegurl')) {
|
||||
video.src = 'stream.m3u8';
|
||||
video.play();
|
||||
} else {
|
||||
const hls = new Hls({
|
||||
progressive: false,
|
||||
});
|
||||
|
||||
hls.on(Hls.Events.ERROR, (evt, data) => {
|
||||
if (data.fatal) {
|
||||
hls.destroy();
|
||||
hls.on(Hls.Events.ERROR, (evt, data) => {
|
||||
if (data.fatal) {
|
||||
hls.destroy();
|
||||
|
||||
setTimeout(() => {
|
||||
create();
|
||||
}, 2000);
|
||||
}
|
||||
});
|
||||
setTimeout(() => {
|
||||
create();
|
||||
}, 2000);
|
||||
}
|
||||
});
|
||||
|
||||
hls.loadSource('stream.m3u8');
|
||||
hls.attachMedia(video);
|
||||
hls.loadSource('stream.m3u8');
|
||||
hls.attachMedia(video);
|
||||
|
||||
video.play();
|
||||
video.play();
|
||||
}
|
||||
}
|
||||
create();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue