Skip to content

Commit

Permalink
openvidu-testapp: test scenarios. Full LiveKit options dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloFuente committed Sep 16, 2024
1 parent bd6ba55 commit 7e7b6d2
Show file tree
Hide file tree
Showing 31 changed files with 3,441 additions and 1,293 deletions.
3,550 changes: 2,392 additions & 1,158 deletions openvidu-testapp/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions openvidu-testapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"json-stringify-safe": "5.0.1",
"livekit-client": "2.1.0",
"livekit-server-sdk": "2.1.2",
"livekit-client": "2.5.1",
"livekit-server-sdk": "2.6.2",
"lodash": "^4.17.21",
"rxjs": "~7.8.1",
"stream-browserify": "^3.0.0",
Expand Down
10 changes: 0 additions & 10 deletions openvidu-testapp/src/app/app-routing.module.ts

This file was deleted.

4 changes: 3 additions & 1 deletion openvidu-testapp/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<mat-toolbar class="mat-elevation-z5" color="primary">
<a id="nav-logo" routerLink="/"><img id="nav-img"
src="assets/images/openvidu_vert_white_bg_trans_cropped.png" />LiveKit TestApp</a>
<a mat-button id="toolbar-sessions" routerLink="/test-sessions"><span>SESSIONS</span></a>
<a mat-button id="toolbar-scenarios" routerLink="/test-scenarios"><span>SCENARIOS</span></a>
</mat-toolbar>
<main>
<mat-form-field>
Expand All @@ -19,6 +21,6 @@
<input id="livekit-api-secret" matInput type="password" placeholder="LiveKit Api Secret"
[ngModel]="livekitApiSecret" (ngModelChange)="updateApiSecret($event)">
</mat-form-field>
<app-test-sessions></app-test-sessions>
<router-outlet></router-outlet>
</main>
</mat-sidenav-container>
15 changes: 11 additions & 4 deletions openvidu-testapp/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { LogLevel, setLogLevel } from 'livekit-client';
import { LivekitParamsService } from './services/livekit-params.service';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
styleUrls: ['./app.component.css'],
})
export class AppComponent {

livekitUrl = 'ws://localhost:7880/'; // `${window.location.protocol === 'https:' ? 'wss' : 'ws'}://localhost:1880/`;
livekitApiKey = 'devkey';
livekitApiSecret = 'secret';

constructor(private livekitParamsService: LivekitParamsService) { }
constructor(
private router: Router,
private livekitParamsService: LivekitParamsService
) {}

async ngOnInit() {
// LiveKit client logging. Change here to build with verbose logging.
Expand Down Expand Up @@ -44,6 +47,10 @@ export class AppComponent {
if (!(myUrl.substring(myUrl.length - 1) === '/')) {
myUrl += '/';
}
await this.livekitParamsService.updateParams({ livekitUrl: myUrl, livekitApiKey: this.livekitApiKey, livekitApiSecret: this.livekitApiSecret });
await this.livekitParamsService.updateParams({
livekitUrl: myUrl,
livekitApiKey: this.livekitApiKey,
livekitApiSecret: this.livekitApiSecret,
});
}
}
38 changes: 29 additions & 9 deletions openvidu-testapp/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import { BrowserModule } from '@angular/platform-browser';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule } from '@angular/forms';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { MatExpansionModule } from '@angular/material/expansion';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MAT_FORM_FIELD_DEFAULT_OPTIONS, MatFormFieldModule } from '@angular/material/form-field';
import {
MAT_FORM_FIELD_DEFAULT_OPTIONS,
MatFormFieldModule,
} from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatButtonModule } from '@angular/material/button';
Expand All @@ -22,31 +24,43 @@ import { MatDividerModule } from '@angular/material/divider';
import { MatSelectModule } from '@angular/material/select';
import { MatChipsModule } from '@angular/material/chips';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatBadgeModule } from '@angular/material/badge';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatRadioModule } from '@angular/material/radio';

import { TestScenariosComponent } from './components/test-scenarios/test-scenarios.component';
import { TestSessionsComponent } from './components/test-sessions/test-sessions.component';
import { OpenviduInstanceComponent } from './components/openvidu-instance/openvidu-instance.component';
import { VideoTrackComponent } from './components/video-track/video-track.component';
import { ParticipantComponent } from './components/participant/participant.component';
import { AudioTrackComponent } from './components/audio-track/audio-track.component';
import { TrackComponent } from './components/track/track.component';
import { RoomOptionsDialogComponent } from './components/dialogs/room-options-dialog/room-options-dialog.component';
import { RoomApiDialogComponent } from './components/dialogs/room-api-dialog/room-api-dialog.component';
import { OptionsDialogComponent } from './components/dialogs/options-dialog/options-dialog.component';
import { EventsDialogComponent } from './components/dialogs/events-dialog/events-dialog.component';

import { TestFeedService } from './services/test-feed.service';
import { EventsDialogComponent } from './components/dialogs/events-dialog/events-dialog.component';
import { UsersTableComponent } from './components/users-table/users-table.component';
import { TableVideoComponent } from './components/users-table/table-video.component';
import { CallbackPipe } from './pipes/callback.pipe';
import { AppRoutingModule } from './app.routing';

@NgModule({
declarations: [
AppComponent,
TestScenariosComponent,
TestSessionsComponent,
OpenviduInstanceComponent,
ParticipantComponent,
VideoTrackComponent,
AudioTrackComponent,
TrackComponent,
RoomOptionsDialogComponent,
RoomApiDialogComponent,
EventsDialogComponent
EventsDialogComponent,
UsersTableComponent,
TableVideoComponent,
CallbackPipe,
OptionsDialogComponent,
],
imports: [
FormsModule,
Expand All @@ -66,14 +80,20 @@ import { EventsDialogComponent } from './components/dialogs/events-dialog/events
MatTooltipModule,
MatDialogModule,
MatDividerModule,
MatRadioModule,
MatSelectModule,
MatChipsModule,
MatSlideToggleModule,
MatBadgeModule,
MatProgressSpinnerModule,
],
providers: [
TestFeedService,
{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline', subscriptSizing: 'dynamic' } }
{
provide: MAT_FORM_FIELD_DEFAULT_OPTIONS,
useValue: { appearance: 'outline', subscriptSizing: 'dynamic' },
},
],
bootstrap: [AppComponent]
bootstrap: [AppComponent],
})
export class AppModule { }
export class AppModule {}
27 changes: 27 additions & 0 deletions openvidu-testapp/src/app/app.routing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { TestScenariosComponent } from './components/test-scenarios/test-scenarios.component';
import { TestSessionsComponent } from './components/test-sessions/test-sessions.component';

const appRoutes: Routes = [
{
path: '',
redirectTo: '/test-sessions',
pathMatch: 'full',
},
{
path: 'test-sessions',
component: TestSessionsComponent,
},
{
path: 'test-scenarios',
component: TestScenariosComponent,
},
];

@NgModule({
imports: [RouterModule.forRoot(appRoutes, { useHash: true })],
exports: [RouterModule],
})
export class AppRoutingModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
mat-form-field {
margin-top: 10px;
margin-right: 5px;
}

a {
color: #007bff;
cursor: pointer;
}

mat-divider {
margin: 20px 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
<div>
<h2 mat-dialog-title>OPTIONS</h2>
<mat-dialog-content>
<mat-divider *ngIf="roomOptions"></mat-divider>
<div *ngIf="roomOptions">
<label><a href="https://docs.livekit.io/client-sdk-js/interfaces/RoomOptions.html" target="_blank">RoomOptions</a></label><br>
<mat-checkbox id="room-adaptiveStream" [(ngModel)]="roomOptions.adaptiveStream" [style.fontSize.px]="14">adaptiveStream</mat-checkbox>
<mat-checkbox id="room-dynacast" [(ngModel)]="roomOptions.dynacast" [style.fontSize.px]="14">dynacast</mat-checkbox>
<mat-checkbox id="room-disconnectOnPageLeave" [(ngModel)]="roomOptions.disconnectOnPageLeave" [style.fontSize.px]="14">disconnectOnPageLeave</mat-checkbox>
<mat-checkbox id="room-stopLocalTrackOnUnpublish" [(ngModel)]="roomOptions.stopLocalTrackOnUnpublish" [style.fontSize.px]="14">stopLocalTrackOnUnpublish</mat-checkbox>
<mat-checkbox id="room-webAudioMix" [(ngModel)]="roomOptions.webAudioMix" [style.fontSize.px]="14">webAudioMix</mat-checkbox>
</div>
<mat-divider *ngIf="createLocalTracksOptions"></mat-divider>
<div *ngIf="createLocalTracksOptions">
<label class="label">CreateLocalTracksOptions</label>
<div>
<a href="https://docs.livekit.io/client-sdk-js/interfaces/VideoCaptureOptions.html" target="_blank">VideoCaptureOptions</a>
<mat-radio-group [(ngModel)]="videoOption">
<mat-radio-button [value]="true">True (default)</mat-radio-button>
<mat-radio-button [value]="false">False (no video)</mat-radio-button>
<mat-radio-button [value]="'custom'">Custom</mat-radio-button>
</mat-radio-group>
<div *ngIf="videoOption === 'custom'">
<mat-form-field class="inner-text-input" [style.fontSize.px]="14">
<mat-label>deviceId</mat-label>
<input matInput id="video-deviceId" placeholder="deviceId" [(ngModel)]="auxVideoCaptureOptions.deviceId"/>
</mat-form-field>
<mat-form-field id="video-facingMode" [style.fontSize.px]="14">
<mat-label>facingMode</mat-label>
<mat-select [(value)]="auxVideoCaptureOptions.facingMode">
<mat-option *ngFor="let mode of ['user','environment','left','right']" [value]="mode">{{mode}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="inner-text-input" [style.fontSize.px]="14">
<mat-label>aspectRatio</mat-label>
<input matInput id="video-aspectRatio" placeholder="aspectRatio" [(ngModel)]="auxVideoCaptureOptions.resolution!.aspectRatio"/>
</mat-form-field>
<mat-form-field class="inner-text-input" [style.fontSize.px]="14">
<mat-label>frameRate</mat-label>
<input matInput id="video-frameRate" placeholder="frameRate" [(ngModel)]="auxVideoCaptureOptions.resolution!.frameRate"/>
</mat-form-field>
<mat-form-field class="inner-text-input" [style.fontSize.px]="14">
<mat-label>width</mat-label>
<input matInput id="video-width" placeholder="width" [(ngModel)]="auxVideoCaptureOptions.resolution!.width"/>
</mat-form-field>
<mat-form-field class="inner-text-input" [style.fontSize.px]="14">
<mat-label>height</mat-label>
<input matInput id="video-height" placeholder="height" [(ngModel)]="auxVideoCaptureOptions.resolution!.height"/>
</mat-form-field>
</div>
</div>
<div>
<label class="label"><a href="https://docs.livekit.io/client-sdk-js/interfaces/AudioCaptureOptions.html" target="_blank">AudioCaptureOptions</a></label>
<mat-radio-group [(ngModel)]="audioOption">
<mat-radio-button [value]="true">True (default)</mat-radio-button>
<mat-radio-button [value]="false">False (no audio)</mat-radio-button>
<mat-radio-button [value]="'custom'">Custom</mat-radio-button>
</mat-radio-group>
<div *ngIf="audioOption === 'custom'">
<div>
<mat-checkbox id="audio-autoGainControl" [(ngModel)]="auxAudioCaptureOptions.autoGainControl" [style.fontSize.px]="14">autoGainControl</mat-checkbox>
<mat-checkbox id="audio-echoCancellation" [(ngModel)]="auxAudioCaptureOptions.echoCancellation" [style.fontSize.px]="14">echoCancellation</mat-checkbox>
<mat-checkbox id="audio-noiseSuppression" [(ngModel)]="auxAudioCaptureOptions.noiseSuppression" [style.fontSize.px]="14">noiseSuppression</mat-checkbox>
</div>
<mat-form-field class="inner-text-input" [style.fontSize.px]="14">
<mat-label>deviceId</mat-label>
<input matInput id="audio-deviceId" placeholder="deviceId" [(ngModel)]="auxAudioCaptureOptions.deviceId"/>
</mat-form-field>
<mat-form-field class="inner-text-input" [style.fontSize.px]="14">
<mat-label>channelCount</mat-label>
<input matInput id="audio-channelCount" type="number" placeholder="channelCount" [(ngModel)]="auxAudioCaptureOptions.channelCount"/>
</mat-form-field>
<mat-form-field class="inner-text-input" [style.fontSize.px]="14">
<mat-label>latency</mat-label>
<input matInput id="audio-latency" type="number" placeholder="latency" [(ngModel)]="auxAudioCaptureOptions.latency"/>
</mat-form-field>
<mat-form-field class="inner-text-input" [style.fontSize.px]="14">
<mat-label>sampleRate</mat-label>
<input matInput id="audio-sampleRate" type="number" placeholder="sampleRate" [(ngModel)]="auxAudioCaptureOptions.sampleRate"/>
</mat-form-field>
<mat-form-field class="inner-text-input" [style.fontSize.px]="14">
<mat-label>sampleSize</mat-label>
<input matInput id="audio-sampleSize" type="number" placeholder="sampleSize" [(ngModel)]="auxAudioCaptureOptions.sampleSize"/>
</mat-form-field>
</div>
</div>
</div>
<mat-divider *ngIf="shareScreen"></mat-divider>
<div *ngIf="shareScreen">
<label><a href="https://docs.livekit.io/client-sdk-js/interfaces/ScreenShareCaptureOptions.html" target="_blank">ScreenShareCaptureOptions</a></label><br>
<mat-radio-group [(ngModel)]="screenOption" (change)="screenOptionChanged($event)">
<mat-radio-button [value]="true">True (default)</mat-radio-button>
<mat-radio-button [value]="false">False (no screen)</mat-radio-button>
<mat-radio-button [value]="'custom'">Custom</mat-radio-button>
</mat-radio-group>
<div *ngIf="screenOption == 'custom'">
<mat-checkbox id="screenShare-video" [(ngModel)]="screenShareCaptureOptions!.video" [style.fontSize.px]="14">video</mat-checkbox>
<mat-form-field *ngIf="screenShareCaptureOptions!.video" id="screenShare-displaySurface">
<mat-label>displaySurface</mat-label>
<mat-select [(value)]="auxScreenDisplaySurface">
<mat-option *ngFor="let surface of ['NONE','window','browser','monitor']" [value]="surface">{{surface}}</mat-option>
</mat-select>
</mat-form-field>
<mat-checkbox id="screenShare-audio" [(ngModel)]="screenShareCaptureOptions!.audio" [style.fontSize.px]="14">audio</mat-checkbox>
<mat-checkbox id="screenShare-preferCurrentTab" [(ngModel)]="screenShareCaptureOptions!.preferCurrentTab" [style.fontSize.px]="14">preferCurrentTab</mat-checkbox>
<mat-checkbox id="screenShare-suppressLocalAudioPlayback" [(ngModel)]="screenShareCaptureOptions!.suppressLocalAudioPlayback" [style.fontSize.px]="14">suppressLocalAudioPlayback</mat-checkbox>
<mat-form-field id="screenShare-contentHint">
<mat-label>contentHint</mat-label>
<mat-select [(value)]="screenShareCaptureOptions!.contentHint">
<mat-option *ngFor="let hint of ['text','detail','motion']" [value]="hint">{{hint}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field id="screenShare-selfBrowserSurface">
<mat-label>selfBrowserSurface</mat-label>
<mat-select [(value)]="screenShareCaptureOptions!.selfBrowserSurface">
<mat-option *ngFor="let surface of ['include','exclude']" [value]="surface">{{surface}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field id="screenShare-surfaceSwitching">
<mat-label>surfaceSwitching</mat-label>
<mat-select [(value)]="screenShareCaptureOptions!.surfaceSwitching">
<mat-option *ngFor="let surface of ['include','exclude']" [value]="surface">{{surface}}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field id="screenShare-systemAudio">
<mat-label>systemAudio</mat-label>
<mat-select [(value)]="screenShareCaptureOptions!.systemAudio">
<mat-option *ngFor="let audio of ['include','exclude']" [value]="audio">{{audio}}</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
<mat-divider *ngIf="trackPublishOptions"></mat-divider>
<div *ngIf="trackPublishOptions">
<label><a href="https://docs.livekit.io/client-sdk-js/interfaces/TrackPublishOptions.html" target="_blank">TrackPublishOptions</a></label><br>
<mat-checkbox id="trackPublish-backupCodec" [(ngModel)]="trackPublishOptions.backupCodec" [style.fontSize.px]="14">backupCodec</mat-checkbox>
<mat-checkbox id="trackPublish-dtx" [(ngModel)]="trackPublishOptions.dtx" [style.fontSize.px]="14">dtx</mat-checkbox>
<mat-checkbox id="trackPublish-forceStereo" [(ngModel)]="trackPublishOptions.forceStereo" [style.fontSize.px]="14">forceStereo</mat-checkbox>
<mat-form-field class="inner-text" [style.fontSize.px]="14">
<mat-label>name</mat-label>
<input matInput id="trackPublish-name" placeholder="name" [(ngModel)]="trackPublishOptions.name"/>
</mat-form-field>
<mat-checkbox id="trackPublish-red" [(ngModel)]="trackPublishOptions.red" [style.fontSize.px]="14">red</mat-checkbox>
<mat-form-field id="trackPublish-scalabilityMode" [style.fontSize.px]="14">
<mat-label>scalabilityMode</mat-label>
<mat-select [(value)]="trackPublishOptions.scalabilityMode">
<mat-option *ngFor="let mode of ['L1T1','L1T2','L1T3','L2T1','L2T1h','L2T1_KEY','L2T2','L2T2h','L2T2_KEY','L2T3','L2T3h','L2T3_KEY','L3T1','L3T1h','L3T1_KEY','L3T2','L3T2h','L3T2_KEY','L3T3','L3T3h','L3T3_KEY']" [value]="mode">{{mode}}</mat-option>
</mat-select>
</mat-form-field>
<mat-checkbox id="trackPublish-simulcast" [(ngModel)]="trackPublishOptions.simulcast" [style.fontSize.px]="14">simulcast</mat-checkbox>
<mat-form-field id="trackPublish-source" [style.fontSize.px]="14">
<mat-label>source</mat-label>
<mat-select [(value)]="trackPublishOptions.source">
<mat-option *ngFor="let source of ENUMERATION_SOURCE" [value]="source">{{source}}</mat-option>
</mat-select>
</mat-form-field>
<mat-checkbox id="trackPublish-stopMicTrackOnMute" [(ngModel)]="trackPublishOptions.stopMicTrackOnMute" [style.fontSize.px]="14">stopMicTrackOnMute</mat-checkbox>
<mat-form-field id="trackPublish-stream" [style.fontSize.px]="14">
<mat-label>stream</mat-label>
<input matInput id="trackPublish-stream" placeholder="stream" [(ngModel)]="trackPublishOptions.stream"/>
</mat-form-field>
<mat-form-field id="trackPublish-videoCodec" [style.fontSize.px]="14">
<mat-label>videoCodec</mat-label>
<mat-select [(value)]="trackPublishOptions.videoCodec">
<mat-option *ngFor="let codec of ['vp8','h264','vp9','av1']" [value]="codec">{{codec}}</mat-option>
</mat-select>
</mat-form-field>
</div>
</mat-dialog-content>

<mat-dialog-actions>
<button mat-button id="cancel-dialog-btn" (click)="dialogRef.close()">
CANCEL
</button>
<button mat-button id="close-dialog-btn" (click)="returnValues()">
SAVE
</button>
</mat-dialog-actions>
</div>
Loading

0 comments on commit 7e7b6d2

Please sign in to comment.