Added basic option to specify alternative IA CDN servers within the settings panel.
This commit is contained in:
parent
08d2bf8bc9
commit
e9c474eaf0
6 changed files with 98 additions and 5 deletions
|
|
@ -192,6 +192,18 @@ class player{
|
|||
this.mediaHandler = new hlsDailymotionHandler(this.client, this, data.media);
|
||||
//Otherwise, if we have a raw-file compatible source
|
||||
}else if(data.media.type == 'ia' || data.media.type == 'raw' || data.media.type == 'yt' || data.media.type == 'dm'){
|
||||
//If we're running a source from IA
|
||||
if(data.media.type == 'ia'){
|
||||
//Replace specified CDN with generic URL, in-case of hard reload
|
||||
data.media.rawLink = data.media.rawLink.replace(/^https(.*)archive\.org(.*)items/g, "https://archive.org/download")
|
||||
|
||||
//If we have an IA source and a custom IA CDN Server set
|
||||
if(data.media.type == 'ia' && localStorage.getItem("IACDN") != ""){
|
||||
//Generate and set new link
|
||||
data.media.rawLink = data.media.rawLink.replace("https://archive.org/download", `https://${localStorage.getItem("IACDN")}.archive.org/0/items`);
|
||||
}
|
||||
}
|
||||
|
||||
//Create a new raw file handler for it
|
||||
this.mediaHandler = new rawFileHandler(client, this, data.media);
|
||||
//Sync to time stamp
|
||||
|
|
@ -244,6 +256,27 @@ class player{
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys and Re-Creates media handler
|
||||
*/
|
||||
hardReload(){
|
||||
if(this.mediaHandler != null){
|
||||
//Re-create data we'd get from server
|
||||
const data = {
|
||||
media: this.mediaHandler.nowPlaying,
|
||||
timestamp: this.mediaHandler.getTimestamp()
|
||||
}
|
||||
|
||||
//End current media handler
|
||||
this.end();
|
||||
|
||||
console.log(data);
|
||||
|
||||
//Restart from last media handlers
|
||||
this.start(data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles End-Media Commands from the Server
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue