1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

support play hls

This commit is contained in:
winlin 2016-03-19 16:35:13 +08:00
parent 69ec66ee36
commit 46a31f4884
11 changed files with 5321 additions and 53 deletions

View file

@ -61,28 +61,46 @@ function build_default_rtmp_url() {
var app = (query.app == undefined)? "live":query.app;
var stream = (query.stream == undefined)? "demo":query.stream;
if (server == vhost || vhost == "") {
return schema + "://" + server + ":" + port + "/" + app + "/" + stream;
} else {
return schema + "://" + server + ":" + port + "/" + app + "...vhost..." + vhost + "/" + stream;
var queries = [];
if (server != vhost && vhost != "__defaultVhost__") {
queries.push("vhost=" + vhost);
}
if (query.shp_identify) {
queries.push("shp_identify=" + query.shp_identify);
}
var uri = schema + "://" + server + ":" + port + "/" + app + "/" + stream + "?" + queries.join('&');
while (uri.indexOf("?") == uri.length - 1) {
uri = uri.substr(0, uri.length - 1);
}
return uri;
}
// for the chat to init the publish url.
function build_default_publish_rtmp_url() {
var query = parse_query_string();
var schema = (query.schema == undefined)? "rtmp":query.schema;
var server = (query.server == undefined)? window.location.hostname:query.server;
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)? "demo":query.stream;
if (server == vhost || vhost == "") {
return "rtmp://" + server + ":" + port + "/" + app + "/" + stream;
} else {
vhost = srs_get_player_chat_vhost(vhost);
return "rtmp://" + server + ":" + port + "/" + app + "...vhost..." + vhost + "/" + stream;
var queries = [];
if (server != vhost && vhost != "__defaultVhost__") {
queries.push("vhost=" + srs_get_player_chat_vhost(vhost));
}
if (query.shp_identify) {
queries.push("shp_identify=" + query.shp_identify);
}
var uri = schema + "://" + server + ":" + port + "/" + app + "/" + stream + "?" + queries.join('&');
while (uri.indexOf("?") == uri.length - 1) {
uri = uri.substr(0, uri.length - 1);
}
return uri;
}
// for the bandwidth tool to init page
function build_default_bandwidth_rtmp_url() {