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
|
@ -23,22 +23,50 @@ function parse_query_string(){
|
|||
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 schema = (query.schema == undefined)? "rtmp":query.schema;
|
||||
|
||||
var port = (query.port == undefined)? 1935:query.port;
|
||||
var vhost = (query.vhost == undefined)? window.location.hostname:query.vhost;
|
||||
var app = (query.app == undefined)? "live":query.app;
|
||||
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();
|
||||
|
||||
if (url_obj) {
|
||||
$(url_obj).val(build_default_url());
|
||||
if (rtmp_url) {
|
||||
$(rtmp_url).val(build_default_rtmp_url());
|
||||
}
|
||||
if (hls_url) {
|
||||
$(hls_url).val(build_default_hls_url());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue