Last active
June 10, 2021 20:14
-
-
Save thebells1111/9ac48fd822d009cf7fa498c0e262b5da to your computer and use it in GitHub Desktop.
Minimum implementation of videojs, p2p and hls
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
<head> | |
<link href="https://vjs.zencdn.net/7.11.4/video-js.css" rel="stylesheet" /> | |
<script | |
src="https://cdn.jsdelivr.net/npm/p2p-media-loader-core@latest/build/p2p-media-loader-core.min.js"></script> | |
<script | |
src="https://cdn.jsdelivr.net/npm/p2p-media-loader-hlsjs@latest/build/p2p-media-loader-hlsjs.min.js"></script> | |
<script src="https://vjs.zencdn.net/7.11.4/video.min.js"></script> | |
<script | |
src=" https://cdn.streamroot.io/videojs-hlsjs-plugin/1/stable/videojs-hlsjs-plugin.js"></script> | |
</head> | |
<body> | |
<video id="video_1" class="video-js" controls preload="auto"> | |
<source | |
src="https://noagendatube.com/static/streaming-playlists/hls/7f80cf89-ac4e-4869-95b8-bcf8f7ca23b7/master.m3u8" | |
type="application/x-mpegURL" /> | |
</video> | |
<script> | |
function p2pSetup() { | |
if (p2pml.hlsjs.Engine.isSupported()) { | |
const engine = new p2pml.hlsjs.Engine(); | |
const options = { | |
html5: { | |
hlsjsConfig: { | |
capLevelToPlayerSize: true, | |
liveSyncDurationCount: 5, | |
loader: engine.createLoaderClass(), | |
}, | |
}, | |
}; | |
const player = videojs('video_1', options); | |
p2pml.hlsjs.initVideoJsHlsJsPlugin(player); | |
} | |
} | |
p2pSetup() | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment