You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/projects/srs/objs/nginx/html/index.html

48 lines
1.6 KiB

<html>
<body>
<div style="margin: 0 auto;width: 1000px;text-align:center;">
<input type="text" id="url" value="http://192.168.1.3:8080/live/test.flv"
style="box-sizing: border-box;width: 600px;margin: 0;">
<button id="btn" style="box-sizing: border-box;width: 40px;margin: 0;">load</button>
<br>
<video id="videoElement" controls muted autoplay style="width: 640px;height: 480px;"></video>
</div>
<script src="flv.min.js"></script>
<script>
var flvPlayer;
document.getElementById("btn").addEventListener('click', function () {
if (flvPlayer) {
try {
flvPlayer.pause();
} catch (e) {
console.error(e);
}
flvPlayer.unload();
flvPlayer.detachMediaElement();
try {
flvPlayer.destroy();
} catch (e) {
console.error(e);
}
flvPlayer = null;
}
flvPlayer = flvjs.createPlayer({
type: 'flv',
url: document.getElementById("url").value,
isLive: true,
cors: true
}, {
enableWorker: true,
enableStashBuffer: false,
stashInitialSize: 1,
fixAudioTimestampGap: false
});
flvPlayer.attachMediaElement(document.getElementById("videoElement"));
flvPlayer.load();
});
</script>
</body>
</html>