mirror of https://github.com/OpenVidu/openvidu.git
openvidu-components: Fixed connection bug when prejoin is disabled
parent
bb16418385
commit
ad9e4db4e8
|
@ -1,4 +1,14 @@
|
|||
import { ChangeDetectionStrategy, Component, ContentChild, EventEmitter, HostListener, Input, OnInit, Output, TemplateRef, ViewChild } from '@angular/core';
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
ContentChild,
|
||||
EventEmitter,
|
||||
HostListener,
|
||||
OnInit,
|
||||
Output,
|
||||
TemplateRef,
|
||||
ViewChild
|
||||
} from '@angular/core';
|
||||
import { Subscriber, Session, StreamEvent, StreamPropertyChangedEvent, SessionDisconnectedEvent, ConnectionEvent } from 'openvidu-browser';
|
||||
|
||||
import { VideoType } from '../../models/video-type.model';
|
||||
|
@ -29,7 +39,6 @@ export class SessionComponent implements OnInit {
|
|||
@ContentChild('panel', { read: TemplateRef }) panelTemplate: TemplateRef<any>;
|
||||
@ContentChild('layout', { read: TemplateRef }) layoutTemplate: TemplateRef<any>;
|
||||
|
||||
@Input() tokens: { webcam: string; screen: string };
|
||||
@Output() _session = new EventEmitter<any>();
|
||||
@Output() _publisher = new EventEmitter<any>();
|
||||
@Output() _error = new EventEmitter<any>();
|
||||
|
@ -59,7 +68,7 @@ export class SessionComponent implements OnInit {
|
|||
protected chatService: ChatService,
|
||||
protected tokenService: TokenService,
|
||||
protected layoutService: LayoutService,
|
||||
protected menuService: SidenavMenuService,
|
||||
protected menuService: SidenavMenuService
|
||||
) {
|
||||
this.log = this.loggerSrv.get('SessionComponent');
|
||||
}
|
||||
|
@ -85,7 +94,6 @@ export class SessionComponent implements OnInit {
|
|||
}
|
||||
|
||||
async ngOnInit() {
|
||||
|
||||
this.session = this.openviduService.getWebcamSession();
|
||||
this.sessionScreen = this.openviduService.getScreenSession();
|
||||
this.subscribeToConnectionCreatedAndDestroyed();
|
||||
|
@ -96,9 +104,6 @@ export class SessionComponent implements OnInit {
|
|||
this.chatService.subscribeToChat();
|
||||
this.subscribeToReconnection();
|
||||
|
||||
this.tokenService.setWebcamToken(this.tokens.webcam);
|
||||
this.tokenService.setScreenToken(this.tokens.screen);
|
||||
|
||||
await this.connectToSession();
|
||||
// Workaround, firefox does not have audio when publisher join with muted camera
|
||||
// if (this.platformService.isFirefox() && !this.localUserService.hasCameraVideoActive()) {
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
<span>{{ errorMessage }}</span>
|
||||
</div>
|
||||
|
||||
<div id="session-container" *ngIf="(joinSessionClicked || !showPrejoin) && participantReady && !error">
|
||||
<ov-session [tokens]="_tokens">
|
||||
<div id="session-container" *ngIf="(joinSessionClicked || !showPrejoin) && participantReady && canPublish && !error">
|
||||
<ov-session>
|
||||
<ng-template #toolbar>
|
||||
<ng-container *ngIf="openviduAngularToolbarTemplate">
|
||||
<ng-container *ngTemplateOutlet="openviduAngularToolbarTemplate"></ng-container>
|
||||
|
|
|
@ -32,6 +32,7 @@ import { LoggerService } from '../../services/logger/logger.service';
|
|||
import { OpenViduService } from '../../services/openvidu/openvidu.service';
|
||||
import { ParticipantService } from '../../services/participant/participant.service';
|
||||
import { StorageService } from '../../services/storage/storage.service';
|
||||
import { TokenService } from '../../services/token/token.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ov-videoconference',
|
||||
|
@ -84,10 +85,9 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni
|
|||
this.log.w('No tokens received');
|
||||
} else {
|
||||
if (tokens.webcam || tokens.screen) {
|
||||
this._tokens = {
|
||||
webcam: tokens.webcam,
|
||||
screen: tokens.screen
|
||||
};
|
||||
this.tokenService.setWebcamToken(tokens.webcam);
|
||||
this.tokenService.setScreenToken(tokens.screen);
|
||||
this.canPublish = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni
|
|||
|
||||
joinSessionClicked: boolean = false;
|
||||
participantReady: boolean = false;
|
||||
_tokens: { webcam: string; screen: string };
|
||||
canPublish: boolean = false;
|
||||
error: boolean = false;
|
||||
errorMessage: string = '';
|
||||
showPrejoin: boolean = true;
|
||||
|
@ -130,7 +130,8 @@ export class VideoconferenceComponent implements OnInit, OnDestroy, AfterViewIni
|
|||
private deviceSrv: DeviceService,
|
||||
private openviduService: OpenViduService,
|
||||
private actionService: ActionService,
|
||||
private libService: OpenViduAngularConfigService
|
||||
private libService: OpenViduAngularConfigService,
|
||||
private tokenService: TokenService,
|
||||
) {
|
||||
this.log = this.loggerSrv.get('VideoconferenceComponent');
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { ILogger } from '../../models/logger.model';
|
||||
import { LoggerService } from '../logger/logger.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
@ -8,19 +6,14 @@ import { LoggerService } from '../logger/logger.service';
|
|||
export class TokenService {
|
||||
private webcamToken = '';
|
||||
private screenToken = '';
|
||||
private sessionId = '';
|
||||
private log: ILogger;
|
||||
|
||||
constructor(private loggerSrv: LoggerService) {
|
||||
this.log = this.loggerSrv.get('TokenService');
|
||||
}
|
||||
constructor() {}
|
||||
|
||||
|
||||
setWebcamToken(token: string){
|
||||
setWebcamToken(token: string) {
|
||||
this.webcamToken = token;
|
||||
}
|
||||
|
||||
setScreenToken(token: string){
|
||||
setScreenToken(token: string) {
|
||||
this.screenToken = token;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue