Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options for retaining all HLS files after-stream end and configuring the HLS HTTP endpoint. #250

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
62 changes: 57 additions & 5 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 Expand Up @@ -1963,7 +2015,7 @@ <h4 class="card-title text-left" i18n="@@newLiveStreamCardTitle">
<div *ngIf=isEnterpriseEdition class="col-xs-12 " style="margin-top:12px">
<label>Time-based One-time Password(TOTP)*</label>

<div class="checkbox" style="margin-left: 1dvb;" >
<div class="checkbox" style="margin-left: 10px;" >
<input [(ngModel)]="appSettings.enableTimeTokenForPublish"
id="enableTimeTokenForPublish" (ngModelChange)="onEnableTimeTokenForPublishChange()" name="enableTimeTokenForPublish"
type="checkbox">
Expand Down Expand Up @@ -2058,7 +2110,7 @@ <h4 class="card-title text-left" i18n="@@newLiveStreamCardTitle">

<div *ngIf="isEnterpriseEdition" class="col-xs-12 " style="margin-top:12px">
<label>JWT Tokens*</label>
<div class="checkbox" style="margin-left: 12px;" >
<div class="checkbox" style="margin-left: 10px;" >
<input [(ngModel)]="appSettings.publishJwtControlEnabled"
(ngModelChange)="onPublishJwtControlEnabledChange()"
id="publishJwtControlEnabled" name="publishJwtControlEnabled"
Expand All @@ -2073,7 +2125,7 @@ <h4 class="card-title text-left" i18n="@@newLiveStreamCardTitle">
class="fa fa-info-circle"></i></a>
</label>
</div>
<div class="checkbox" style="margin-left: 12px;" >
<div class="checkbox" style="margin-left: 10px;" >
<input [(ngModel)]="appSettings.playJwtControlEnabled"
id="playJwtControlEnabled" name="playJwtControlEnabled"
(ngModelChange)="onPlayJwtControlEnabledChange()"
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