diff --git a/openvidu-testapp/src/app/app.module.ts b/openvidu-testapp/src/app/app.module.ts index 3f568150e3..d9b0de7956 100644 --- a/openvidu-testapp/src/app/app.module.ts +++ b/openvidu-testapp/src/app/app.module.ts @@ -44,6 +44,7 @@ import { UsersTableComponent } from './components/users-table/users-table.compon import { TableVideoComponent } from './components/users-table/table-video.component'; import { CallbackPipe } from './pipes/callback.pipe'; import { AppRoutingModule } from './app.routing'; +import { VideoResolutionComponent } from './components/dialogs/options-dialog/video-resolution/video-resolution.component'; @NgModule({ declarations: [ @@ -61,6 +62,7 @@ import { AppRoutingModule } from './app.routing'; TableVideoComponent, CallbackPipe, OptionsDialogComponent, + VideoResolutionComponent, ], imports: [ FormsModule, diff --git a/openvidu-testapp/src/app/components/dialogs/options-dialog/options-dialog.component.css b/openvidu-testapp/src/app/components/dialogs/options-dialog/options-dialog.component.css index 38ee43d716..a3a269b36c 100644 --- a/openvidu-testapp/src/app/components/dialogs/options-dialog/options-dialog.component.css +++ b/openvidu-testapp/src/app/components/dialogs/options-dialog/options-dialog.component.css @@ -1,6 +1,26 @@ mat-form-field { - margin-top: 10px; - margin-right: 5px; + margin: 10px 5px 0 5px; + font-size: 14px; +} + +mat-form-field:first-child { + margin-left: 0; +} + +mat-radio-group { + font-size: 14px; +} + +mat-checkbox { + font-size: 14px; +} + +mat-select { + font-size: 14px; +} + +mat-option { + font-size: 14px; } a { diff --git a/openvidu-testapp/src/app/components/dialogs/options-dialog/options-dialog.component.html b/openvidu-testapp/src/app/components/dialogs/options-dialog/options-dialog.component.html index d6d1223aa9..15c36c19b6 100644 --- a/openvidu-testapp/src/app/components/dialogs/options-dialog/options-dialog.component.html +++ b/openvidu-testapp/src/app/components/dialogs/options-dialog/options-dialog.component.html @@ -4,81 +4,72 @@

OPTIONS


- adaptiveStream - dynacast - disconnectOnPageLeave - stopLocalTrackOnUnpublish - webAudioMix + adaptiveStream + dynacast + disconnectOnPageLeave + stopLocalTrackOnUnpublish + webAudioMix
- -
+
VideoCaptureOptions True (default) - False (no video) + False (no video) Custom
- + deviceId - + facingMode {{mode}} - - aspectRatio - - - - frameRate - - - - width - - - - height - - + +
-
+
True (default) - False (no audio) + False (no audio) Custom
- autoGainControl - echoCancellation - noiseSuppression + autoGainControl + echoCancellation + noiseSuppression
- + deviceId - + channelCount - + latency - + sampleRate - + sampleSize @@ -90,20 +81,20 @@

OPTIONS


True (default) - False (no screen) + False (no screen) Custom
- video + video + audio + preferCurrentTab + suppressLocalAudioPlayback displaySurface {{surface}} - audio - preferCurrentTab - suppressLocalAudioPlayback contentHint @@ -128,43 +119,59 @@

OPTIONS

{{audio}}
+
+ + + Default + Custom + + + +

