forked from godka/rtmp-html
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html.bak
122 lines (111 loc) · 2.86 KB
/
index.html.bak
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Rtmp|HLS 点播测试器</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<script type="text/javascript" src="/swfobject.js"></script>
<script type="text/javascript" src="/ParsedQueryString.js"></script>
<script type="text/javascript">
var player = null;
function loadStream(url) {
player.setMediaResourceURL(url);
}
function getlink(url) {
return "/index.html?src=" + encodeURIComponent(url);
}
function jsbridge(playerId, event, data) {
if (player == null) {
player = document.getElementById(playerId);
}
switch(event) {
case "onJavaScriptBridgeCreated":
listStreams(teststreams,"streamlist");
break;
case "timeChange":
case "timeupdate":
case "progress":
break;
default:
console.log(event, data);
}
}
// Collect query parameters in an object that we can
// forward to SWFObject:
var pqs = new ParsedQueryString();
var parameterNames = pqs.params(false);
var parameters = {
src: "rtmp://localhost/live/stream",
autoPlay: "true",
verbose: true,
controlBarAutoHide: "true",
controlBarPosition: "bottom",
poster: "images/poster.png",
javascriptCallbackFunction: "jsbridge",
plugin_hls: "/flashlsOSMF.swf",
hls_minbufferlength: -1,
hls_maxbufferlength: 30,
hls_lowbufferlength: 3,
hls_seekmode: "KEYFRAME",
hls_startfromlevel: -1,
hls_seekfromlevel: -1,
hls_live_flushurlcache: false,
hls_info: true,
hls_debug: false,
hls_debug2: false,
hls_warn: true,
hls_error: true,
hls_fragmentloadmaxretry : -1,
hls_manifestloadmaxretry : -1,
hls_capleveltostage : false,
hls_maxlevelcappingmode : "downscale"
};
for (var i = 0; i < parameterNames.length; i++) {
var parameterName = parameterNames[i];
parameters[parameterName] = pqs.param(parameterName) ||
parameters[parameterName];
}
var wmodeValue = "direct";
var wmodeOptions = ["direct", "opaque", "transparent", "window"];
if (parameters.hasOwnProperty("wmode"))
{
if (wmodeOptions.indexOf(parameters.wmode) >= 0)
{
wmodeValue = parameters.wmode;
}
delete parameters.wmode;
}
// Embed the player SWF:
swfobject.embedSWF(
"GrindPlayer.swf"
, "GrindPlayer"
, 800
, 600
, "10.1.0"
, "expressInstall.swf"
, parameters
, {
allowFullScreen: "true",
wmode: wmodeValue
}
, {
name: "GrindPlayer"
}
);
</script>
<div id="GrindPlayer">
<p>
Alternative content
</p>
</div>
<br>
<input id="userInput" value="rtmp://localhost/live/stream" size="80"> <button onclick="userSubmit()">Play RTMP or HLS Stream</button><br>
<p>
<script type="text/javascript">
function userSubmit() {
window.location = getlink(document.getElementById('userInput').value);
}
</script>
</body>
</html>