openvidu-components: Disabled screenshare if token is not received

pull/715/head
csantosm 2022-04-18 17:12:08 +02:00
parent 2deadbbe02
commit b29ecafea5
2 changed files with 11 additions and 7 deletions

View File

@ -238,16 +238,20 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni
*/ */
@Input() @Input()
set tokens(tokens: TokenModel) { set tokens(tokens: TokenModel) {
if (!tokens || (!tokens.webcam && !tokens.screen)) { if (!tokens || !tokens.webcam) {
//No tokens received
// throw new Error('No tokens received');
this.log.w('No tokens received'); this.log.w('No tokens received');
} else { } else {
if (tokens.webcam || tokens.screen) { this.log.w('Tokens received');
this.tokenService.setWebcamToken(tokens.webcam); this.tokenService.setWebcamToken(tokens.webcam);
if(tokens.screen) {
this.tokenService.setScreenToken(tokens.screen); this.tokenService.setScreenToken(tokens.screen);
this.canPublish = true; } else {
// Hide screenshare button if screen token does not exist
this.libService.screenshareButton.next(false);
this.log.w('No screen token found. Screenshare feature will be disabled');
} }
this.canPublish = true;
} }
} }

View File

@ -3,5 +3,5 @@
*/ */
export interface TokenModel { export interface TokenModel {
webcam: string; webcam: string;
screen: string; screen?: string;
} }