Created
June 29, 2021 15:25
-
-
Save jingerso/d45fecf054d2e49de5e3341a6ae59f04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Video from Joe Ingersoll</title> | |
</head> | |
<body> | |
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script> | |
<video | |
id="my-player" | |
controls | |
style="width: 100%; max-width: 500px;" | |
/> | |
<script> | |
const video = document.querySelector('#my-player'); | |
const src = 'https://stream.mux.com/G700OEFRSpPzAbRZZj8F1tp9kRYjndftKe00q100uA2ZYM.m3u8'; | |
if (video.canPlayType('application/vnd.apple.mpegurl')) { | |
// Some browers (safari and ie edge) support HLS natively | |
video.src = src; | |
} else if (Hls.isSupported()) { | |
const hls = new Hls(); | |
hls.loadSource(src) | |
hls.attachMedia(video); | |
} else { | |
console.error("This is a legacy browser that doesn't support MSE"); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment