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>
|
||||
</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>
|
||||
<div id="role-div">
|
||||
<mat-radio-group name="Role" [(ngModel)]="participantRole">
|
||||
|
@ -57,10 +62,16 @@
|
|||
</mat-radio-group>
|
||||
</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-actions>
|
||||
<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>
|
||||
</div>
|
|
@ -14,6 +14,7 @@ export class SessionPropertiesDialogComponent {
|
|||
turnConf: string;
|
||||
manualTurnConf: RTCIceServer = {};
|
||||
participantRole: string;
|
||||
customToken: string;
|
||||
|
||||
mediaMode = MediaMode;
|
||||
recordingMode = RecordingMode;
|
||||
|
@ -25,6 +26,7 @@ export class SessionPropertiesDialogComponent {
|
|||
this.turnConf = data.turnConf;
|
||||
this.manualTurnConf = data.manualTurnConf;
|
||||
this.participantRole = data.participantRole;
|
||||
this.customToken = data.customToken;
|
||||
}
|
||||
|
||||
enumToArray(enumerator: any) {
|
||||
|
|
|
@ -116,6 +116,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
turnConf = 'auto';
|
||||
manualTurnConf: RTCIceServer = { urls: [] };
|
||||
participantRole: OpenViduRole = OpenViduRole.PUBLISHER;
|
||||
customToken: string;
|
||||
|
||||
events: OpenViduEvent[] = [];
|
||||
|
||||
|
@ -171,9 +172,13 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
this.leaveSession();
|
||||
}
|
||||
|
||||
this.getToken().then(token => {
|
||||
this.joinSessionShared(token);
|
||||
});
|
||||
if (!!this.customToken) {
|
||||
this.joinSessionShared(this.customToken);
|
||||
} else {
|
||||
this.getToken().then(token => {
|
||||
this.joinSessionShared(token);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private joinSessionShared(token): void {
|
||||
|
@ -494,7 +499,8 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
sessionProperties: this.sessionProperties,
|
||||
turnConf: this.turnConf,
|
||||
manualTurnConf: this.manualTurnConf,
|
||||
participantRole: this.participantRole
|
||||
participantRole: this.participantRole,
|
||||
customToken: this.customToken
|
||||
},
|
||||
width: '280px'
|
||||
});
|
||||
|
@ -508,6 +514,7 @@ export class OpenviduInstanceComponent implements OnInit, OnChanges, OnDestroy {
|
|||
this.turnConf = result.turnConf;
|
||||
this.manualTurnConf = result.manualTurnConf;
|
||||
this.participantRole = result.participantRole;
|
||||
this.customToken = result.customToken;
|
||||
}
|
||||
document.getElementById('session-settings-btn-' + this.index).classList.remove('cdk-program-focused');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue