1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 03:41:55 +00:00

Support api_port to specify the WebRTC API port. v4.0.225

This commit is contained in:
winlin 2022-01-13 12:16:45 +08:00
parent db3ceb445b
commit c6c2e97189
3 changed files with 11 additions and 4 deletions

View file

@ -24,7 +24,7 @@ function update_nav() {
}
// Special extra params, such as auth_key.
function user_extra_params(query, params) {
function user_extra_params(query, params, rtc) {
var queries = params || [];
for (var key in query.user_query) {
@ -37,6 +37,10 @@ function user_extra_params(query, params) {
continue;
}
if (!rtc && key === 'api_port') {
continue;
}
if (query[key]) {
queries.push(key + '=' + query[key]);
}
@ -90,6 +94,8 @@ function build_default_flv_url() {
function build_default_rtc_url(query) {
// The format for query string to overwrite configs of server.
console.log('?eip=x.x.x.x to overwrite candidate. 覆盖服务器candidate(外网IP)配置');
console.log('?api_port=x to overwrite WebRTC API(1985).');
console.log('?schema=http|https to overwrite WebRTC API protocol.');
var server = (!query.server)? window.location.hostname:query.server;
var vhost = (!query.vhost)? window.location.hostname:query.vhost;
@ -104,7 +110,7 @@ function build_default_rtc_url(query) {
if (query.schema && window.location.protocol !== query.schema + ':') {
queries.push('schema=' + query.schema);
}
queries = user_extra_params(query, queries);
queries = user_extra_params(query, queries, true);
var uri = "webrtc://" + server + api + "/" + app + "/" + stream + "?" + queries.join('&');
while (uri.lastIndexOf("?") === uri.length - 1) {

View file

@ -210,8 +210,9 @@ function SrsRtcPublisherAsync() {
} else if (window.location.href.indexOf('https://') === 0) {
ret.port = 443;
} else {
// Allow use api_port to specify the WebRTC API port.
// For WebRTC, SRS use 1985 as default API port.
ret.port = 1985;
ret.port = ret.user_query.api_port || 1985;
}
}
}

View file

@ -9,6 +9,6 @@
#define VERSION_MAJOR 4
#define VERSION_MINOR 0
#define VERSION_REVISION 224
#define VERSION_REVISION 225
#endif