mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
update the ui, add hls player
This commit is contained in:
parent
6e4795ee5c
commit
0c08942fec
11 changed files with 387 additions and 38 deletions
|
@ -37,5 +37,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<hr>
|
||||||
|
<footer>
|
||||||
|
<p><a href="https://github.com/winlinvip/simple-rtmp-server">SRS Team © 2013</a></p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -23,22 +23,50 @@ function parse_query_string(){
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_default_url() {
|
/**
|
||||||
|
@param vhost the vhost of rtmp. default to window.location.hostname
|
||||||
|
@param port the port of rtmp. default to 1935
|
||||||
|
@param app the app of rtmp. default to live.
|
||||||
|
@param stream the stream of rtmp. default to livestream.
|
||||||
|
*/
|
||||||
|
function build_default_rtmp_url() {
|
||||||
var query = parse_query_string();
|
var query = parse_query_string();
|
||||||
|
|
||||||
var schema = (query.schema == undefined)? "rtmp":query.schema;
|
|
||||||
var port = (query.port == undefined)? 1935:query.port;
|
var port = (query.port == undefined)? 1935:query.port;
|
||||||
var vhost = (query.vhost == undefined)? window.location.hostname:query.vhost;
|
var vhost = (query.vhost == undefined)? window.location.hostname:query.vhost;
|
||||||
var app = (query.app == undefined)? "live":query.app;
|
var app = (query.app == undefined)? "live":query.app;
|
||||||
var stream = (query.stream == undefined)? "livestream":query.stream;
|
var stream = (query.stream == undefined)? "livestream":query.stream;
|
||||||
|
|
||||||
return schema + "://" + vhost + ":" + port + "/" + app + "/" + stream;
|
return "rtmp://" + vhost + ":" + port + "/" + app + "/" + stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
function srs_init(url_obj) {
|
/**
|
||||||
|
@param vhost the vhost of hls. default to window.location.hostname
|
||||||
|
@param hls_port the port of hls. default to window.location.port
|
||||||
|
@param app the app of hls. default to live.
|
||||||
|
@param stream the stream of hls. default to livestream.
|
||||||
|
*/
|
||||||
|
function build_default_hls_url() {
|
||||||
|
var query = parse_query_string();
|
||||||
|
|
||||||
|
var vhost = (query.vhost == undefined)? window.location.hostname:query.vhost;
|
||||||
|
var port = (query.hls_port == undefined)? window.location.port:query.hls_port;
|
||||||
|
var app = (query.app == undefined)? "live":query.app;
|
||||||
|
var stream = (query.stream == undefined)? "livestream":query.stream;
|
||||||
|
|
||||||
|
if (port == "" || port == null || port == undefined) {
|
||||||
|
port = 80;
|
||||||
|
}
|
||||||
|
return "http://" + vhost + ":" + port + "/" + app + "/" + stream + ".m3u8";
|
||||||
|
}
|
||||||
|
|
||||||
|
function srs_init(rtmp_url, hls_url) {
|
||||||
update_nav();
|
update_nav();
|
||||||
|
|
||||||
if (url_obj) {
|
if (rtmp_url) {
|
||||||
$(url_obj).val(build_default_url());
|
$(rtmp_url).val(build_default_rtmp_url());
|
||||||
|
}
|
||||||
|
if (hls_url) {
|
||||||
|
$(hls_url).val(build_default_hls_url());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,38 +13,47 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript" src="js/jwplayer.js" ></script>
|
<script type="text/javascript" src="js/jwplayer.js" ></script>
|
||||||
<script>jwplayer.key="L1P3Ig76mGOK94gZ9WAAGD+Fb1VCVhoZ/Dm0fg=="</script>
|
<script type='text/javascript'>jwplayer.key = 'N8zhkmYvvRwOhz4aTGkySoEri4x+9pQwR7GHIQ=='; </script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
function jwplayer_play(url) {
|
||||||
|
$("#main_modal").show(function(){
|
||||||
|
$("#div_container").remove();
|
||||||
|
|
||||||
|
var obj = $("<div/>");
|
||||||
|
$(obj).attr("id", "div_container");
|
||||||
|
|
||||||
|
var player = $("<div/>");
|
||||||
|
$(obj).append(player);
|
||||||
|
$(obj).attr("id", "player_id");
|
||||||
|
|
||||||
|
$("#player").append(obj);
|
||||||
|
|
||||||
|
var conf = {
|
||||||
|
file: url,
|
||||||
|
width: "530",
|
||||||
|
height: "300",
|
||||||
|
autostart: true,
|
||||||
|
analytics: { enabled: false}
|
||||||
|
};
|
||||||
|
jwplayer('player_id').setup(conf);
|
||||||
|
});
|
||||||
|
$("#main_modal").modal({show:true, keyboard:false});
|
||||||
|
}
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
// get the vhost and port to set the default url.
|
// get the vhost and port to set the default url.
|
||||||
// for example: http://192.168.1.213/players/jwplayer6.html?port=1935&vhost=demo
|
// for example: http://192.168.1.213/players/jwplayer6.html?port=1935&vhost=demo
|
||||||
// url set to: rtmp://demo:1935/live/livestream
|
// url set to: rtmp://demo:1935/live/livestream
|
||||||
srs_init($("#txt_url"));
|
srs_init("#txt_rtmp_url", "#txt_hls_url");
|
||||||
|
|
||||||
$("#btn_play").click(function(){
|
$("#btn_play_rtmp").click(function(){
|
||||||
$("#main_modal").show(function(){
|
var url = $("#txt_rtmp_url").val();
|
||||||
$("#div_container").remove();
|
jwplayer_play(url);
|
||||||
|
});
|
||||||
var obj = $("<div/>");
|
|
||||||
$(obj).attr("id", "div_container");
|
$("#btn_play_hls").click(function(){
|
||||||
|
var url = $("#txt_hls_url").val();
|
||||||
var player = $("<div/>");
|
jwplayer_play(url);
|
||||||
$(obj).append(player);
|
|
||||||
$(obj).attr("id", "player_id");
|
|
||||||
|
|
||||||
$("#player").append(obj);
|
|
||||||
|
|
||||||
var url = $("#txt_url").val();
|
|
||||||
|
|
||||||
var conf = {
|
|
||||||
file: url,
|
|
||||||
width: "530",
|
|
||||||
height: "300",
|
|
||||||
autostart: true,
|
|
||||||
};
|
|
||||||
jwplayer('player_id').setup(conf);
|
|
||||||
});
|
|
||||||
$("#main_modal").modal({show:true, keyboard:false});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -74,8 +83,14 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-inline">
|
<div class="form-inline">
|
||||||
URL:
|
URL:
|
||||||
<input type="text" id="txt_url" class="input-xxlarge" value=""></input>
|
<input type="text" id="txt_rtmp_url" class="input-xxlarge" value=""></input>
|
||||||
<button class="btn" id="btn_play">播放视频</button>
|
<button class="btn" id="btn_play_rtmp">播放RTMP</button>
|
||||||
|
</div>
|
||||||
|
<hr/>
|
||||||
|
<div class="form-inline">
|
||||||
|
URL:
|
||||||
|
<input type="text" id="txt_hls_url" class="input-xxlarge" value=""></input>
|
||||||
|
<button class="btn" id="btn_play_hls"> 播放HLS </button>
|
||||||
</div>
|
</div>
|
||||||
<div id="main_modal" class="modal hide fade">
|
<div id="main_modal" class="modal hide fade">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
|
@ -88,6 +103,10 @@
|
||||||
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true"> 关闭 </button>
|
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true"> 关闭 </button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr>
|
||||||
|
<footer>
|
||||||
|
<p><a href="https://github.com/winlinvip/simple-rtmp-server">SRS Team © 2013</a></p>
|
||||||
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
@ -99,5 +99,9 @@
|
||||||
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true"> 关闭 </button>
|
<button class="btn btn-primary" data-dismiss="modal" aria-hidden="true"> 关闭 </button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr>
|
||||||
|
<footer>
|
||||||
|
<p><a href="https://github.com/winlinvip/simple-rtmp-server">SRS Team © 2013</a></p>
|
||||||
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -37,5 +37,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<hr>
|
||||||
|
<footer>
|
||||||
|
<p><a href="https://github.com/winlinvip/simple-rtmp-server">SRS Team © 2013</a></p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
@ -37,5 +37,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<hr>
|
||||||
|
<footer>
|
||||||
|
<p><a href="https://github.com/winlinvip/simple-rtmp-server">SRS Team © 2013</a></p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
@ -37,5 +37,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<hr>
|
||||||
|
<footer>
|
||||||
|
<p><a href="https://github.com/winlinvip/simple-rtmp-server">SRS Team © 2013</a></p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
@ -41,5 +41,11 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<iframe id="main_frame" width="100%" height="800" frameBorder="0"></iframe>
|
<iframe id="main_frame" width="100%" height="800" frameBorder="0"></iframe>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="container">
|
||||||
|
<hr>
|
||||||
|
<footer>
|
||||||
|
<p><a href="https://github.com/winlinvip/simple-rtmp-server">SRS Team © 2013</a></p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue