-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathhttp-flv-example.html
53 lines (39 loc) · 1.23 KB
/
http-flv-example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<html>
<head>
<title>FlvTest</title>
</head>
<script src="https://cdn.bootcdn.net/ajax/libs/flv.js/1.5.0/flv.min.js"></script>
<body>
<h1>HTTP FLV TEST</h1>
<video id="videoElement" height="720px" width="1280px"></video>
<button onclick="goLoad()">Click Load First</button>
<button onclick="goPlay()">Then Click Play</button>
</body>
<script>
var flvPlayer;
function goLoad() {
console.log("load click!");
console.log("mse live support:" + flvjs.getFeatureList().mseLiveFlvPlayback);
if (flvjs.isSupported()) {
var videoElement = document.getElementById('videoElement');
console.log("videoElement:" + videoElement);
flvPlayer = flvjs.createPlayer({
type: 'flv',
isLive: true,
url: "http://127.0.0.1:8080/live/first",
duration: 0,
filesize: 0,
enableStashBuffer: false,
hasAudio: true,
hasVideo: true
});
flvPlayer.attachMediaElement(videoElement);
flvPlayer.load();
}
}
function goPlay() {
console.log("play button press")
flvPlayer.play();
}
</script>
</html>