初始化
This commit is contained in:
44
admin/index.html
Normal file
44
admin/index.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>FLV 流播放</title>
|
||||
<script src="/js/flv.js"></script>
|
||||
<style>
|
||||
body {
|
||||
background: #000;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
video {
|
||||
width: 80%;
|
||||
max-width: 960px;
|
||||
background: #000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<video id="videoElement" controls autoplay></video>
|
||||
|
||||
<script>
|
||||
if (flvjs.isSupported()) {
|
||||
const videoElement = document.getElementById('videoElement');
|
||||
const flvPlayer = flvjs.createPlayer({
|
||||
type: 'flv',
|
||||
url: 'http://172.16.10.97:8000/live/stream.flv', // 你的流地址
|
||||
isLive: true, // 表示是直播流
|
||||
cors: true, // 如果跨域要设置
|
||||
hasAudio: false // 如果你推流里没有音频,可以加上这个
|
||||
});
|
||||
flvPlayer.attachMediaElement(videoElement);
|
||||
flvPlayer.load();
|
||||
flvPlayer.play();
|
||||
} else {
|
||||
alert("当前浏览器不支持 flv.js 播放 FLV 流");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
10
admin/js/flv.js
Normal file
10
admin/js/flv.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user