openvidu-call: Updated recording feature
This commit is contained in:
parent
8ebb6cc22e
commit
ce469bff96
@ -24,7 +24,6 @@ app.get('/', async (req: Request, res: Response) => {
|
||||
const date = openviduService.getDateFromCookie(req.cookies);
|
||||
recordings = await openviduService.listRecordingsBySessionIdAndDate(sessionId, date);
|
||||
}
|
||||
console.log('a', recordings)
|
||||
res.status(200).send(JSON.stringify(recordings));
|
||||
} else {
|
||||
const message = IS_RECORDING_ENABLED ? 'Permissions denied to drive recording' : 'Recording is disabled';
|
||||
@ -107,13 +106,13 @@ app.delete('/delete/:recordingId', async (req: Request, res: Response) => {
|
||||
const isAdminDashboard = openviduService.adminTokens.includes(req['session'].token);
|
||||
let recordings = [];
|
||||
if ((!!sessionId && openviduService.isValidToken(sessionId, req.cookies)) || isAdminDashboard) {
|
||||
console.log('DELETE RECORDING');
|
||||
const recordingId: string = req.params.recordingId;
|
||||
if (!recordingId) {
|
||||
return res.status(400).send('Missing recording id parameter.');
|
||||
}
|
||||
console.log(`Deleting recording ${recordingId}`);
|
||||
await openviduService.deleteRecording(recordingId);
|
||||
if (isAdminDashboard) {
|
||||
if (isAdminDashboard && !!req['session']) {
|
||||
recordings = await openviduService.listAllRecordings(true);
|
||||
} else {
|
||||
const date = openviduService.getDateFromCookie(req.cookies);
|
||||
@ -152,6 +151,7 @@ export const proxyGETRecording = createProxyMiddleware({
|
||||
if (!recordingId) {
|
||||
return res.status(400).send(JSON.stringify({ message: 'Missing recording id parameter.' }));
|
||||
} else {
|
||||
proxyReq.setHeader('Connection', 'keep-alive');
|
||||
proxyReq.setHeader('Authorization', openviduService.getBasicAuth());
|
||||
proxyReq.setHeader('Range', 'bytes=0-');
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ app.post('/', async (req: Request, res: Response) => {
|
||||
const hasValidToken = openviduService.isValidToken(sessionId, req.cookies);
|
||||
const isSessionCreator = hasValidToken || sessionCreated.activeConnections.length === 0;
|
||||
const role: OpenViduRole = isSessionCreator && IS_RECORDING_ENABLED ? OpenViduRole.MODERATOR : OpenViduRole.PUBLISHER;
|
||||
const response = {cameraToken : '', screenToken: '', recording: IS_RECORDING_ENABLED};
|
||||
const response = {cameraToken : '', screenToken: '', recordingEnabled: IS_RECORDING_ENABLED};
|
||||
const cameraConnection = await openviduService.createConnection(sessionCreated, nickname, role);
|
||||
const screenConnection = await openviduService.createConnection(sessionCreated, nickname, role);
|
||||
response.cameraToken = cameraConnection.token;
|
||||
|
||||
@ -41,6 +41,7 @@ export class OpenViduService {
|
||||
const cookieTokenUrl = new URL(cookies[this.RECORDING_TOKEN_NAME]);
|
||||
return cookieTokenUrl?.searchParams.get('sessionId');
|
||||
} catch (error) {
|
||||
console.log('Recording cookie not found');
|
||||
console.error(error);
|
||||
return '';
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
"copy:backend-prod": "mkdir -p ../openvidu-call-back/dist/public && cp -a dist/openvidu-call/. ../openvidu-call-back/dist/public/",
|
||||
"e2e": "ng e2e",
|
||||
"lint": "ng lint",
|
||||
"start": "ng serve --configuration development",
|
||||
"start": "ng serve --ssl --configuration development",
|
||||
"start:https": "ng serve --host 192.168.1.161 --ssl --ssl-key cert.key --ssl-cert cert.crt",
|
||||
"test": "ng test openvidu-call --watch=false --code-coverage"
|
||||
},
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
[recordingsList]="recordings"
|
||||
(onLogoutClicked)="onLogoutClicked()"
|
||||
(onRefreshRecordingsClicked)="onRefreshRecordingsClicked()"
|
||||
(onPlayRecordingClicked)="onPlayRecordingClicked($event)"
|
||||
(onDownloadRecordingClicked)="onDownloadRecordingClicked($event)"
|
||||
(onDeleteRecordingClicked)="onDeleteRecordingClicked($event)"
|
||||
></ov-admin-dashboard>
|
||||
|
||||
@ -15,6 +15,10 @@ export class AdminDashboardComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.onLogoutClicked();
|
||||
}
|
||||
|
||||
async onLoginClicked(pass: string) {
|
||||
try {
|
||||
const resp: any = await this.restService.login(pass);
|
||||
@ -54,13 +58,4 @@ export class AdminDashboardComponent implements OnInit {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
async onPlayRecordingClicked(recordingId: string) {
|
||||
try {
|
||||
const file: Blob = await this.restService.downloadRecording(recordingId);
|
||||
this.recordingService.playRecording(file);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
(onActivitiesPanelStopRecordingClicked)="onStopRecordingClicked()"
|
||||
(onActivitiesPanelDownloadRecordingClicked)="onDownloadRecordingClicked($event)"
|
||||
(onActivitiesPanelDeleteRecordingClicked)="onDeleteRecordingClicked($event)"
|
||||
(onActivitiesPanelPlayRecordingClicked)="onPlayRecordingClicked($event)"
|
||||
[activitiesPanelRecordingActivity]="recordingEnabled"
|
||||
[toolbarRecordingButton]="recordingEnabled"
|
||||
>
|
||||
</ov-videoconference>
|
||||
|
||||
@ -15,8 +15,8 @@ export class CallComponent implements OnInit {
|
||||
joinSessionClicked: boolean = false;
|
||||
closeClicked: boolean = false;
|
||||
isSessionAlive: boolean = false;
|
||||
recordingEnabled: boolean = true;
|
||||
recordingList: RecordingInfo[] = [];
|
||||
|
||||
recordingError: any;
|
||||
|
||||
constructor(
|
||||
@ -42,6 +42,7 @@ export class CallComponent implements OnInit {
|
||||
}
|
||||
|
||||
const response = await this.restService.getTokens(this.sessionId, nickname);
|
||||
this.recordingEnabled = response.recordingEnabled;
|
||||
this.recordingList = response.recordings;
|
||||
this.tokens = {
|
||||
webcam: response.cameraToken,
|
||||
@ -84,13 +85,4 @@ export class CallComponent implements OnInit {
|
||||
this.recordingError = error;
|
||||
}
|
||||
}
|
||||
|
||||
async onPlayRecordingClicked(recordingId: string) {
|
||||
try {
|
||||
const recording: Blob = await this.restService.downloadRecording(recordingId);
|
||||
this.recordingService.playRecording(recording);
|
||||
} catch (error) {
|
||||
this.recordingError = error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ export class RestService {
|
||||
async getTokens(
|
||||
sessionId: string,
|
||||
nickname?: string
|
||||
): Promise<{ cameraToken: string; screenToken: string; recordings?: RecordingInfo[] }> {
|
||||
): Promise<{ cameraToken: string; screenToken: string, recordingEnabled: boolean, recordings?: RecordingInfo[] }> {
|
||||
return this.postRequest('sessions', { sessionId, nickname });
|
||||
}
|
||||
login(password: string): Promise<any[]> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user