Skip to content

Commit

Permalink
allow onvif url ip adress to be edited through edit broadcast dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
lastpeony committed Mar 27, 2023
1 parent 970118b commit f8850ac
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/app/app.page/dialog/broadcast.edit.dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class BroadcastEditComponent {
public genericRTMPEndpointCount = 0;
public endpoint:Endpoint;
public streamUrlDialogValid = true;
public onvifPort:string;

constructor(
public dialogRef: MatDialogRef<BroadcastEditComponent>, public restService: RestService,
Expand Down Expand Up @@ -62,12 +63,22 @@ export class BroadcastEditComponent {
}
});

}
this.onvifPort = data.url.slice(data.url.lastIndexOf(':')+1)
}

onNoClick(): void {
this.dialogRef.close();
}

getIpFromStreamUrl(streamUrl):string{
var extractIpv4Regex = "((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])"
var extractedIpv4 = streamUrl.match(extractIpv4Regex)[0];
if(extractedIpv4 != undefined){
return extractedIpv4+":"+this.onvifPort
}
return ""
}

updateLiveStream(isValid: boolean): void {
if (!isValid) {
return;
Expand All @@ -81,14 +92,13 @@ export class BroadcastEditComponent {
this.liveStreamEditing.dashViewerLimit = this.dialogRef.componentInstance.data.dashViewerLimit;
this.liveStreamEditing.type = this.dialogRef.componentInstance.data.type;


if(this.liveStreamEditing.type == "streamSource") {
this.liveStreamEditing.ipAddr = this.dialogRef.componentInstance.data.url;
this.liveStreamEditing.status = this.dialogRef.componentInstance.data.status;
this.liveStreamEditing.streamUrl = this.dialogRef.componentInstance.data.streamUrl;
}
else if(this.liveStreamEditing.type == "ipCamera") {
this.liveStreamEditing.ipAddr = this.dialogRef.componentInstance.data.url;
this.liveStreamEditing.ipAddr = this.getIpFromStreamUrl(this.dialogRef.componentInstance.data.streamUrl);
this.liveStreamEditing.username = this.dialogRef.componentInstance.data.username;
this.liveStreamEditing.password = this.dialogRef.componentInstance.data.pass;
this.liveStreamEditing.status = this.dialogRef.componentInstance.data.status;
Expand All @@ -112,14 +122,15 @@ export class BroadcastEditComponent {
this.streamUrlDialogValid = false;
}
}
console.log(this.liveStreamEditing)


this.liveStreamUpdating = true;

this.restService.updateLiveStream(this.dialogRef.componentInstance.data.appName, this.liveStreamEditing,
socialNetworks).subscribe(data => {
this.liveStreamUpdating = false;

console.log(data)
if (data["success"]) {

if (this.genericRTMPEndpointCount != 0) {
Expand Down

0 comments on commit f8850ac

Please sign in to comment.