Added basic option to specify alternative IA CDN servers within the settings panel.

This commit is contained in:
rainbow napkin 2025-09-06 09:08:07 -04:00
parent 08d2bf8bc9
commit e9c474eaf0
6 changed files with 98 additions and 5 deletions

View file

@ -166,6 +166,9 @@ class channel{
* @param {*} value - Value to set setting to
*/
processConfig(key, value){
//Unfortunately we can't scope constants to switch-cases so this is the best we got if we wanna re-use the name
let nowPlaying;
//Switch/case by config key
switch(key){
case 'ytPlayerType':
@ -205,18 +208,35 @@ class channel{
return;
}
//Get current video
const nowPlaying = this.player.mediaHandler.nowPlaying;
nowPlaying = this.player.mediaHandler.nowPlaying;
//If we're playing a youtube video
if(nowPlaying != null && nowPlaying.type == 'yt'){
//Restart the video
this.player.start({media: nowPlaying});
this.player.hardReload();
}
//Stop while we're ahead
return;
case 'IACDN':
//If the player or mediaHandler isn't loaded
if(this.player == null || this.player.mediaHandler == null){
//We're fuggin done here
return;
}
//Get current video
nowPlaying = this.player.mediaHandler.nowPlaying;
//If we're playing a video from Internet Archive
if(nowPlaying != null && nowPlaying.type == 'ia'){
//Hard reload the media, forcing media handler re-creation
this.player.hardReload();
}
return;
}
}
@ -224,7 +244,8 @@ class channel{
* Default channel config
*/
static defaultConfig = new Map([
["ytPlayerType","raw"]
["ytPlayerType","raw"],
["IACDN",""]
]);
}