openvidu-components: Refactored methods name

pull/707/head
csantosm 2022-03-23 13:45:30 +01:00
parent 5cc6579bf0
commit d81124150a
4 changed files with 28 additions and 32 deletions

View File

@ -131,11 +131,11 @@ export class PreJoinComponent implements OnInit, OnDestroy {
if (this.participantService.haveICameraAndScreenActive()) {
// Cam will not published, disable webcam with screensharing active
this.participantService.disableWebcamUser();
this.participantService.disableWebcamStream();
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), publish);
} else if (this.participantService.isOnlyMyScreenActive()) {
// Cam will be published, enable webcam
this.participantService.enableWebcamUser();
this.participantService.enableWebcamStream();
}
this.isVideoMuted = !this.isVideoMuted;

View File

@ -175,7 +175,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
// Disabling webcam
if (this.participantService.haveICameraAndScreenActive()) {
this.openviduService.publishVideo(this.participantService.getMyCameraPublisher(), publishVideo);
this.participantService.disableWebcamUser();
this.participantService.disableWebcamStream();
this.openviduService.unpublish(this.participantService.getMyCameraPublisher());
this.openviduService.publishAudio(this.participantService.getMyScreenPublisher(), publishAudio);
return;
@ -190,7 +190,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
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.enableWebcamStream();
}
// Muting/unmuting webcam
this.openviduService.publishVideo(this.participantService.getMyCameraPublisher(), publishVideo);
@ -206,7 +206,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
try {
// Disabling screenShare
if (this.participantService.haveICameraAndScreenActive()) {
this.participantService.disableScreenUser();
this.participantService.disableScreenStream();
this.openviduService.unpublish(this.participantService.getMyScreenPublisher());
return;
}
@ -246,7 +246,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
// this.openviduService.sendNicknameSignal();
if (!this.participantService.hasCameraVideoActive()) {
// Disabling webcam
this.participantService.disableWebcamUser();
this.participantService.disableWebcamStream();
this.openviduService.unpublish(this.participantService.getMyCameraPublisher());
}
});
@ -268,8 +268,8 @@ export class ToolbarComponent implements OnInit, OnDestroy {
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.participantService.enableWebcamStream();
this.participantService.disableScreenStream();
this.openviduService.unpublish(this.participantService.getMyScreenPublisher());
} catch (error) {
this.log.e('There was an error toggling screen share:', error.code, error.message);
@ -331,7 +331,7 @@ export class ToolbarComponent implements OnInit, OnDestroy {
}
protected subscribeToUserMediaProperties() {
this.localParticipantSubscription = this.participantService.localParticipantObs.subscribe((p) => {
if(p) {
if (p) {
this.isWebcamVideoActive = p.isCameraVideoActive();
this.isWebcamAudioActive = p.isCameraAudioActive();
this.isScreenShareActive = p.isScreenActive();

View File

@ -79,7 +79,7 @@ export class OpenViduService {
async connectSession(session: Session, token: string): Promise<void> {
if (!!token && session) {
const nickname = this.participantService.getMyNickname();
const participantId = this.participantService.getMyParticipantId();
const participantId = this.participantService.getLocalParticipant().id;
if (session === this.webcamSession) {
this.log.d('Connecting webcam session');
await this.webcamSession.connect(token, {
@ -207,7 +207,7 @@ export class OpenViduService {
// TODO: Remove this method when replaceTrack issue is fixed
// https://github.com/OpenVidu/openvidu/pull/700
republishTrack(properties: PublisherProperties): Promise<void> {
const {videoSource, audioSource, mirror} = properties;
const { videoSource, audioSource, mirror } = properties;
return new Promise(async (resolve, reject) => {
if (!!videoSource) {
this.log.d('Replacing video track ' + videoSource);
@ -262,7 +262,7 @@ export class OpenViduService {
if (videoType === VideoType.CAMERA) {
//TODO: Uncomment this section when replaceTrack issue is fixed
// 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;
// const oldMediaStream = this.participantService.getMyCameraPublisher().stream.getMediaStream();
// const isFirefoxPlatform = this.platformService.isFirefox();
@ -363,7 +363,7 @@ export class OpenViduService {
);
}
getRemoteCameraConnections(): Connection[] {
getRemoteConnections(): Connection[] {
// Avoid screen connections
const remoteCameraConnections: Connection[] = Array.from(this.webcamSession.remoteConnections.values()).filter((conn) => {
let type: VideoType;

View File

@ -39,9 +39,6 @@ export class ParticipantService {
getLocalParticipant(): ParticipantAbstractModel {
return this.localParticipant;
}
getMyParticipantId(): string {
return this.localParticipant.id;
}
getMyCameraPublisher(): Publisher {
return <Publisher>this.localParticipant.getCameraConnection().streamManager;
@ -54,10 +51,9 @@ export class ParticipantService {
this.localParticipant.setCameraConnectionId(connectionId);
}
getMyCameraConnectionId(): string {
return this.localParticipant.getCameraConnection().connectionId;
}
/**
* @internal
*/
getMyScreenPublisher(): Publisher {
return <Publisher>this.localParticipant.getScreenConnection()?.streamManager;
}
@ -70,12 +66,14 @@ export class ParticipantService {
this.localParticipant.setScreenConnectionId(connectionId);
}
enableWebcamUser() {
/**
enableWebcamStream() {
this.localParticipant.enableCamera();
this.updateLocalParticipant();
}
disableWebcamUser() {
/**
disableWebcamStream() {
this.localParticipant.disableCamera();
this.updateLocalParticipant();
}
@ -97,7 +95,8 @@ export class ParticipantService {
this.updateLocalParticipant();
}
disableScreenUser() {
/**
disableScreenStream() {
this.localParticipant.disableScreen();
this.updateLocalParticipant();
}
@ -110,13 +109,10 @@ export class ParticipantService {
getMyNickname(): string {
return this.localParticipant.nickname;
}
// getWebcamNickname(): string {
// return this.localParticipant.getCameraNickname();
// }
// getScreenNickname(): string {
// return this.localParticipant.getScreenNickname();
// }
/**
* @internal
*/
toggleMyVideoEnlarged(connectionId: string) {
@ -125,14 +121,14 @@ export class ParticipantService {
resetMyStreamsToNormalSize() {
if(this.localParticipant.someHasVideoEnlarged()){
if (this.localParticipant.someHasVideoEnlarged()) {
this.localParticipant.setAllVideoEnlarged(false);
this.updateLocalParticipant();
}
}
clear() {
this.disableScreenUser();
this.disableScreenStream();
// this.localParticipant = this.newParticipant();
// this._screensharing.next(false);
this.remoteParticipants = [];
@ -174,7 +170,7 @@ export class ParticipantService {
}
updateLocalParticipant() {
this._localParticipant.next(Object.assign(Object.create(this.localParticipant),this.localParticipant));
this._localParticipant.next(Object.assign(Object.create(this.localParticipant), this.localParticipant));
}
/**