- backupCodec - dtx - forceStereo - - name - + simulcast + dtx + red + backupCodec + forceStereo + stopMicTrackOnMute + + videoCodec + + {{codec}} + - red - + scalabilityMode {{mode}} - simulcast - + + name + + + source {{source}} - stopMicTrackOnMute - + stream - - videoCodec - - {{codec}} - -
diff --git a/openvidu-testapp/src/app/components/dialogs/options-dialog/options-dialog.component.ts b/openvidu-testapp/src/app/components/dialogs/options-dialog/options-dialog.component.ts index de904d306b..d65a6750b8 100644 --- a/openvidu-testapp/src/app/components/dialogs/options-dialog/options-dialog.component.ts +++ b/openvidu-testapp/src/app/components/dialogs/options-dialog/options-dialog.component.ts @@ -23,6 +23,9 @@ export class OptionsDialogComponent { shareScreen = false; screenShareCaptureOptions?: ScreenShareCaptureOptions; trackPublishOptions?: TrackPublishOptions; + allowDisablingAudio = true; + allowDisablingVideo = true; + allowDisablingScreen = true; videoOption: true | false | 'custom'; audioOption: true | false | 'custom'; @@ -32,6 +35,7 @@ export class OptionsDialogComponent { auxAudioCaptureOptions: AudioCaptureOptions; auxScreenDisplaySurface: 'NONE' | 'window' | 'browser' | 'monitor'; + customScreenShareResolution: boolean = false; ENUMERATION_SOURCE = Object.keys(Track.Source); @@ -44,6 +48,9 @@ export class OptionsDialogComponent { shareScreen: boolean; screenShareCaptureOptions?: ScreenShareCaptureOptions; trackPublishOptions?: TrackPublishOptions; + allowDisablingAudio?: boolean; + allowDisablingVideo?: boolean; + allowDisablingScreen?: boolean; } ) { this.roomOptions = data.roomOptions; @@ -51,32 +58,46 @@ export class OptionsDialogComponent { this.shareScreen = data.shareScreen; this.screenShareCaptureOptions = data.screenShareCaptureOptions; this.trackPublishOptions = data.trackPublishOptions; - if (typeof this.createLocalTracksOptions?.video !== 'boolean') { - this.auxVideoCaptureOptions = this.createLocalTracksOptions! - .video as VideoCaptureOptions; - this.videoOption = 'custom'; - } else { - this.videoOption = this.createLocalTracksOptions.video; - this.auxVideoCaptureOptions = new Room().options.videoCaptureDefaults!; - } - if (typeof this.createLocalTracksOptions?.audio !== 'boolean') { - this.auxAudioCaptureOptions = this.createLocalTracksOptions! - .audio as AudioCaptureOptions; - this.audioOption = 'custom'; - } else { - this.audioOption = this.createLocalTracksOptions.audio; - this.auxAudioCaptureOptions = new Room().options.audioCaptureDefaults!; + if (this.createLocalTracksOptions !== undefined) { + if (typeof this.createLocalTracksOptions.video !== 'boolean') { + this.auxVideoCaptureOptions = this.createLocalTracksOptions! + .video as VideoCaptureOptions; + this.videoOption = 'custom'; + } else { + this.videoOption = this.createLocalTracksOptions.video; + this.auxVideoCaptureOptions = new Room().options.videoCaptureDefaults!; + } + if (typeof this.createLocalTracksOptions?.audio !== 'boolean') { + this.auxAudioCaptureOptions = this.createLocalTracksOptions! + .audio as AudioCaptureOptions; + this.audioOption = 'custom'; + } else { + this.audioOption = this.createLocalTracksOptions.audio; + this.auxAudioCaptureOptions = new Room().options.audioCaptureDefaults!; + } } if (this.shareScreen) { if (this.screenShareCaptureOptions == undefined) { this.screenOption = false; } else if (Object.keys(this.screenShareCaptureOptions).length > 0) { this.screenOption = 'custom'; + if (this.screenShareCaptureOptions.resolution) { + this.customScreenShareResolution = true; + } } else { this.screenOption = true; this.screenShareCaptureOptions = {}; } } + if (this.data.allowDisablingAudio === false) { + this.allowDisablingAudio = false; + } + if (this.data.allowDisablingVideo === false) { + this.allowDisablingVideo = false; + } + if (this.data.allowDisablingScreen === false) { + this.allowDisablingScreen = false; + } } returnValues() { @@ -117,8 +138,21 @@ export class OptionsDialogComponent { screenOptionChanged(event: MatRadioChange) { if (event.value === 'custom' && !this.screenShareCaptureOptions) { this.screenShareCaptureOptions = { - video: true + video: true, }; } } + + handleCustomScreenResolutionChange() { + if (this.customScreenShareResolution) { + if (!this.screenShareCaptureOptions!.resolution) { + this.screenShareCaptureOptions!.resolution = { + width: 1920, + height: 1080, + }; + } + } else { + delete this.screenShareCaptureOptions!.resolution; + } + } } diff --git a/openvidu-testapp/src/app/components/dialogs/options-dialog/video-resolution/video-resolution.component.css b/openvidu-testapp/src/app/components/dialogs/options-dialog/video-resolution/video-resolution.component.css new file mode 100644 index 0000000000..b81341681d --- /dev/null +++ b/openvidu-testapp/src/app/components/dialogs/options-dialog/video-resolution/video-resolution.component.css @@ -0,0 +1,17 @@ +.resolution-div { + border: 1px solid #e0e0e0; + padding: 5px 5px 5px 5px; + border-radius: 5px; + width: fit-content; + margin-top: 8px; +} + +.resolution-title { + margin-top: 2px; +} + +mat-form-field { + font-size: 124x; + width: 100px; + margin-right: 4px; +} diff --git a/openvidu-testapp/src/app/components/dialogs/options-dialog/video-resolution/video-resolution.component.html b/openvidu-testapp/src/app/components/dialogs/options-dialog/video-resolution/video-resolution.component.html new file mode 100644 index 0000000000..d33f5956df --- /dev/null +++ b/openvidu-testapp/src/app/components/dialogs/options-dialog/video-resolution/video-resolution.component.html @@ -0,0 +1,19 @@ +
+

Resolution

+ + width + + + + height + + + + frameRate + + + + aspectRatio + + +
\ No newline at end of file diff --git a/openvidu-testapp/src/app/components/dialogs/options-dialog/video-resolution/video-resolution.component.spec.ts b/openvidu-testapp/src/app/components/dialogs/options-dialog/video-resolution/video-resolution.component.spec.ts new file mode 100644 index 0000000000..ceed70c9b8 --- /dev/null +++ b/openvidu-testapp/src/app/components/dialogs/options-dialog/video-resolution/video-resolution.component.spec.ts @@ -0,0 +1,21 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { VideoResolutionComponent } from './video-resolution.component'; + +describe('VideoResolutionComponent', () => { + let component: VideoResolutionComponent; + let fixture: ComponentFixture; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [VideoResolutionComponent] + }); + fixture = TestBed.createComponent(VideoResolutionComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/openvidu-testapp/src/app/components/dialogs/options-dialog/video-resolution/video-resolution.component.ts b/openvidu-testapp/src/app/components/dialogs/options-dialog/video-resolution/video-resolution.component.ts new file mode 100644 index 0000000000..27f034ff7d --- /dev/null +++ b/openvidu-testapp/src/app/components/dialogs/options-dialog/video-resolution/video-resolution.component.ts @@ -0,0 +1,30 @@ +import { Component, EventEmitter, Input, Output } from '@angular/core'; + +@Component({ + selector: 'app-video-resolution', + templateUrl: './video-resolution.component.html', + styleUrls: ['./video-resolution.component.css'], +}) +export class VideoResolutionComponent { + @Input() componentId: string; + @Input() showTitle = true; + @Input() width: number; + @Input() height: number; + @Input() frameRate?: number; + @Input() aspectRatio?: number; + @Output() resolutionChanged: EventEmitter<{ + width: number; + height: number; + frameRate?: number; + aspectRatio?: number; + }> = new EventEmitter(); + + emitChanges() { + this.resolutionChanged.emit({ + width: this.width, + height: this.height, + frameRate: this.frameRate, + aspectRatio: this.aspectRatio, + }); + } +} diff --git a/openvidu-testapp/src/app/components/openvidu-instance/openvidu-instance.component.html b/openvidu-testapp/src/app/components/openvidu-instance/openvidu-instance.component.html index b3bc3acedc..7e2325be10 100644 --- a/openvidu-testapp/src/app/components/openvidu-instance/openvidu-instance.component.html +++ b/openvidu-testapp/src/app/components/openvidu-instance/openvidu-instance.component.html @@ -83,10 +83,10 @@
- + [participant]="participant.value" [room]="room" [index]="index" (sendDataToOneParticipant)="sendData($event)">
diff --git a/openvidu-testapp/src/app/components/openvidu-instance/openvidu-instance.component.ts b/openvidu-testapp/src/app/components/openvidu-instance/openvidu-instance.component.ts index 0d4301a3ec..e49a575103 100644 --- a/openvidu-testapp/src/app/components/openvidu-instance/openvidu-instance.component.ts +++ b/openvidu-testapp/src/app/components/openvidu-instance/openvidu-instance.component.ts @@ -166,10 +166,17 @@ export class OpenviduInstanceComponent { ); if (this.roomConf.publisher) { - const tracks: LocalTrack[] = - await this.room.localParticipant.createTracks( - this.createLocalTracksOptions + const tracks: LocalTrack[] = []; + if ( + this.createLocalTracksOptions.audio || + this.createLocalTracksOptions.video + ) { + tracks.push( + ...(await this.room.localParticipant.createTracks( + this.createLocalTracksOptions + )) ); + } if (this.screenShareCaptureOptions) { const screenTracks: LocalTrack[] = await this.room.localParticipant.createScreenTracks( @@ -1026,6 +1033,23 @@ export class OpenviduInstanceComponent { this.createLocalTracksOptions = result.createLocalTracksOptions; this.screenShareCaptureOptions = result.screenShareCaptureOptions; this.trackPublishOptions = result.trackPublishOptions; + if ( + this.createLocalTracksOptions.audio != undefined && + typeof this.createLocalTracksOptions.audio !== 'boolean' + ) { + this.roomOptions.audioCaptureDefaults = + this.createLocalTracksOptions.audio; + } + if ( + this.createLocalTracksOptions.video != undefined && + typeof this.createLocalTracksOptions.video !== 'boolean' + ) { + this.roomOptions.videoCaptureDefaults = + this.createLocalTracksOptions.video; + } + if (this.trackPublishOptions != undefined) { + this.roomOptions.publishDefaults = this.trackPublishOptions; + } } }); } diff --git a/openvidu-testapp/src/app/components/participant/participant.component.html b/openvidu-testapp/src/app/components/participant/participant.component.html index 9fef610e35..d8ca598287 100644 --- a/openvidu-testapp/src/app/components/participant/participant.component.html +++ b/openvidu-testapp/src/app/components/participant/participant.component.html @@ -9,7 +9,7 @@ +