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

View file

@ -38,7 +38,7 @@ const { exceptionHandler, errorHandler } = require('../../utils/loggerUtils');
/** /**
* "Enum" for emote type property * "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 * 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, optional: true,
errorMessage: "Invalid Stream Type", errorMessage: "Invalid Stream Type",
matches: { 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> <label for="channel-preference-list-stream-type-webrtc">Peer-to-Peer (WebRTC/STUN)</label>
</span> </span>
<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> <label for="channel-preference-list-stream-type-hls">Self-Hosted (HLS)</label>
</span> </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>
</span> </span>

View file

@ -412,7 +412,7 @@ class livestreamPreferences{
handleTypeUpdate(data){ handleTypeUpdate(data){
//If the stream type is HLS //If the stream type is HLS
if(data.streamType == "hls"){ if(data.streamType == "livehls"){
//Ensure the hls button is checked //Ensure the hls button is checked
this.hlsButton.checked = true; this.hlsButton.checked = true;
//Ensure the stream url input is enabled //Ensure the stream url input is enabled