diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/session/session.component.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/session/session.component.ts
index cc021bf6..d7882cb1 100644
--- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/session/session.component.ts
+++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/session/session.component.ts
@@ -39,6 +39,7 @@ import { PanelType } from '../../models/panel.model';
import { PanelService } from '../../services/panel/panel.service';
import { RecordingService } from '../../services/recording/recording.service';
import { TranslateService } from '../../services/translate/translate.service';
+import { OpenViduAngularConfigService } from '../../services/config/openvidu-angular.config.service';
/**
* @internal
@@ -80,6 +81,7 @@ export class SessionComponent implements OnInit {
protected loggerSrv: LoggerService,
protected chatService: ChatService,
protected tokenService: TokenService,
+ private libService: OpenViduAngularConfigService,
protected layoutService: LayoutService,
protected panelService: PanelService,
private recordingService: RecordingService,
@@ -121,6 +123,10 @@ export class SessionComponent implements OnInit {
async ngOnInit() {
if (!this.usedInPrejoinPage) {
+ if(!this.tokenService.getScreenToken()){
+ // Hide screenshare button if screen token does not exist
+ this.libService.screenshareButton.next(false);
+ }
this.session = this.openviduService.getWebcamSession();
this.sessionScreen = this.openviduService.getScreenSession();
this.subscribeToConnectionCreatedAndDestroyed();
diff --git a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/videoconference/videoconference.component.ts b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/videoconference/videoconference.component.ts
index 2fd7358a..9577c8cc 100644
--- a/openvidu-components-angular/projects/openvidu-angular/src/lib/components/videoconference/videoconference.component.ts
+++ b/openvidu-components-angular/projects/openvidu-angular/src/lib/components/videoconference/videoconference.component.ts
@@ -279,8 +279,6 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni
if (tokens.screen) {
this.tokenService.setScreenToken(tokens.screen);
} 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.tokensReceived = true;
diff --git a/openvidu-components-angular/src/app/openvidu-webcomponent/openvidu-webcomponent.component.ts b/openvidu-components-angular/src/app/openvidu-webcomponent/openvidu-webcomponent.component.ts
index 1bf6f2a2..34c0f9ff 100644
--- a/openvidu-components-angular/src/app/openvidu-webcomponent/openvidu-webcomponent.component.ts
+++ b/openvidu-components-angular/src/app/openvidu-webcomponent/openvidu-webcomponent.component.ts
@@ -514,7 +514,10 @@ export class OpenviduWebComponentComponent implements OnInit {
/**
* @example
*
- * *
+ *
+ * or
+ *
+ *
*/
@Input('tokens')
set tokens(value: TokenModel | string) {
@@ -523,8 +526,12 @@ export class OpenviduWebComponentComponent implements OnInit {
this._tokens = this.castToJson(value);
this.success = !!this._tokens?.webcam && !!this._tokens?.screen;
} catch (error) {
- this.log.e(error);
- if (!this.success) {
+ if (typeof value === 'string' && value !== '') {
+ this.log.d('Sigle token received.');
+ this._tokens = { webcam: value };
+ this.success = true;
+ } else {
+ this.log.e(error);
this.log.e('Parameters received are incorrect: ', value);
this.log.e('Session cannot start');
}
@@ -663,8 +670,7 @@ export class OpenviduWebComponentComponent implements OnInit {
try {
return JSON.parse(value);
} catch (error) {
- this.log.e('Unexpected JSON', error);
- throw 'Unexpected JSON';
+ throw 'Unexpected JSON' + error;
}
} else if (typeof value === 'object') {
return value;