mirror of https://github.com/OpenVidu/openvidu.git
openvidu-components: Updated testapp
parent
421869d48e
commit
8d4584dd79
|
@ -44,7 +44,7 @@
|
|||
<div id="testing-app">
|
||||
|
||||
<h2>Testing APP</h2>
|
||||
<p>App for testing openvidu-angular</p>
|
||||
<p>App for automated testing of openvidu-angular</p>
|
||||
|
||||
<input type="hidden" #selection />
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Component, OnInit } from '@angular/core';
|
||||
import { RecordingInfo, TokenModel } from 'openvidu-angular';
|
||||
import { BroadcastingService, BroadcastingStatus, RecordingInfo, RecordingService, RecordingStatus, TokenModel } from 'openvidu-angular';
|
||||
import { RestService } from '../services/rest.service';
|
||||
|
||||
@Component({
|
||||
|
@ -18,7 +18,11 @@ export class CallComponent implements OnInit {
|
|||
recordingError: any;
|
||||
broadcastingError: any;
|
||||
|
||||
constructor(private restService: RestService) {}
|
||||
constructor(
|
||||
private restService: RestService,
|
||||
private recordingService: RecordingService,
|
||||
private broadcastingService: BroadcastingService
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
await this.requestForTokens();
|
||||
|
@ -134,12 +138,15 @@ export class CallComponent implements OnInit {
|
|||
}
|
||||
|
||||
private async requestForTokens() {
|
||||
const response = await this.restService.getTokensFromBackend(this.sessionId);
|
||||
this.recordingList = response.recordings;
|
||||
const { broadcastingEnabled, recordingEnabled, recordings, cameraToken, screenToken, isRecordingActive, isBroadcastingActive } =
|
||||
await this.restService.getTokensFromBackend(this.sessionId);
|
||||
this.recordingList = recordings;
|
||||
this.tokens = {
|
||||
webcam: response.cameraToken,
|
||||
screen: response.screenToken
|
||||
webcam: cameraToken,
|
||||
screen: screenToken
|
||||
};
|
||||
if (isRecordingActive) this.recordingService.updateStatus(RecordingStatus.STARTED);
|
||||
if (isBroadcastingActive) this.broadcastingService.updateStatus(BroadcastingStatus.STARTED);
|
||||
|
||||
console.log('Token requested: ', this.tokens);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,17 @@ import { RecordingInfo } from 'openvidu-angular';
|
|||
import { catchError, lastValueFrom } from 'rxjs';
|
||||
import { throwError as observableThrowError } from 'rxjs/internal/observable/throwError';
|
||||
|
||||
interface SessionResponse {
|
||||
cameraToken: string;
|
||||
screenToken: string;
|
||||
recordingEnabled: boolean;
|
||||
isRecordingActive: boolean;
|
||||
recordings?: RecordingInfo[];
|
||||
broadcastingEnabled: boolean;
|
||||
isBroadcastingActive: boolean;
|
||||
}
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
@ -19,7 +30,7 @@ export class RestService {
|
|||
return await this.createToken(_sessionId, openviduServerUrl, openviduSecret);
|
||||
}
|
||||
}
|
||||
async getTokensFromBackend(sessionId: string): Promise<{ cameraToken: string; screenToken: string; recordings?: RecordingInfo[] }> {
|
||||
async getTokensFromBackend(sessionId: string): Promise<SessionResponse> {
|
||||
try {
|
||||
return lastValueFrom(this.http.post<any>(this.baseHref + 'sessions', { sessionId }));
|
||||
} catch (error) {
|
||||
|
|
Loading…
Reference in New Issue