|
@@ -0,0 +1,90 @@
|
|
1
|
+<!DOCTYPE html>
|
|
2
|
+<html>
|
|
3
|
+
|
|
4
|
+<head>
|
|
5
|
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
|
6
|
+ <title>flv.js demo</title>
|
|
7
|
+ <style>
|
|
8
|
+ .mainContainer {
|
|
9
|
+ display: block;
|
|
10
|
+ width: 1024px;
|
|
11
|
+ margin-left: auto;
|
|
12
|
+ margin-right: auto;
|
|
13
|
+ }
|
|
14
|
+
|
|
15
|
+ .urlInput {
|
|
16
|
+ display: block;
|
|
17
|
+ width: 100%;
|
|
18
|
+ margin-left: auto;
|
|
19
|
+ margin-right: auto;
|
|
20
|
+ margin-top: 8px;
|
|
21
|
+ margin-bottom: 8px;
|
|
22
|
+ }
|
|
23
|
+
|
|
24
|
+ .centeredVideo {
|
|
25
|
+ display: block;
|
|
26
|
+ width: 100%;
|
|
27
|
+ height: 576px;
|
|
28
|
+ margin-left: auto;
|
|
29
|
+ margin-right: auto;
|
|
30
|
+ margin-bottom: auto;
|
|
31
|
+ }
|
|
32
|
+
|
|
33
|
+ .controls {
|
|
34
|
+ display: block;
|
|
35
|
+ width: 100%;
|
|
36
|
+ text-align: left;
|
|
37
|
+ margin-left: auto;
|
|
38
|
+ margin-right: auto;
|
|
39
|
+ }
|
|
40
|
+ </style>
|
|
41
|
+</head>
|
|
42
|
+
|
|
43
|
+<body>
|
|
44
|
+<div class="mainContainer">
|
|
45
|
+ <video id="videoElement" class="centeredVideo" controls autoplay width="1024" height="576">Your browser is too old which doesn't support HTML5 video.</video>
|
|
46
|
+</div>
|
|
47
|
+<br>
|
|
48
|
+<div class="controls">
|
|
49
|
+ <!--<button onclick="flv_load()">加载</button>-->
|
|
50
|
+ <button onclick="flv_start()">开始</button>
|
|
51
|
+ <button onclick="flv_pause()">暂停</button>
|
|
52
|
+ <button onclick="flv_destroy()">停止</button>
|
|
53
|
+ <input style="width:100px" type="text" name="seekpoint" />
|
|
54
|
+ <button onclick="flv_seekto()">跳转</button>
|
|
55
|
+</div>
|
|
56
|
+<script src="https://cdn.bootcdn.net/ajax/libs/flv.js/1.5.0/flv.min.js"></script>
|
|
57
|
+<script>
|
|
58
|
+ var player = document.getElementById('videoElement');
|
|
59
|
+ if (flvjs.isSupported()) {
|
|
60
|
+ var flvPlayer = flvjs.createPlayer({
|
|
61
|
+ type: 'flv',
|
|
62
|
+ url: 'http://chenqinghe.com:7001/live/movie.flv'
|
|
63
|
+ });
|
|
64
|
+ flvPlayer.attachMediaElement(videoElement);
|
|
65
|
+ flvPlayer.load(); //加载
|
|
66
|
+ }
|
|
67
|
+
|
|
68
|
+ function flv_start() {
|
|
69
|
+ player.play();
|
|
70
|
+ }
|
|
71
|
+
|
|
72
|
+ function flv_pause() {
|
|
73
|
+ player.pause();
|
|
74
|
+ }
|
|
75
|
+
|
|
76
|
+ function flv_destroy() {
|
|
77
|
+ player.pause();
|
|
78
|
+ player.unload();
|
|
79
|
+ player.detachMediaElement();
|
|
80
|
+ player.destroy();
|
|
81
|
+ player = null;
|
|
82
|
+ }
|
|
83
|
+
|
|
84
|
+ function flv_seekto() {
|
|
85
|
+ player.currentTime = parseFloat(document.getElementsByName('seekpoint')[0].value);
|
|
86
|
+ }
|
|
87
|
+</script>
|
|
88
|
+</body>
|
|
89
|
+
|
|
90
|
+</html>
|