mirror of https://github.com/OpenVidu/openvidu.git
openvidu-components: Refactored methods name
parent
5cc6579bf0
commit
d81124150a
|
@ -131,11 +131,11 @@ export class PreJoinComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
if (this.participantService.haveICameraAndScreenActive()) {
|
if (this.participantService.haveICameraAndScreenActive()) {
|
||||||
// Cam will not published, disable webcam with screensharing active
|
// Cam will not published, disable webcam with screensharing active
|
||||||
this.participantService.disableWebcamUser();
|
this.participantService.disableWebcamStream();
|
||||||
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), publish);
|
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), publish);
|
||||||
} else if (this.participantService.isOnlyMyScreenActive()) {
|
} else if (this.participantService.isOnlyMyScreenActive()) {
|
||||||
// Cam will be published, enable webcam
|
// Cam will be published, enable webcam
|
||||||
this.participantService.enableWebcamUser();
|
this.participantService.enableWebcamStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isVideoMuted = !this.isVideoMuted;
|
this.isVideoMuted = !this.isVideoMuted;
|
||||||
|
|
|
@ -175,7 +175,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
||||||
// Disabling webcam
|
// Disabling webcam
|
||||||
if (this.participantService.haveICameraAndScreenActive()) {
|
if (this.participantService.haveICameraAndScreenActive()) {
|
||||||
this.openviduService.publishVideo(this.participantService.getMyCameraPublisher(), publishVideo);
|
this.openviduService.publishVideo(this.participantService.getMyCameraPublisher(), publishVideo);
|
||||||
this.participantService.disableWebcamUser();
|
this.participantService.disableWebcamStream();
|
||||||
this.openviduService.unpublish(this.participantService.getMyCameraPublisher());
|
this.openviduService.unpublish(this.participantService.getMyCameraPublisher());
|
||||||
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), publishAudio);
|
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), publishAudio);
|
||||||
return;
|
return;
|
||||||
|
@ -190,7 +190,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
||||||
await this.openviduService.publish(this.participantService.getMyCameraPublisher());
|
await this.openviduService.publish(this.participantService.getMyCameraPublisher());
|
||||||
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), false);
|
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), false);
|
||||||
this.openviduService.publishAudio(this.participantService.getMyCameraPublisher(), hasAudio);
|
this.openviduService.publishAudio(this.participantService.getMyCameraPublisher(), hasAudio);
|
||||||
this.participantService.enableWebcamUser();
|
this.participantService.enableWebcamStream();
|
||||||
}
|
}
|
||||||
// Muting/unmuting webcam
|
// Muting/unmuting webcam
|
||||||
this.openviduService.publishVideo(this.participantService.getMyCameraPublisher(), publishVideo);
|
this.openviduService.publishVideo(this.participantService.getMyCameraPublisher(), publishVideo);
|
||||||
|
@ -206,7 +206,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
||||||
try {
|
try {
|
||||||
// Disabling screenShare
|
// Disabling screenShare
|
||||||
if (this.participantService.haveICameraAndScreenActive()) {
|
if (this.participantService.haveICameraAndScreenActive()) {
|
||||||
this.participantService.disableScreenUser();
|
this.participantService.disableScreenStream();
|
||||||
this.openviduService.unpublish(this.participantService.getMyScreenPublisher());
|
this.openviduService.unpublish(this.participantService.getMyScreenPublisher());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
||||||
// this.openviduService.sendNicknameSignal();
|
// this.openviduService.sendNicknameSignal();
|
||||||
if (!this.participantService.hasCameraVideoActive()) {
|
if (!this.participantService.hasCameraVideoActive()) {
|
||||||
// Disabling webcam
|
// Disabling webcam
|
||||||
this.participantService.disableWebcamUser();
|
this.participantService.disableWebcamStream();
|
||||||
this.openviduService.unpublish(this.participantService.getMyCameraPublisher());
|
this.openviduService.unpublish(this.participantService.getMyCameraPublisher());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -268,8 +268,8 @@ export class ToolbarComponent implements OnInit, OnDestroy {
|
||||||
await this.openviduService.publish(this.participantService.getMyCameraPublisher());
|
await this.openviduService.publish(this.participantService.getMyCameraPublisher());
|
||||||
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), false);
|
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), false);
|
||||||
this.openviduService.publishAudio(this.participantService.getMyCameraPublisher(), hasAudio);
|
this.openviduService.publishAudio(this.participantService.getMyCameraPublisher(), hasAudio);
|
||||||
this.participantService.enableWebcamUser();
|
this.participantService.enableWebcamStream();
|
||||||
this.participantService.disableScreenUser();
|
this.participantService.disableScreenStream();
|
||||||
this.openviduService.unpublish(this.participantService.getMyScreenPublisher());
|
this.openviduService.unpublish(this.participantService.getMyScreenPublisher());
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.log.e('There was an error toggling screen share:', error.code, error.message);
|
this.log.e('There was an error toggling screen share:', error.code, error.message);
|
||||||
|
|
|
@ -79,7 +79,7 @@ export class OpenViduService {
|
||||||
async connectSession(session: Session, token: string): Promise<void> {
|
async connectSession(session: Session, token: string): Promise<void> {
|
||||||
if (!!token && session) {
|
if (!!token && session) {
|
||||||
const nickname = this.participantService.getMyNickname();
|
const nickname = this.participantService.getMyNickname();
|
||||||
const participantId = this.participantService.getMyParticipantId();
|
const participantId = this.participantService.getLocalParticipant().id;
|
||||||
if (session === this.webcamSession) {
|
if (session === this.webcamSession) {
|
||||||
this.log.d('Connecting webcam session');
|
this.log.d('Connecting webcam session');
|
||||||
await this.webcamSession.connect(token, {
|
await this.webcamSession.connect(token, {
|
||||||
|
@ -262,7 +262,7 @@ export class OpenViduService {
|
||||||
if (videoType === VideoType.CAMERA) {
|
if (videoType === VideoType.CAMERA) {
|
||||||
//TODO: Uncomment this section when replaceTrack issue is fixed
|
//TODO: Uncomment this section when replaceTrack issue is fixed
|
||||||
// https://github.com/OpenVidu/openvidu/pull/700
|
// https://github.com/OpenVidu/openvidu/pull/700
|
||||||
throw('Replace track feature has a bug. We are trying to fix it');
|
throw 'Replace track feature has a bug. We are trying to fix it';
|
||||||
// let mediaStream: MediaStream;
|
// let mediaStream: MediaStream;
|
||||||
// const oldMediaStream = this.participantService.getMyCameraPublisher().stream.getMediaStream();
|
// const oldMediaStream = this.participantService.getMyCameraPublisher().stream.getMediaStream();
|
||||||
// const isFirefoxPlatform = this.platformService.isFirefox();
|
// const isFirefoxPlatform = this.platformService.isFirefox();
|
||||||
|
@ -363,7 +363,7 @@ export class OpenViduService {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getRemoteCameraConnections(): Connection[] {
|
getRemoteConnections(): Connection[] {
|
||||||
// Avoid screen connections
|
// Avoid screen connections
|
||||||
const remoteCameraConnections: Connection[] = Array.from(this.webcamSession.remoteConnections.values()).filter((conn) => {
|
const remoteCameraConnections: Connection[] = Array.from(this.webcamSession.remoteConnections.values()).filter((conn) => {
|
||||||
let type: VideoType;
|
let type: VideoType;
|
||||||
|
|
|
@ -39,9 +39,6 @@ export class ParticipantService {
|
||||||
getLocalParticipant(): ParticipantAbstractModel {
|
getLocalParticipant(): ParticipantAbstractModel {
|
||||||
return this.localParticipant;
|
return this.localParticipant;
|
||||||
}
|
}
|
||||||
getMyParticipantId(): string {
|
|
||||||
return this.localParticipant.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
getMyCameraPublisher(): Publisher {
|
getMyCameraPublisher(): Publisher {
|
||||||
return <Publisher>this.localParticipant.getCameraConnection().streamManager;
|
return <Publisher>this.localParticipant.getCameraConnection().streamManager;
|
||||||
|
@ -54,10 +51,9 @@ export class ParticipantService {
|
||||||
this.localParticipant.setCameraConnectionId(connectionId);
|
this.localParticipant.setCameraConnectionId(connectionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
getMyCameraConnectionId(): string {
|
/**
|
||||||
return this.localParticipant.getCameraConnection().connectionId;
|
* @internal
|
||||||
}
|
*/
|
||||||
|
|
||||||
getMyScreenPublisher(): Publisher {
|
getMyScreenPublisher(): Publisher {
|
||||||
return <Publisher>this.localParticipant.getScreenConnection()?.streamManager;
|
return <Publisher>this.localParticipant.getScreenConnection()?.streamManager;
|
||||||
}
|
}
|
||||||
|
@ -70,12 +66,14 @@ export class ParticipantService {
|
||||||
this.localParticipant.setScreenConnectionId(connectionId);
|
this.localParticipant.setScreenConnectionId(connectionId);
|
||||||
}
|
}
|
||||||
|
|
||||||
enableWebcamUser() {
|
/**
|
||||||
|
enableWebcamStream() {
|
||||||
this.localParticipant.enableCamera();
|
this.localParticipant.enableCamera();
|
||||||
this.updateLocalParticipant();
|
this.updateLocalParticipant();
|
||||||
}
|
}
|
||||||
|
|
||||||
disableWebcamUser() {
|
/**
|
||||||
|
disableWebcamStream() {
|
||||||
this.localParticipant.disableCamera();
|
this.localParticipant.disableCamera();
|
||||||
this.updateLocalParticipant();
|
this.updateLocalParticipant();
|
||||||
}
|
}
|
||||||
|
@ -97,7 +95,8 @@ export class ParticipantService {
|
||||||
this.updateLocalParticipant();
|
this.updateLocalParticipant();
|
||||||
}
|
}
|
||||||
|
|
||||||
disableScreenUser() {
|
/**
|
||||||
|
disableScreenStream() {
|
||||||
this.localParticipant.disableScreen();
|
this.localParticipant.disableScreen();
|
||||||
this.updateLocalParticipant();
|
this.updateLocalParticipant();
|
||||||
}
|
}
|
||||||
|
@ -110,13 +109,10 @@ export class ParticipantService {
|
||||||
getMyNickname(): string {
|
getMyNickname(): string {
|
||||||
return this.localParticipant.nickname;
|
return this.localParticipant.nickname;
|
||||||
}
|
}
|
||||||
// getWebcamNickname(): string {
|
|
||||||
// return this.localParticipant.getCameraNickname();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// getScreenNickname(): string {
|
/**
|
||||||
// return this.localParticipant.getScreenNickname();
|
* @internal
|
||||||
// }
|
*/
|
||||||
|
|
||||||
|
|
||||||
toggleMyVideoEnlarged(connectionId: string) {
|
toggleMyVideoEnlarged(connectionId: string) {
|
||||||
|
@ -132,7 +128,7 @@ export class ParticipantService {
|
||||||
}
|
}
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
this.disableScreenUser();
|
this.disableScreenStream();
|
||||||
// this.localParticipant = this.newParticipant();
|
// this.localParticipant = this.newParticipant();
|
||||||
// this._screensharing.next(false);
|
// this._screensharing.next(false);
|
||||||
this.remoteParticipants = [];
|
this.remoteParticipants = [];
|
||||||
|
|
Loading…
Reference in New Issue