Skip to content

Instantly share code, notes, and snippets.

@ZiTAL
Last active September 10, 2023 12:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ZiTAL/434338d6d5cf9abdd47211f3e980aaa4 to your computer and use it in GitHub Desktop.
Save ZiTAL/434338d6d5cf9abdd47211f3e980aaa4 to your computer and use it in GitHub Desktop.
js: videojs hls example
<!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>
@ZiTAL
Copy link
Author

ZiTAL commented Apr 27, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment