Last active
September 10, 2023 12:11
-
-
Save ZiTAL/434338d6d5cf9abdd47211f3e980aaa4 to your computer and use it in GitHub Desktop.
js: videojs hls example
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> | |
<head> | |
<meta charset=utf-8 /> | |
<title>videojs-contrib-hls embed</title> | |
<link href="https://vjs.zencdn.net/8.0.4/video-js.css" rel="stylesheet"> | |
<script src="https://vjs.zencdn.net/8.0.4/video.min.js"></script> | |
<script src="https://unpkg.com/@videojs/http-streaming@3.2.0/dist/videojs-http-streaming.min.js"></script> | |
</head> | |
<body> | |
<h1>Video.js Example Embed</h1> | |
<video | |
id="my_video_1" | |
class="video-js vjs-default-skin" | |
type="application/x-mpegURL" | |
src="https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8" | |
width="640" | |
height="268" | |
controls> | |
</video> | |
<script> | |
const video = document.querySelector('#my_video_1') | |
const src = video.getAttribute('src') | |
const type = video.getAttribute('type') | |
const player = videojs(video) | |
player.src({ | |
src: src, | |
type: type | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://jsfiddle.net/g19ot705/