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

Upgrade players. 3.0.161

This commit is contained in:
winlin 2021-04-28 15:17:10 +08:00
parent cf6fa98e36
commit 9d9d81ef17
29 changed files with 8325 additions and 1453 deletions

View file

@ -3,9 +3,9 @@
/**
* common utilities
* depends: jquery1.10
* https://code.csdn.net/snippets/147103
* https://gitee.com/winlinvip/codes/rpn0c2ewbomj81augzk4y59
* @see: http://blog.csdn.net/win_lin/article/details/17994347
* v 1.0.17
* v 1.0.23
*/
/**
@ -236,9 +236,9 @@ function parse_query_string(){
// parse the query string.
var query_string = String(window.location.search).replace(" ", "").split("?")[1];
if(query_string == undefined){
if(query_string === undefined){
query_string = String(window.location.hash).replace(" ", "").split("#")[1];
if(query_string == undefined){
if(query_string === undefined){
return obj;
}
}
@ -252,7 +252,7 @@ function __fill_query(query_string, obj) {
// pure user query object.
obj.user_query = {};
if (query_string.length == 0) {
if (query_string.length === 0) {
return;
}
@ -293,7 +293,9 @@ function __fill_query(query_string, obj) {
function parse_rtmp_url(rtmp_url) {
// @see: http://stackoverflow.com/questions/10469575/how-to-use-location-object-to-parse-url-without-redirecting-the-page-in-javascri
var a = document.createElement("a");
a.href = rtmp_url.replace("rtmp://", "http://");
a.href = rtmp_url.replace("rtmp://", "http://")
.replace("webrtc://", "http://")
.replace("rtc://", "http://");
var vhost = a.hostname;
var app = a.pathname.substr(1, a.pathname.lastIndexOf("/") - 1);
@ -315,7 +317,7 @@ function parse_rtmp_url(rtmp_url) {
// when vhost equals to server, and server is ip,
// the vhost is __defaultVhost__
if (a.hostname == vhost) {
if (a.hostname === vhost) {
var re = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;
if (re.test(a.hostname)) {
vhost = "__defaultVhost__";
@ -327,7 +329,17 @@ function parse_rtmp_url(rtmp_url) {
if (rtmp_url.indexOf("://") > 0) {
schema = rtmp_url.substr(0, rtmp_url.indexOf("://"));
}
var port = (a.port == "")? (schema=="http"?"80":"1935"):a.port;
var port = a.port;
if (!port) {
if (schema === 'http') {
port = 80;
} else if (schema === 'https') {
port = 443;
} else if (schema === 'rtmp') {
port = 1935;
}
}
var ret = {
url: rtmp_url,
@ -337,6 +349,20 @@ function parse_rtmp_url(rtmp_url) {
};
__fill_query(a.search, ret);
// For webrtc API, we use 443 if page is https, or schema specified it.
if (!ret.port) {
if (schema === 'webrtc' || schema === 'rtc') {
if (ret.user_query.schema === 'https') {
ret.port = 443;
} else if (window.location.href.indexOf('https://') === 0) {
ret.port = 443;
} else {
// For WebRTC, SRS use 1985 as default API port.
ret.port = 1985;
}
}
}
return ret;
}
@ -658,10 +684,3 @@ AsyncRefresh2.prototype.request = function(timeout) {
}, timeout);
}
// other components.
/**
* jquery/bootstrap pager.
* depends: jquery1.10, boostrap2
* https://code.csdn.net/snippets/146160
* @see: http://blog.csdn.net/win_lin/article/details/17628631
*/