Skip to content

Commit

Permalink
add new options to app settings basic section: keep all hls files after
Browse files Browse the repository at this point in the history
stream is finished, hls http endpoint configuration
  • Loading branch information
lastpeony committed Mar 8, 2024
1 parent 4461e89 commit 85adc69
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/app/app.page/app.definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ export class AppSettings {
public hlsListSize: number,
public hlsTime: number,
public hlsPlayListType: string,
public hlsflags:string,
public hlsHttpEndpoint:string,
public addDateTimeToHlsFileName:boolean,
public deleteHLSFilesOnEnded: boolean,
public facebookClientId: string,
public facebookClientSecret: string,
Expand Down
56 changes: 54 additions & 2 deletions src/app/app.page/app.page.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -1383,17 +1383,69 @@ <h4 class="card-title text-left" i18n="@@newLiveStreamCardTitle">
<div class="checkbox">

<input [(ngModel)]="appSettings.deleteHLSFilesOnEnded"
(ngModelChange)="onDeleteHLSFilesOnEndedChange()"

id="deleteHLSFilesOnEnded" name="deleteHLSFilesOnEnded"
type="checkbox">

<label for="deleteHLSFilesOnEnded"
i18n="@@deleteHLSFilesOnEnded">
Delete HLS files after the stream is finished
Delete HLS Segment Files After The Stream Is Finished
<a
matTooltip="When enabled, deletes HLS segment files after the stream ends; otherwise, the server retains the specified segment list size number of files.">
<i
class="fa fa-info-circle"></i></a>
</label>

</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-12 col-md-12 text-left">
<div class="checkbox">

<input
[(ngModel)]="keepAllHlsFilesOnEnded"
(ngModelChange)="onKeepAllHlsFilesOnEndedChange()"
id="keepAllHlsFilesOnEnded" name="keepAllHlsFilesOnEnded"
type="checkbox">

<label for="keepAllHlsFilesOnEnded"
i18n="@@keepAllHlsFilesOnEnded">
Keep All HLS Files After Stream Is Finished
<a
matTooltip="When enabled, all generated HLS files (.m3u8 and .ts) are retained on the server after the stream ends.">
<i
class="fa fa-info-circle"></i></a>
</label>

</div>
</div>

</div>
<div class="form-group">
<div class="col-sm-12 col-md-12 text-left">
<label>
HLS HTTP Endpoint<a
matTooltip="If this URL is specified, the server will upload HLS files with date time added to file names to the provided HTTP endpoint using a PUT request. Server wont generate any HLS files locally thus HLS wont be watchable through ant media server."><i
class="fa fa-info-circle"></i></a>
</label>

<div>
<textarea name="hlsHttpEndpoint"
[(ngModel)]="appSettings.hlsHttpEndpoint"
(ngModelChange)="onHlsHttpEndpointChange()"
type="textarea" class="form-control"
placeholder="https://example.com/hls-stream"
rows="1">{{appSettings.hlsHttpEndpoint}}
</textarea>

</div>

</div>
</div>



</div>

Expand Down Expand Up @@ -1576,7 +1628,7 @@ <h4 class="card-title text-left" i18n="@@newLiveStreamCardTitle">
Use Object Detection <a
matTooltip="If you want to use this feature, you should first install necessary libraries by running install_tensorflow_plugin.sh script in the installation directory.
Also you should add Adaptive Streaming.
If you still have a problem, review FAQ page in docs.antmedia.io">
If you still have a problem, review FAQ page in antmedia.io/docs">
<i
class="fa fa-info-circle"></i></a>
</label>
Expand Down
49 changes: 49 additions & 0 deletions src/app/app.page/app.page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ export class AppPageComponent implements OnInit, OnDestroy, AfterViewInit {
public clusterNodes: ClusterNode[];
public user: User;
public currentClusterNode: string;
public keepAllHlsFilesOnEnded = false;


public appSettings: AppSettings; // = new AppSettings(false, true, true, 5, 2, "event", "no clientid", "no fb secret", "no youtube cid", "no youtube secre", "no pers cid", "no pers sec");
Expand Down Expand Up @@ -1309,6 +1310,18 @@ export class AppPageComponent implements OnInit, OnDestroy, AfterViewInit {
this.restService.getSettings(this.appName).subscribe(data => {
this.appSettings = <AppSettings>data;
this.settingsJson = JSON.stringify(data, null, 2); //JSON.stringify(data);

if(!this.appSettings.deleteHLSFilesOnEnded &&
this.appSettings.hlsPlayListType == "event" &&
this.appSettings.hlsflags.includes("append_list")

){
this.keepAllHlsFilesOnEnded = true;

}



if (this.appSettings.jwtControlEnabled) {
let jwt = require('jsonwebtoken');
let currentAppJWTToken = jwt.sign({ sub: "token" }, this.appSettings.jwtSecretKey);
Expand Down Expand Up @@ -2788,6 +2801,42 @@ export class AppPageComponent implements OnInit, OnDestroy, AfterViewInit {

}

setKeepAllHlsFilesOnEnded(enabled:boolean){
this.keepAllHlsFilesOnEnded = enabled;

if(enabled){
this.appSettings.deleteHLSFilesOnEnded = false;
this.appSettings.hlsPlayListType = "event"
this.appSettings.hlsflags="+append_list"
this.appSettings.hlsHttpEndpoint=""
this.appSettings.addDateTimeToHlsFileName = false

}else{
this.appSettings.hlsflags="+delete_segments"
this.appSettings.hlsPlayListType = ""
}
}

onKeepAllHlsFilesOnEndedChange(){
if(this.keepAllHlsFilesOnEnded){
this.setKeepAllHlsFilesOnEnded(true)
}else{
this.setKeepAllHlsFilesOnEnded(false)
}
}

onDeleteHLSFilesOnEndedChange(){
if(this.appSettings.deleteHLSFilesOnEnded){
this.setKeepAllHlsFilesOnEnded(false)
}
}

onHlsHttpEndpointChange(){
if(this.appSettings.hlsHttpEndpoint){
this.appSettings.addDateTimeToHlsFileName = true
this.setKeepAllHlsFilesOnEnded(false)
}
}

deleteSelectedStreams(): void {

Expand Down

0 comments on commit 85adc69

Please sign in to comment.