index.html
2.9 KB
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
<head>
<meta http-equiv=Content-Type content="text/html;charset=utf-8">
<title>OSMFPlayer</title>
</head>
<style>
body{margin:0; padding:0; color:#EEEEEE;}
input.url{width:300px; height:20px;}
input.size{width:40px; height:20px;}
input.buffer{width:20px; height:20px;}
input.play{width:60px; height: 25px;}
select.type{width:50px; }
span.size{padding-left:10px; padding-right:10px;}
div.main{font-size:12px; padding:5px 10px 0px 5px; background-color:#333333;}
div.player{padding-top:3px; padding-bottom:10px;}
div.control{padding-bottom:10px; background-color:#333333; }
</style>
<div class="main" id="main">
<div id="player" class="player"></div>
<div class="control" id="control">
Url(RTMP/HTTP): <input id="url" type="text" class="url" value="rtmp://dev:1935/live/livestream"></input>
<select class="type" id="type">
<option value="live" selected>live</option>
<option value="recorded">vod</option>
</select>
<span class="size">
Width: <input id="width" type="text" class="size" value="720"></input>
Height: <input id="height" type="text" class="size" value="576"></input>
Buffer: <input id="buffer" type="text" class="buffer" value="2"></input>(s)
</span>
<input type="button" class="play" value="Play" onclick="play()"></input>
</div>
</div>
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
player = document.getElementById("player");
player_div = null;
function play(){
// remove old player
if(player_div != null){
player.innerHTML = "";
}
// create new div
player_div = document.createElement("div");
player.appendChild(player_div);
// set id to swfobject to create player.
player_div.id = "player_div";
// generate player.
var width = document.getElementById("width").value;
var height = document.getElementById("height").value;
// set new style
var main = document.getElementById("main");
var min_width = 830;
main.style.width = Math.max(min_width, width);
var flashvars = {};
flashvars.src = document.getElementById("url").value;
flashvars.streamType = document.getElementById("type").value; // live or recorded
flashvars.autoPlay = true;
flashvars.controlBarAutoHide = false;
flashvars.scaleMode = "stretch";
flashvars.bufferTime = document.getElementById("buffer").value;
var params = {};
params.allowFullScreen = true;
var attributes = {};
swfobject.embedSWF(
"StrobeMediaPlayback.swf", "player_div",
width, height,
"11.1", "AdobeFlashPlayerInstall.swf",
flashvars, params, attributes
);
}
// play the default stream.
play();
</script>