Finished up with player UI-Bar functionality, including 'reload' and 'sync' controls.

This commit is contained in:
rainbow napkin 2025-01-17 06:02:39 -05:00
parent 6dc9ad7b34
commit f38eae170d
7 changed files with 222 additions and 50 deletions

View file

@ -39,10 +39,10 @@ module.exports = class{
const mediaObj = queuedMedia.fromMedia(inputMedia, new Date().getTime());
//Start playback
this.play(mediaObj);
this.start(mediaObj);
}
play(mediaObj){
start(mediaObj){
//Silently end the media
this.end(true);
@ -109,11 +109,11 @@ module.exports = class{
//If a socket is specified
if(socket != null){
//Send data out to specified socket
socket.emit("play", data);
socket.emit("start", data);
//Otherwise
}else{
//Send that shit out to the entire channel
this.server.io.in(this.channel.name).emit("play", data);
this.server.io.in(this.channel.name).emit("start", data);
}
}

View file

@ -45,7 +45,7 @@ module.exports = class{
//Pull media list
const mediaList = await this.yankMedia(data.url);
//Get active channel from server/socket
const chan = this.server.activeChannels.get(socket.chan)
const chan = this.server.activeChannels.get(socket.chan);
//Queue the first media object given
chan.queue.queueMedia(mediaList[0]);
}catch(err){
@ -54,11 +54,11 @@ module.exports = class{
}
async yankMedia(url){
const pullType = await this.getMediaType(url)
const pullType = await this.getMediaType(url);
if(pullType == 'ia'){
//Create empty list to hold media objects
const mediaList = []
const mediaList = [];
//Pull metadata from IA
const mediaInfo = await iaUtil.fetchMetadata(url);
@ -69,17 +69,17 @@ module.exports = class{
//pull filename from path
const name = path[path.length - 1];
//Construct link from pulled info
const link = `https://archive.org/download/${mediaInfo.metadata.identifier}/${file.name}`
const link = `https://archive.org/download/${mediaInfo.metadata.identifier}/${file.name}`;
//Create new media object from file info
mediaList.push(new media(name, name, link, 'ia', Number(file.length)));
}
//return media object list
return mediaList
return mediaList;
}else{
//return null to signify a bad url
return null
return null;
}
}
@ -87,7 +87,7 @@ module.exports = class{
//Check if we have a valid url
if(!validator.isURL(url)){
//If not toss the fucker out
return null
return null;
}
//If we have link to a resource from archive.org