mirror of https://github.com/OpenVidu/openvidu.git
openvidu-testapp: allow setting a custom token
parent
17b5578d24
commit
56c7d3d1dc
|
@ -47,7 +47,12 @@
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</mat-dialog-content>
|
||||||
|
|
||||||
|
<mat-divider style="margin-bottom: 20px"></mat-divider>
|
||||||
|
|
||||||
|
<h2 mat-dialog-title>User configuration</h2>
|
||||||
|
<mat-dialog-content>
|
||||||
<label class="label">Role</label>
|
<label class="label">Role</label>
|
||||||
<div id="role-div">
|
<div id="role-div">
|
||||||
<mat-radio-group name="Role" [(ngModel)]="participantRole">
|
<mat-radio-group name="Role" [(ngModel)]="participantRole">
|
||||||
|
@ -57,10 +62,16 @@
|
||||||
</mat-radio-group>
|
</mat-radio-group>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<label class="label">Token</label>
|
||||||
|
<div id="custom-token-div">
|
||||||
|
<mat-form-field>
|
||||||
|
<input matInput placeholder="Custom token" [(ngModel)]="customToken">
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
</mat-dialog-content>
|
</mat-dialog-content>
|
||||||
|
|
||||||
<mat-dialog-actions>
|
<mat-dialog-actions>
|
||||||
<button mat-button [mat-dialog-close]="undefined">CANCEL</button>
|
<button mat-button [mat-dialog-close]="undefined">CANCEL</button>
|
||||||
<button mat-button [mat-dialog-close]="{sessionProperties: sessionProperties, turnConf: turnConf, manualTurnConf: manualTurnConf, participantRole: participantRole}">SAVE</button>
|
<button mat-button [mat-dialog-close]="{sessionProperties: sessionProperties, turnConf: turnConf, manualTurnConf: manualTurnConf, participantRole: participantRole, customToken: customToken}">SAVE</button>
|
||||||
</mat-dialog-actions>
|
</mat-dialog-actions>
|
||||||
</div>
|
</div>
|
|
@ -14,6 +14,7 @@ export class SessionPropertiesDialogComponent {
|
||||||
turnConf: string;
|
turnConf: string;
|
||||||
manualTurnConf: RTCIceServer = {};
|
manualTurnConf: RTCIceServer = {};
|
||||||
participantRole: string;
|
participantRole: string;
|
||||||
|
customToken: string;
|
||||||
|
|
||||||
mediaMode = MediaMode;
|
mediaMode = MediaMode;
|
||||||
recordingMode = RecordingMode;
|
recordingMode = RecordingMode;
|
||||||
|
@ -25,6 +26,7 @@ export class SessionPropertiesDialogComponent {
|
||||||
this.turnConf = data.turnConf;
|
this.turnConf = data.turnConf;
|
||||||
this.manualTurnConf = data.manualTurnConf;
|
this.manualTurnConf = data.manualTurnConf;
|
||||||
this.participantRole = data.participantRole;
|
this.participantRole = data.participantRole;
|
||||||
|
this.customToken = data.customToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
enumToArray(enumerator: any) {
|
enumToArray(enumerator: any) {
|
||||||
|
|
|
@ -116,6 +116,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
turnConf = 'auto';
|
turnConf = 'auto';
|
||||||
manualTurnConf: RTCIceServer = { urls: [] };
|
manualTurnConf: RTCIceServer = { urls: [] };
|
||||||
participantRole: OpenViduRole = OpenViduRole.PUBLISHER;
|
participantRole: OpenViduRole = OpenViduRole.PUBLISHER;
|
||||||
|
customToken: string;
|
||||||
|
|
||||||
events: OpenViduEvent[] = [];
|
events: OpenViduEvent[] = [];
|
||||||
|
|
||||||
|
@ -171,9 +172,13 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
this.leaveSession();
|
this.leaveSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getToken().then(token => {
|
if (!!this.customToken) {
|
||||||
this.joinSessionShared(token);
|
this.joinSessionShared(this.customToken);
|
||||||
});
|
} else {
|
||||||
|
this.getToken().then(token => {
|
||||||
|
this.joinSessionShared(token);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private joinSessionShared(token): void {
|
private joinSessionShared(token): void {
|
||||||
|
@ -494,7 +499,8 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
sessionProperties: this.sessionProperties,
|
sessionProperties: this.sessionProperties,
|
||||||
turnConf: this.turnConf,
|
turnConf: this.turnConf,
|
||||||
manualTurnConf: this.manualTurnConf,
|
manualTurnConf: this.manualTurnConf,
|
||||||
participantRole: this.participantRole
|
participantRole: this.participantRole,
|
||||||
|
customToken: this.customToken
|
||||||
},
|
},
|
||||||
width: '280px'
|
width: '280px'
|
||||||
});
|
});
|
||||||
|
@ -508,6 +514,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
||||||
this.turnConf = result.turnConf;
|
this.turnConf = result.turnConf;
|
||||||
this.manualTurnConf = result.manualTurnConf;
|
this.manualTurnConf = result.manualTurnConf;
|
||||||
this.participantRole = result.participantRole;
|
this.participantRole = result.participantRole;
|
||||||
|
this.customToken = result.customToken;
|
||||||
}
|
}
|
||||||
document.getElementById('session-settings-btn-' + this.index).classList.remove('cdk-program-focused');
|
document.getElementById('session-settings-btn-' + this.index).classList.remove('cdk-program-focused');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue