Updated streamType enum to change hls to livehls

This commit is contained in:
rainbow napkin 2026-07-09 23:15:47 -04:00
parent d49a644c47
commit 8f02be793f
5 changed files with 25 additions and 20 deletions

View file

@ -329,7 +329,10 @@ class queue{
*/
async goLive(socket, data){
try{
//Define and/or declare required variables
let title = "Livestream";
let filename;
let streamURL;
if(data != null && data.title != null){
//If the title is too long
@ -383,24 +386,26 @@ class queue{
//Kill schedule timers to prevent items from starting during the stream
await this.stopScheduleTimers();
//Syntatic sugar because I'm lazy :P
const streamURL = chanDB.settings.streamURL;
if(chanDB.settings.streamType == "livehls"){
//Syntatic sugar because I'm lazy :P
streamURL = chanDB.settings.streamURL;
if(streamURL == ''){
throw loggerUtils.exceptionSmith('This channel\'s HLS Livestream Source has not been set!', 'queue');
}
if(streamURL == ''){
throw loggerUtils.exceptionSmith('This channel\'s HLS Livestream Source has not been set!', 'queue');
}
//Pull filename from streamURL
let filename = streamURL.match(/^.+\..+\/(.+)$/);
//Pull filename from streamURL
filename = streamURL.match(/^.+\..+\/(.+)$/);
//If we're streaming from the root of the domain
if(filename == null){
//Set filename to root
filename = '/';
}else{
//Otherwise, hand over the filename
filename = filename[1];
//If we're streaming from the root of the domain
if(filename == null){
//Set filename to root
filename = '/';
}else{
//Otherwise, hand over the filename
filename = filename[1];
}
}
//Create queued media object from stream URL and set it to nowPlaying
@ -409,7 +414,7 @@ class queue{
filename,
streamURL,
streamURL,
"livehls",
chanDB.settings.streamType,
0,
streamURL,
new Date().getTime()

View file

@ -38,7 +38,7 @@ const { exceptionHandler, errorHandler } = require('../../utils/loggerUtils');
/**
* "Enum" for emote type property
*/
const streamMethodEnum = ["webrtc","hls"];
const streamMethodEnum = ["webrtc","livehls"];
/**
* DB Schema for Documents containing de-hydrated representations of Canopy Stream/Chat Channels

View file

@ -85,7 +85,7 @@ module.exports.settingsMap = function(){
optional: true,
errorMessage: "Invalid Stream Type",
matches: {
options: [/\b(?:webrtc|hls)\b/]
options: [/\b(?:webrtc|livehls)\b/]
}
}
})

View file

@ -42,10 +42,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. %>
<label for="channel-preference-list-stream-type-webrtc">Peer-to-Peer (WebRTC/STUN)</label>
</span>
<span>
<input type="radio" name="streamType" id="channel-preference-list-stream-type-hls" value="hls" <% if(channel.settings["streamType"] == "hls"){ %> checked <% }%> >
<input type="radio" name="streamType" id="channel-preference-list-stream-type-hls" value="livehls" <% if(channel.settings["streamType"] == "livehls"){ %> checked <% }%> >
<label for="channel-preference-list-stream-type-hls">Self-Hosted (HLS)</label>
</span>
<input <% if(channel.settings["streamType"] != "hls"){ %> disabled <%}%> id="channel-preference-list-stream-url" placeholder="Stream URL" value="<%= channel.settings["streamURL"] %>">
<input <% if(channel.settings["streamType"] != "livehls"){ %> disabled <%}%> id="channel-preference-list-stream-url" placeholder="Stream URL" value="<%= channel.settings["streamURL"] %>">
</span>
</span>