MicroCommunityWeb/public/v.html
2024-07-11 15:30:36 +08:00

34 lines
985 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<title>video</title>
<script src="https://unpkg.com/flv.js/dist/flv.min.js"></script>
</head>
<body>
<div>
<video id="my-player" preload="auto" muted autoplay type="rtmp/flv">
<source src="">
</video>
</div>
</body>
</html>
<script>
// 获取video节点
videoElement = document.getElementById('my-player');
if (flvjs.isSupported()) {
flvPlayer = flvjs.createPlayer({
type: 'flv',
isLive: true,
url: 'http://localhost:3000/output_file.flv',//flv格式流地址
},{
enableWorker: false, //不启用分离线程
enableStashBuffer: false, //关闭IO隐藏缓冲区
reuseRedirectedURL: true, //重用301/302重定向url用于随后的请求如查找、重新连接等。
autoCleanupSourceBuffer: true //自动清除缓存
});
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load(); //加载
flvPlayer.play();//播放
}
</script>