Added random subdomains to video sources in order to work around limitations on open connections per server.
This commit is contained in:
parent
1a84b68b62
commit
353b4af391
25
player.js
25
player.js
@ -182,6 +182,15 @@ function delCookie(name) {
|
||||
document.cookie = cookie
|
||||
}
|
||||
|
||||
function randString(length) {
|
||||
var pool = 'abcdefghijklmnopqrstuvwxyz1234567890'
|
||||
var out = ''
|
||||
for(var i=0; i<length; i++) {
|
||||
out += pool.charAt(Math.floor(Math.random() * pool.length))
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
function swapText(element) {
|
||||
var oldtext = element.title
|
||||
element.title = element.dataset['title_alt']
|
||||
@ -200,7 +209,13 @@ function loadStreams(presentation, mainstream, defaultres) {
|
||||
mainstream.src = main.video +"?token="+ token
|
||||
} else {
|
||||
Object.keys(main.video).forEach(function(res) {
|
||||
var tokenized = main.video[res] +"?token="+ token
|
||||
var mainsrc = main.video[res]
|
||||
if(mainsrc.startsWith('https://')) {
|
||||
var prefix = randString(5)
|
||||
mainsrc = mainsrc.replace(/^(https:\/\/)(.*)/,
|
||||
`$1${prefix}.$2`)
|
||||
}
|
||||
var tokenized = mainsrc +"?token="+ token
|
||||
mainstream.dataset[res] = tokenized
|
||||
})
|
||||
mainstream.src = mainstream.dataset[defaultres]
|
||||
@ -215,7 +230,13 @@ function loadStreams(presentation, mainstream, defaultres) {
|
||||
video.src = streamlist[i].video +"?token="+ token
|
||||
} else {
|
||||
Object.keys(streamlist[i].video).forEach(function(res) {
|
||||
var tokenized = streamlist[i].video[res] +"?token="+ token
|
||||
var streamsrc = streamlist[i].video[res]
|
||||
if(streamsrc.startsWith('https://')) {
|
||||
var prefix = randString(5)
|
||||
streamsrc = streamsrc.replace(/^(https:\/\/)(.*)/,
|
||||
`$1${prefix}.$2`)
|
||||
}
|
||||
var tokenized = streamsrc +"?token="+ token
|
||||
video.dataset[res] = tokenized
|
||||
})
|
||||
video.src = video.dataset[defaultres]
|
||||
|
Loading…
x
Reference in New Issue
Block a user