mirror of
https://github.com/ossrs/srs.git
synced 2025-02-14 20:31:56 +00:00
For #1202, Support auth_key param for srs player
This commit is contained in:
parent
728ddd133b
commit
a9b5d65ca7
2 changed files with 27 additions and 3 deletions
|
@ -44,6 +44,27 @@ function update_nav() {
|
|||
$("#nav_vlc").attr("href", "vlc.html" + window.location.search);
|
||||
}
|
||||
|
||||
// Special extra params, such as auth_key.
|
||||
function user_extra_params(query, params) {
|
||||
var queries = params || [];
|
||||
var server = (query.server == undefined)? window.location.hostname:query.server;
|
||||
var vhost = (query.vhost == undefined)? window.location.hostname:query.vhost;
|
||||
|
||||
for (var key in query.user_query) {
|
||||
if (key == 'app' || key == 'autostart' || key == 'dir'
|
||||
|| key == 'filename' || key == 'host' || key == 'hostname'
|
||||
|| key == 'http_port' || key == 'pathname' || key == 'port'
|
||||
|| key == 'server' || key == 'stream' || key == 'buffer'
|
||||
|| key == 'schema' || key == 'vhost'
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
queries.push(key + '=' + query[key]);
|
||||
}
|
||||
|
||||
return queries;
|
||||
}
|
||||
|
||||
/**
|
||||
@param server the ip of server. default to window.location.hostname
|
||||
@param vhost the vhost of rtmp. default to window.location.hostname
|
||||
|
@ -65,9 +86,7 @@ function build_default_rtmp_url() {
|
|||
if (server != vhost && vhost != "__defaultVhost__") {
|
||||
queries.push("vhost=" + vhost);
|
||||
}
|
||||
if (query.shp_identify) {
|
||||
queries.push("shp_identify=" + query.shp_identify);
|
||||
}
|
||||
queries = user_extra_params(query, queries);
|
||||
|
||||
var uri = schema + "://" + server + ":" + port + "/" + app + "/" + stream + "?" + queries.join('&');
|
||||
while (uri.indexOf("?") == uri.length - 1) {
|
||||
|
|
|
@ -643,6 +643,11 @@
|
|||
if (query.buffer) {
|
||||
url += "&buffer=" + query.buffer;
|
||||
}
|
||||
|
||||
var queries = user_extra_params(query);
|
||||
if (queries && queries.length) {
|
||||
url += '&' + queries.join('&');
|
||||
}
|
||||
$("#player_url").text($("#txt_url").val()).attr("href", url);
|
||||
|
||||
$("#link_server").text(rtmp.server);
|
||||
|
|
Loading…
Reference in a new issue