mirror of https://github.com/OpenVidu/openvidu.git
openvidu-components: Renamed webrtc service to openvidu service
parent
5a3430fab5
commit
8f4ff06723
|
@ -6,7 +6,7 @@ import { ILogger } from '../../models/logger.model';
|
|||
|
||||
import { ChatService } from '../../services/chat/chat.service';
|
||||
import { LoggerService } from '../../services/logger/logger.service';
|
||||
import { WebrtcService } from '../../services/webrtc/webrtc.service';
|
||||
import { OpenViduService } from '../../services/openvidu/openvidu.service';
|
||||
import { TokenService } from '../../services/token/token.service';
|
||||
import { ActionService } from '../../services/action/action.service';
|
||||
import { Signal } from '../../models/signal.model';
|
||||
|
@ -50,7 +50,7 @@ export class SessionComponent implements OnInit, AfterViewInit {
|
|||
|
||||
constructor(
|
||||
protected actionService: ActionService,
|
||||
protected webrtcService: WebrtcService,
|
||||
protected openviduService: OpenViduService,
|
||||
protected participantService: ParticipantService,
|
||||
protected loggerSrv: LoggerService,
|
||||
protected chatService: ChatService,
|
||||
|
@ -83,12 +83,12 @@ export class SessionComponent implements OnInit, AfterViewInit {
|
|||
|
||||
async ngOnInit() {
|
||||
|
||||
if (this.webrtcService.getWebcamSession() === null) {
|
||||
this.webrtcService.initialize();
|
||||
await this.webrtcService.initDefaultPublisher(undefined);
|
||||
if (this.openviduService.getWebcamSession() === null) {
|
||||
this.openviduService.initialize();
|
||||
await this.openviduService.initDefaultPublisher(undefined);
|
||||
}
|
||||
this.session = this.webrtcService.getWebcamSession();
|
||||
this.sessionScreen = this.webrtcService.getScreenSession();
|
||||
this.session = this.openviduService.getWebcamSession();
|
||||
this.sessionScreen = this.openviduService.getScreenSession();
|
||||
this.subscribeToConnectionCreatedAndDestroyed();
|
||||
this.subscribeToStreamCreated();
|
||||
this.subscribeToStreamDestroyed();
|
||||
|
@ -103,8 +103,8 @@ export class SessionComponent implements OnInit, AfterViewInit {
|
|||
await this.connectToSession();
|
||||
// Workaround, firefox does not have audio when publisher join with muted camera
|
||||
// if (this.platformService.isFirefox() && !this.localUserService.hasCameraVideoActive()) {
|
||||
// this.webrtcService.publishVideo(this.localUserService.getMyCameraPublisher(), true);
|
||||
// this.webrtcService.publishVideo(this.localUserService.getMyCameraPublisher(), false);
|
||||
// this.openviduService.publishVideo(this.localUserService.getMyCameraPublisher(), true);
|
||||
// this.openviduService.publishVideo(this.localUserService.getMyCameraPublisher(), false);
|
||||
// }
|
||||
|
||||
this._session.emit(this.session);
|
||||
|
@ -132,7 +132,7 @@ export class SessionComponent implements OnInit, AfterViewInit {
|
|||
|
||||
leaveSession() {
|
||||
this.log.d('Leaving session...');
|
||||
this.webrtcService.disconnect();
|
||||
this.openviduService.disconnect();
|
||||
}
|
||||
|
||||
protected subscribeToTogglingMenu() {
|
||||
|
@ -169,16 +169,16 @@ export class SessionComponent implements OnInit, AfterViewInit {
|
|||
private async connectToSession(): Promise<void> {
|
||||
try {
|
||||
if (this.participantService.areBothEnabled()) {
|
||||
await this.webrtcService.connectSession(this.webrtcService.getWebcamSession(), this.tokenService.getWebcamToken());
|
||||
await this.webrtcService.connectSession(this.webrtcService.getScreenSession(), this.tokenService.getScreenToken());
|
||||
await this.webrtcService.publish(this.participantService.getMyCameraPublisher());
|
||||
await this.webrtcService.publish(this.participantService.getMyScreenPublisher());
|
||||
await this.openviduService.connectSession(this.openviduService.getWebcamSession(), this.tokenService.getWebcamToken());
|
||||
await this.openviduService.connectSession(this.openviduService.getScreenSession(), this.tokenService.getScreenToken());
|
||||
await this.openviduService.publish(this.participantService.getMyCameraPublisher());
|
||||
await this.openviduService.publish(this.participantService.getMyScreenPublisher());
|
||||
} else if (this.participantService.isOnlyMyScreenEnabled()) {
|
||||
await this.webrtcService.connectSession(this.webrtcService.getScreenSession(), this.tokenService.getScreenToken());
|
||||
await this.webrtcService.publish(this.participantService.getMyScreenPublisher());
|
||||
await this.openviduService.connectSession(this.openviduService.getScreenSession(), this.tokenService.getScreenToken());
|
||||
await this.openviduService.publish(this.participantService.getMyScreenPublisher());
|
||||
} else {
|
||||
await this.webrtcService.connectSession(this.webrtcService.getWebcamSession(), this.tokenService.getWebcamToken());
|
||||
await this.webrtcService.publish(this.participantService.getMyCameraPublisher());
|
||||
await this.openviduService.connectSession(this.openviduService.getWebcamSession(), this.tokenService.getWebcamToken());
|
||||
await this.openviduService.publish(this.participantService.getMyCameraPublisher());
|
||||
}
|
||||
} catch (error) {
|
||||
this._error.emit({ error: error.error, messgae: error.message, code: error.code, status: error.status });
|
||||
|
@ -191,7 +191,7 @@ export class SessionComponent implements OnInit, AfterViewInit {
|
|||
this.session.on('connectionCreated', (event: ConnectionEvent) => {
|
||||
const connectionId = event.connection?.connectionId;
|
||||
const nickname: string = this.participantService.getNicknameFromConnectionData(event.connection.data);
|
||||
const isRemoteConnection: boolean = !this.webrtcService.isMyOwnConnection(connectionId);
|
||||
const isRemoteConnection: boolean = !this.openviduService.isMyOwnConnection(connectionId);
|
||||
const isCameraConnection: boolean = !nickname?.includes(`_${VideoType.SCREEN}`);
|
||||
const data = event.connection?.data;
|
||||
|
||||
|
@ -200,16 +200,16 @@ export class SessionComponent implements OnInit, AfterViewInit {
|
|||
this.participantService.addRemoteConnection(connectionId, data, null);
|
||||
|
||||
//Sending nicnkanme signal to new participants
|
||||
if (this.webrtcService.needSendNicknameSignal()) {
|
||||
if (this.openviduService.needSendNicknameSignal()) {
|
||||
const data = { clientData: this.participantService.getWebcamNickname() };
|
||||
this.webrtcService.sendSignal(Signal.NICKNAME_CHANGED, [event.connection], data);
|
||||
this.openviduService.sendSignal(Signal.NICKNAME_CHANGED, [event.connection], data);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.session.on('connectionDestroyed', (event: ConnectionEvent) => {
|
||||
const nickname: string = this.participantService.getNicknameFromConnectionData(event.connection.data);
|
||||
const isRemoteConnection: boolean = !this.webrtcService.isMyOwnConnection(event.connection.connectionId);
|
||||
const isRemoteConnection: boolean = !this.openviduService.isMyOwnConnection(event.connection.connectionId);
|
||||
const isCameraConnection: boolean = !nickname?.includes(`_${VideoType.SCREEN}`);
|
||||
// Deleting participant when connection is destroyed
|
||||
if (isRemoteConnection && isCameraConnection) {
|
||||
|
@ -223,7 +223,7 @@ export class SessionComponent implements OnInit, AfterViewInit {
|
|||
const connectionId = event.stream?.connection?.connectionId;
|
||||
const data = event.stream?.connection?.data;
|
||||
|
||||
const isRemoteConnection: boolean = !this.webrtcService.isMyOwnConnection(connectionId);
|
||||
const isRemoteConnection: boolean = !this.openviduService.isMyOwnConnection(connectionId);
|
||||
if (isRemoteConnection) {
|
||||
const subscriber: Subscriber = this.session.subscribe(event.stream, undefined);
|
||||
this.participantService.addRemoteConnection(connectionId, data, subscriber);
|
||||
|
@ -243,7 +243,7 @@ export class SessionComponent implements OnInit, AfterViewInit {
|
|||
private subscribeToStreamPropertyChange() {
|
||||
// this.session.on('streamPropertyChanged', (event: StreamPropertyChangedEvent) => {
|
||||
// const connectionId = event.stream.connection.connectionId;
|
||||
// const isRemoteConnection: boolean = !this.webrtcService.isMyOwnConnection(connectionId);
|
||||
// const isRemoteConnection: boolean = !this.openviduService.isMyOwnConnection(connectionId);
|
||||
// if (isRemoteConnection) {
|
||||
// if (event.changedProperty === 'videoActive') {
|
||||
// // this.participantService.updateUsers();
|
||||
|
@ -255,7 +255,7 @@ export class SessionComponent implements OnInit, AfterViewInit {
|
|||
private subscribeToNicknameChanged() {
|
||||
this.session.on(`signal:${Signal.NICKNAME_CHANGED}`, (event: any) => {
|
||||
const connectionId = event.from.connectionId;
|
||||
const isRemoteConnection: boolean = !this.webrtcService.isMyOwnConnection(connectionId);
|
||||
const isRemoteConnection: boolean = !this.openviduService.isMyOwnConnection(connectionId);
|
||||
|
||||
if (isRemoteConnection) {
|
||||
const nickname = this.participantService.getNicknameFromConnectionData(event.data);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, ContentChild, ElementRef, HostListener, Input, OnInit, TemplateRef, ViewChild } from '@angular/core';
|
||||
import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormControl, Validators } from '@angular/forms';
|
||||
import { MatMenuPanel, MatMenuTrigger } from '@angular/material/menu';
|
||||
import { NicknameMatcher } from '../../matchers/nickname.matcher';
|
||||
|
@ -7,7 +7,7 @@ import { ScreenType, VideoType } from '../../models/video-type.model';
|
|||
import { Storage } from '../../models/storage.model';
|
||||
import { DocumentService } from '../../services/document/document.service';
|
||||
import { CdkOverlayService } from '../../services/cdk-overlay/cdk-overlay.service';
|
||||
import { WebrtcService } from '../../services/webrtc/webrtc.service';
|
||||
import { OpenViduService } from '../../services/openvidu/openvidu.service';
|
||||
import { LayoutService } from '../../services/layout/layout.service';
|
||||
import { StorageService } from '../../services/storage/storage.service';
|
||||
import { Signal } from '../../models/signal.model';
|
||||
|
@ -36,7 +36,7 @@ export class StreamComponent implements OnInit {
|
|||
|
||||
constructor(
|
||||
protected documentService: DocumentService,
|
||||
protected openViduWebRTCService: WebrtcService,
|
||||
protected openviduService: OpenViduService,
|
||||
protected layoutService: LayoutService,
|
||||
protected participantService: ParticipantService,
|
||||
protected storageService: StorageService,
|
||||
|
@ -96,7 +96,7 @@ export class StreamComponent implements OnInit {
|
|||
this.documentService.toggleBigElementClass(element);
|
||||
|
||||
if (!!this._stream.streamManager?.stream?.connection?.connectionId) {
|
||||
if (this.openViduWebRTCService.isMyOwnConnection(this._stream.streamManager?.stream?.connection?.connectionId)) {
|
||||
if (this.openviduService.isMyOwnConnection(this._stream.streamManager?.stream?.connection?.connectionId)) {
|
||||
this.participantService.toggleMyVideoEnlarged(this._stream.streamManager?.stream?.connection?.connectionId);
|
||||
} else {
|
||||
this.participantService.toggleRemoteVideoEnlarged(this._stream.streamManager?.stream?.connection?.connectionId);
|
||||
|
@ -129,7 +129,7 @@ export class StreamComponent implements OnInit {
|
|||
const nickname = this.nicknameFormControl.value;
|
||||
this.participantService.setNickname(this._stream.connectionId, nickname);
|
||||
this.storageService.set(Storage.USER_NICKNAME, nickname);
|
||||
this.openViduWebRTCService.sendSignal(Signal.NICKNAME_CHANGED, undefined, { clientData: nickname });
|
||||
this.openviduService.sendSignal(Signal.NICKNAME_CHANGED, undefined, { clientData: nickname });
|
||||
this.toggleNicknameForm();
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ export class StreamComponent implements OnInit {
|
|||
publishAudio: !this.participantService.isMyCameraEnabled(),
|
||||
mirror: false
|
||||
};
|
||||
await this.openViduWebRTCService.replaceTrack(this.participantService.getMyScreenPublisher(), properties);
|
||||
await this.openviduService.replaceTrack(this.participantService.getMyScreenPublisher(), properties);
|
||||
}
|
||||
|
||||
protected checkVideoEnlarged() {
|
||||
|
|
|
@ -5,7 +5,7 @@ import { ChatService } from '../../services/chat/chat.service';
|
|||
import { SidenavMenuService } from '../../services/sidenav-menu/sidenav-menu.service';
|
||||
import { DocumentService } from '../../services/document/document.service';
|
||||
|
||||
import { WebrtcService } from '../../services/webrtc/webrtc.service';
|
||||
import { OpenViduService } from '../../services/openvidu/openvidu.service';
|
||||
import { LoggerService } from '../../services/logger/logger.service';
|
||||
import { ILogger } from '../../models/logger.model';
|
||||
import { ScreenType } from '../../models/video-type.model';
|
||||
|
@ -59,7 +59,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
|||
protected menuService: SidenavMenuService,
|
||||
protected tokenService: TokenService,
|
||||
protected participantService: ParticipantService,
|
||||
protected webrtcService: WebrtcService,
|
||||
protected openviduService: OpenViduService,
|
||||
protected oVDevicesService: DeviceService,
|
||||
protected actionService: ActionService,
|
||||
protected loggerSrv: LoggerService
|
||||
|
@ -98,7 +98,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
|||
await this.oVDevicesService.initializeDevices();
|
||||
this.hasVideoDevices = this.oVDevicesService.hasVideoDeviceAvailable();
|
||||
this.hasAudioDevices = this.oVDevicesService.hasAudioDeviceAvailable();
|
||||
this.session = this.webrtcService.getWebcamSession();
|
||||
this.session = this.openviduService.getWebcamSession();
|
||||
|
||||
this.subscribeToUserMediaProperties();
|
||||
this.subscribeToReconnection();
|
||||
|
@ -110,13 +110,13 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
|||
this.onMicClicked.emit();
|
||||
|
||||
if (this.participantService.isMyCameraEnabled()) {
|
||||
this.webrtcService.publishAudio(
|
||||
this.openviduService.publishAudio(
|
||||
this.participantService.getMyCameraPublisher(),
|
||||
!this.participantService.hasCameraAudioActive()
|
||||
);
|
||||
return;
|
||||
}
|
||||
this.webrtcService.publishAudio(this.participantService.getMyScreenPublisher(), !this.participantService.hasScreenAudioActive());
|
||||
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), !this.participantService.hasScreenAudioActive());
|
||||
}
|
||||
|
||||
async toggleCamera() {
|
||||
|
@ -127,26 +127,26 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
|||
const publishAudio = this.participantService.hasCameraAudioActive();
|
||||
// Disabling webcam
|
||||
if (this.participantService.areBothEnabled()) {
|
||||
this.webrtcService.publishVideo(this.participantService.getMyCameraPublisher(), publishVideo);
|
||||
this.openviduService.publishVideo(this.participantService.getMyCameraPublisher(), publishVideo);
|
||||
this.participantService.disableWebcamUser();
|
||||
this.webrtcService.unpublish(this.participantService.getMyCameraPublisher());
|
||||
this.webrtcService.publishAudio(this.participantService.getMyScreenPublisher(), publishAudio);
|
||||
this.openviduService.unpublish(this.participantService.getMyCameraPublisher());
|
||||
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), publishAudio);
|
||||
return;
|
||||
}
|
||||
// Enabling webcam
|
||||
if (this.participantService.isOnlyMyScreenEnabled()) {
|
||||
const hasAudio = this.participantService.hasScreenAudioActive();
|
||||
|
||||
if (!this.webrtcService.isWebcamSessionConnected()) {
|
||||
await this.webrtcService.connectSession(this.webrtcService.getWebcamSession(), this.tokenService.getWebcamToken());
|
||||
if (!this.openviduService.isWebcamSessionConnected()) {
|
||||
await this.openviduService.connectSession(this.openviduService.getWebcamSession(), this.tokenService.getWebcamToken());
|
||||
}
|
||||
await this.webrtcService.publish(this.participantService.getMyCameraPublisher());
|
||||
this.webrtcService.publishAudio(this.participantService.getMyScreenPublisher(), false);
|
||||
this.webrtcService.publishAudio(this.participantService.getMyCameraPublisher(), hasAudio);
|
||||
await this.openviduService.publish(this.participantService.getMyCameraPublisher());
|
||||
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), false);
|
||||
this.openviduService.publishAudio(this.participantService.getMyCameraPublisher(), hasAudio);
|
||||
this.participantService.enableWebcamUser();
|
||||
}
|
||||
// Muting/unmuting webcam
|
||||
this.webrtcService.publishVideo(this.participantService.getMyCameraPublisher(), publishVideo);
|
||||
this.openviduService.publishVideo(this.participantService.getMyCameraPublisher(), publishVideo);
|
||||
} catch (error) {
|
||||
this.log.e('There was an error toggling camera:', error.code, error.message);
|
||||
this.actionService.openDialog('There was an error toggling camera:', error?.error || error?.message);
|
||||
|
@ -160,7 +160,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
|||
// Disabling screenShare
|
||||
if (this.participantService.areBothEnabled()) {
|
||||
this.participantService.disableScreenUser();
|
||||
this.webrtcService.unpublish(this.participantService.getMyScreenPublisher());
|
||||
this.openviduService.unpublish(this.participantService.getMyScreenPublisher());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
|||
publishAudio: hasAudio,
|
||||
mirror: false
|
||||
};
|
||||
const screenPublisher = this.webrtcService.initPublisher(undefined, properties);
|
||||
const screenPublisher = this.openviduService.initPublisher(undefined, properties);
|
||||
|
||||
screenPublisher.once('accessAllowed', async (event) => {
|
||||
// Listen to event fired when native stop button is clicked
|
||||
|
@ -189,15 +189,15 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
|||
this.log.d('ACCESS ALOWED screenPublisher');
|
||||
this.participantService.enableScreenUser(screenPublisher);
|
||||
|
||||
if (!this.webrtcService.isScreenSessionConnected()) {
|
||||
await this.webrtcService.connectSession(this.webrtcService.getScreenSession(), this.tokenService.getScreenToken());
|
||||
if (!this.openviduService.isScreenSessionConnected()) {
|
||||
await this.openviduService.connectSession(this.openviduService.getScreenSession(), this.tokenService.getScreenToken());
|
||||
}
|
||||
await this.webrtcService.publish(this.participantService.getMyScreenPublisher());
|
||||
// this.webrtcService.sendNicknameSignal();
|
||||
await this.openviduService.publish(this.participantService.getMyScreenPublisher());
|
||||
// this.openviduService.sendNicknameSignal();
|
||||
if (!this.participantService.hasCameraVideoActive()) {
|
||||
// Disabling webcam
|
||||
this.participantService.disableWebcamUser();
|
||||
this.webrtcService.unpublish(this.participantService.getMyCameraPublisher());
|
||||
this.openviduService.unpublish(this.participantService.getMyCameraPublisher());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -212,15 +212,15 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
|||
|
||||
// Disabling screnShare and enabling webcam
|
||||
const hasAudio = this.participantService.hasScreenAudioActive();
|
||||
if (!this.webrtcService.isWebcamSessionConnected()) {
|
||||
await this.webrtcService.connectSession(this.webrtcService.getWebcamSession(), this.tokenService.getWebcamToken());
|
||||
if (!this.openviduService.isWebcamSessionConnected()) {
|
||||
await this.openviduService.connectSession(this.openviduService.getWebcamSession(), this.tokenService.getWebcamToken());
|
||||
}
|
||||
await this.webrtcService.publish(this.participantService.getMyCameraPublisher());
|
||||
this.webrtcService.publishAudio(this.participantService.getMyScreenPublisher(), false);
|
||||
this.webrtcService.publishAudio(this.participantService.getMyCameraPublisher(), hasAudio);
|
||||
await this.openviduService.publish(this.participantService.getMyCameraPublisher());
|
||||
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), false);
|
||||
this.openviduService.publishAudio(this.participantService.getMyCameraPublisher(), hasAudio);
|
||||
this.participantService.enableWebcamUser();
|
||||
this.participantService.disableScreenUser();
|
||||
this.webrtcService.unpublish(this.participantService.getMyScreenPublisher());
|
||||
this.openviduService.unpublish(this.participantService.getMyScreenPublisher());
|
||||
} catch (error) {
|
||||
this.log.e('There was an error toggling screen share:', error.code, error.message);
|
||||
this.actionService.openDialog('There was an error toggling screen share:', error?.error || error?.message);
|
||||
|
@ -234,12 +234,12 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
|||
publishAudio: !this.participantService.isMyCameraEnabled(),
|
||||
mirror: false
|
||||
};
|
||||
await this.webrtcService.replaceTrack(this.participantService.getMyScreenPublisher(), properties);
|
||||
await this.openviduService.replaceTrack(this.participantService.getMyScreenPublisher(), properties);
|
||||
}
|
||||
|
||||
leaveSession() {
|
||||
this.log.d('Leaving session...');
|
||||
this.webrtcService.disconnect();
|
||||
this.openviduService.disconnect();
|
||||
this.onLeaveSessionClicked.emit();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ import { NicknameMatcher } from '../../matchers/nickname.matcher';
|
|||
import { DeviceService } from '../../services/device/device.service';
|
||||
import { LoggerService } from '../../services/logger/logger.service';
|
||||
import { StorageService } from '../../services/storage/storage.service';
|
||||
import { WebrtcService } from '../../services/webrtc/webrtc.service';
|
||||
import { OpenViduService } from '../../services/openvidu/openvidu.service';
|
||||
import { ActionService } from '../../services/action/action.service';
|
||||
import { ParticipantService } from '../../services/participant/participant.service';
|
||||
import { ParticipantAbstractModel } from '../../models/participant.model';
|
||||
|
@ -55,7 +55,7 @@ export class UserSettingsComponent implements OnInit, OnDestroy {
|
|||
private actionService: ActionService,
|
||||
private deviceSrv: DeviceService,
|
||||
private loggerSrv: LoggerService,
|
||||
private openViduWebRTCService: WebrtcService,
|
||||
private openViduopenviduService: OpenViduService,
|
||||
private participantService: ParticipantService,
|
||||
private storageSrv: StorageService
|
||||
) {
|
||||
|
@ -69,7 +69,7 @@ export class UserSettingsComponent implements OnInit, OnDestroy {
|
|||
|
||||
async ngOnInit() {
|
||||
this.subscribeToLocalParticipantEvents();
|
||||
this.openViduWebRTCService.initialize();
|
||||
this.openViduopenviduService.initialize();
|
||||
await this.deviceSrv.initializeDevices();
|
||||
const nickname = this.storageSrv.get(Storage.USER_NICKNAME) || this.generateRandomNickname();
|
||||
this.nicknameFormControl.setValue(nickname);
|
||||
|
@ -99,18 +99,18 @@ export class UserSettingsComponent implements OnInit, OnDestroy {
|
|||
// Is New deviceId different from the old one?
|
||||
if (this.deviceSrv.needUpdateVideoTrack(videoSource)) {
|
||||
const mirror = this.deviceSrv.cameraNeedsMirror(videoSource);
|
||||
await this.openViduWebRTCService.republishTrack(videoSource, null, mirror);
|
||||
await this.openViduopenviduService.republishTrack(videoSource, null, mirror);
|
||||
this.deviceSrv.setCameraSelected(videoSource);
|
||||
this.cameraSelected = this.deviceSrv.getCameraSelected();
|
||||
}
|
||||
// Publish Webcam video
|
||||
this.openViduWebRTCService.publishVideo(this.participantService.getMyCameraPublisher(), true);
|
||||
this.openViduopenviduService.publishVideo(this.participantService.getMyCameraPublisher(), true);
|
||||
this.isVideoActive = true;
|
||||
|
||||
} else {
|
||||
// Videosource is 'null' because of the user has selected 'None' or muted the camera
|
||||
// Unpublish webcam
|
||||
this.openViduWebRTCService.publishVideo(this.participantService.getMyCameraPublisher(), false);
|
||||
this.openViduopenviduService.publishVideo(this.participantService.getMyCameraPublisher(), false);
|
||||
//TODO: save 'None' device in storage
|
||||
// this.deviceSrv.setCameraSelected(videoSource);
|
||||
// this.cameraSelected = this.deviceSrv.getCameraSelected();
|
||||
|
@ -125,7 +125,7 @@ export class UserSettingsComponent implements OnInit, OnDestroy {
|
|||
// Is New deviceId different than older?
|
||||
if (this.deviceSrv.needUpdateAudioTrack(audioSource)) {
|
||||
const mirror = this.deviceSrv.cameraNeedsMirror(this.cameraSelected.device);
|
||||
await this.openViduWebRTCService.republishTrack(null, audioSource, mirror);
|
||||
await this.openViduopenviduService.republishTrack(null, audioSource, mirror);
|
||||
this.deviceSrv.setMicSelected(audioSource);
|
||||
this.microphoneSelected = this.deviceSrv.getMicrophoneSelected();
|
||||
}
|
||||
|
@ -141,11 +141,11 @@ export class UserSettingsComponent implements OnInit, OnDestroy {
|
|||
|
||||
toggleCam() {
|
||||
this.isVideoActive = !this.isVideoActive;
|
||||
this.openViduWebRTCService.publishVideo(this.participantService.getMyCameraPublisher(), this.isVideoActive);
|
||||
this.openViduopenviduService.publishVideo(this.participantService.getMyCameraPublisher(), this.isVideoActive);
|
||||
|
||||
if (this.participantService.areBothEnabled()) {
|
||||
this.participantService.disableWebcamUser();
|
||||
this.openViduWebRTCService.publishAudio(this.participantService.getMyScreenPublisher(), this.isAudioActive);
|
||||
this.openViduopenviduService.publishAudio(this.participantService.getMyScreenPublisher(), this.isAudioActive);
|
||||
} else if (this.participantService.isOnlyMyScreenEnabled()) {
|
||||
this.participantService.enableWebcamUser();
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ export class UserSettingsComponent implements OnInit, OnDestroy {
|
|||
publishAudio: hasAudio,
|
||||
mirror: false
|
||||
};
|
||||
const screenPublisher = this.openViduWebRTCService.initPublisher(undefined, properties);
|
||||
const screenPublisher = this.openViduopenviduService.initPublisher(undefined, properties);
|
||||
|
||||
screenPublisher.on('accessAllowed', (event) => {
|
||||
screenPublisher.stream
|
||||
|
@ -248,8 +248,8 @@ export class UserSettingsComponent implements OnInit, OnDestroy {
|
|||
|
||||
private publishAudio(audio: boolean) {
|
||||
this.participantService.isMyCameraEnabled()
|
||||
? this.openViduWebRTCService.publishAudio(this.participantService.getMyCameraPublisher(), audio)
|
||||
: this.openViduWebRTCService.publishAudio(this.participantService.getMyScreenPublisher(), audio);
|
||||
? this.openViduopenviduService.publishAudio(this.participantService.getMyCameraPublisher(), audio)
|
||||
: this.openViduopenviduService.publishAudio(this.participantService.getMyScreenPublisher(), audio);
|
||||
}
|
||||
|
||||
private subscribeToLocalParticipantEvents() {
|
||||
|
@ -262,7 +262,7 @@ export class UserSettingsComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
private async initwebcamPublisher() {
|
||||
const publisher = await this.openViduWebRTCService.initDefaultPublisher(undefined);
|
||||
const publisher = await this.openViduopenviduService.initDefaultPublisher(undefined);
|
||||
if (publisher) {
|
||||
|
||||
// this.handlePublisherSuccess(publisher);
|
||||
|
|
|
@ -47,7 +47,7 @@ import { PlatformService } from './services/platform/platform.service';
|
|||
import { StorageService } from './services/storage/storage.service';
|
||||
import { TokenService } from './services/token/token.service';
|
||||
import { LibraryConfigService } from './services/library-config/library-config.service';
|
||||
import { WebrtcService } from './services/webrtc/webrtc.service';
|
||||
import { OpenViduService } from './services/openvidu/openvidu.service';
|
||||
import { ActionService } from './services/action/action.service';
|
||||
import { ChatService } from './services/chat/chat.service';
|
||||
import { DocumentService } from './services/document/document.service';
|
||||
|
@ -124,7 +124,7 @@ import { AudioWaveComponent } from './components/audio-wave/audio-wave.component
|
|||
ParticipantService,
|
||||
StorageService,
|
||||
TokenService,
|
||||
WebrtcService
|
||||
OpenViduService
|
||||
],
|
||||
exports: [
|
||||
VideoconferenceComponent,
|
||||
|
|
|
@ -7,7 +7,7 @@ import { ChatMessage } from '../../models/chat.model';
|
|||
import { INotificationOptions } from '../../models/notification-options.model';
|
||||
|
||||
import { ActionService } from '../action/action.service';
|
||||
import { WebrtcService } from '../webrtc/webrtc.service';
|
||||
import { OpenViduService } from '../openvidu/openvidu.service';
|
||||
import { LoggerService } from '../logger/logger.service';
|
||||
import { Signal } from '../../models/signal.model';
|
||||
import { SidenavMenuService } from '../sidenav-menu/sidenav-menu.service';
|
||||
|
@ -25,7 +25,7 @@ export class ChatService {
|
|||
protected log: ILogger;
|
||||
constructor(
|
||||
protected loggerSrv: LoggerService,
|
||||
protected webrtcService: WebrtcService,
|
||||
protected openviduService: OpenViduService,
|
||||
protected participantService: ParticipantService,
|
||||
protected menuService: SidenavMenuService,
|
||||
protected actionService: ActionService
|
||||
|
@ -35,11 +35,11 @@ export class ChatService {
|
|||
}
|
||||
|
||||
subscribeToChat() {
|
||||
const session = this.webrtcService.getWebcamSession();
|
||||
const session = this.openviduService.getWebcamSession();
|
||||
session.on(`signal:${Signal.CHAT}`, (event: any) => {
|
||||
const connectionId = event.from.connectionId;
|
||||
const data = JSON.parse(event.data);
|
||||
const isMyOwnConnection = this.webrtcService.isMyOwnConnection(connectionId);
|
||||
const isMyOwnConnection = this.openviduService.isMyOwnConnection(connectionId);
|
||||
this.messageList.push({
|
||||
isLocal: isMyOwnConnection,
|
||||
nickname: data.nickname,
|
||||
|
@ -65,7 +65,7 @@ export class ChatService {
|
|||
nickname: this.participantService.getWebcamNickname()
|
||||
};
|
||||
|
||||
this.webrtcService.sendSignal(Signal.CHAT, undefined, data);
|
||||
this.openviduService.sendSignal(Signal.CHAT, undefined, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Signal } from '../../models/signal.model';
|
|||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class WebrtcServiceMock {
|
||||
export class OpenViduServiceMock {
|
||||
private OV: OpenVidu = null;
|
||||
private OVScreen: OpenVidu = null;
|
||||
|
|
@ -4,15 +4,15 @@ import { LoggerServiceMock } from '../logger/logger.service.mock';
|
|||
|
||||
import { LocalUserService } from '../local-user/local-user.service';
|
||||
import { LocalUserServiceMock } from '../local-user/local-user.service.mock';
|
||||
import { WebrtcService } from './webrtc.service';
|
||||
import { OpenViduService } from './openvidu.service';
|
||||
import { PlatformService } from '../platform/platform.service';
|
||||
import { PlatformServiceMock } from '../platform/platform.service.mock';
|
||||
import { LibraryConfigService } from '../library-config/library-config.service';
|
||||
import { LibraryConfigServiceMock } from '../library-config/library-config.service.mock';
|
||||
|
||||
|
||||
describe('WebrtcService', () => {
|
||||
let service: WebrtcService;
|
||||
describe('OpenViduService', () => {
|
||||
let service: OpenViduService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
|
@ -23,7 +23,7 @@ describe('WebrtcService', () => {
|
|||
{ provide: LibraryConfigService, useClass: LibraryConfigServiceMock }
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(WebrtcService);
|
||||
service = TestBed.inject(OpenViduService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
|
@ -1,7 +1,7 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Connection, OpenVidu, Publisher, PublisherProperties, Session, SignalOptions } from 'openvidu-browser';
|
||||
|
||||
import { LoggerService } from '../../services/logger/logger.service';
|
||||
import { LoggerService } from '../logger/logger.service';
|
||||
|
||||
import { ILogger } from '../../models/logger.model';
|
||||
import { Signal } from '../../models/signal.model';
|
||||
|
@ -15,7 +15,7 @@ import { ParticipantService } from '../participant/participant.service';
|
|||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class WebrtcService {
|
||||
export class OpenViduService {
|
||||
protected OV: OpenVidu = null;
|
||||
protected OVScreen: OpenVidu = null;
|
||||
protected webcamSession: Session = null;
|
||||
|
@ -33,7 +33,7 @@ export class WebrtcService {
|
|||
private participantService: ParticipantService,
|
||||
protected deviceService: DeviceService
|
||||
) {
|
||||
this.log = this.loggerSrv.get('WebRTCService');
|
||||
this.log = this.loggerSrv.get('OpenViduService');
|
||||
}
|
||||
|
||||
initialize() {
|
|
@ -5,7 +5,7 @@
|
|||
export * from './lib/openvidu-angular.module';
|
||||
|
||||
// Services
|
||||
export * from './lib/services/webrtc/webrtc.service';
|
||||
export * from './lib/services/openvidu/openvidu.service';
|
||||
export * from './lib/services/participant/participant.service';
|
||||
export * from './lib/services/chat/chat.service';
|
||||
export * from './lib/services/platform/platform.service';
|
||||
|
|
Loading…
Reference in New Issue