2018-04-18 14:29:07 +02:00
|
|
|
/*
|
2018-05-06 02:20:25 +02:00
|
|
|
* (C) Copyright 2017-2018 OpenVidu (https://openvidu.io/)
|
2018-04-18 14:29:07 +02:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-01-18 20:59:27 +01:00
|
|
|
import { RecordingProperties } from './RecordingProperties';
|
2018-04-23 11:06:16 +02:00
|
|
|
import { RecordingLayout } from './RecordingLayout';
|
2018-04-20 12:04:56 +02:00
|
|
|
|
2018-07-22 22:13:45 +02:00
|
|
|
/**
|
|
|
|
* See [[OpenVidu.startRecording]]
|
|
|
|
*/
|
2018-04-18 10:39:39 +02:00
|
|
|
export class Recording {
|
2018-03-14 18:48:29 +01:00
|
|
|
|
2018-04-24 15:42:23 +02:00
|
|
|
/**
|
|
|
|
* Recording unique identifier
|
|
|
|
*/
|
|
|
|
id: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Session associated to the recording
|
|
|
|
*/
|
|
|
|
sessionId: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Time when the recording started in UTC milliseconds
|
|
|
|
*/
|
|
|
|
createdAt: number;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Size of the recording in bytes (0 until the recording is stopped)
|
|
|
|
*/
|
|
|
|
size = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Duration of the recording in seconds (0 until the recording is stopped)
|
|
|
|
*/
|
|
|
|
duration = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* URL of the recording. You can access the file from there. It is `null` until recording is stopped or if OpenVidu Server configuration property `openvidu.recording.public-access` is false
|
|
|
|
*/
|
|
|
|
url: string;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Status of the recording
|
|
|
|
*/
|
|
|
|
status: Recording.Status;
|
|
|
|
|
|
|
|
/**
|
2019-01-18 20:59:27 +01:00
|
|
|
* Technical properties of the recorded file
|
2018-04-24 15:42:23 +02:00
|
|
|
*/
|
2019-01-18 20:59:27 +01:00
|
|
|
properties: RecordingProperties;
|
2018-04-24 15:42:23 +02:00
|
|
|
|
2018-03-14 18:48:29 +01:00
|
|
|
|
2018-04-23 11:06:16 +02:00
|
|
|
/* tslint:disable:no-string-literal */
|
2018-07-22 22:13:45 +02:00
|
|
|
/**
|
|
|
|
* @hidden
|
|
|
|
*/
|
2018-03-14 18:48:29 +01:00
|
|
|
constructor(json: JSON) {
|
|
|
|
this.id = json['id'];
|
|
|
|
this.sessionId = json['sessionId'];
|
|
|
|
this.createdAt = json['createdAt'];
|
|
|
|
this.size = json['size'];
|
|
|
|
this.duration = json['duration'];
|
|
|
|
this.url = json['url'];
|
|
|
|
this.status = json['status'];
|
2019-01-18 20:59:27 +01:00
|
|
|
this.properties = {
|
|
|
|
name: !!(json['name']) ? json['name'] : this.id,
|
|
|
|
outputMode: !!(json['outputMode']) ? json['outputMode'] : Recording.OutputMode.COMPOSED,
|
|
|
|
hasAudio: !!(json['hasAudio']),
|
|
|
|
hasVideo: !!json['hasVideo']
|
|
|
|
};
|
|
|
|
if (this.properties.outputMode.toString() === Recording.OutputMode[Recording.OutputMode.COMPOSED]) {
|
|
|
|
this.properties.recordingLayout = !!(json['recordingLayout']) ? json['recordingLayout'] : RecordingLayout.BEST_FIT;
|
|
|
|
if (this.properties.recordingLayout.toString() === RecordingLayout[RecordingLayout.CUSTOM]) {
|
|
|
|
this.properties.customLayout = json['customLayout'];
|
|
|
|
}
|
|
|
|
}
|
2018-03-14 18:48:29 +01:00
|
|
|
}
|
2018-04-23 11:06:16 +02:00
|
|
|
/* tslint:enable:no-string-literal */
|
2018-03-14 18:48:29 +01:00
|
|
|
}
|
|
|
|
|
2018-04-18 10:39:39 +02:00
|
|
|
export namespace Recording {
|
2018-07-22 22:13:45 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* See [[Recording.status]]
|
|
|
|
*/
|
2018-03-14 18:48:29 +01:00
|
|
|
export enum Status {
|
2018-04-25 11:03:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The recording is starting (cannot be stopped)
|
|
|
|
*/
|
2019-01-20 18:13:34 +01:00
|
|
|
starting = 'starting',
|
2018-04-25 11:03:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The recording has started and is going on
|
|
|
|
*/
|
2019-01-20 18:13:34 +01:00
|
|
|
started = 'started',
|
2018-04-25 11:03:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The recording has finished OK
|
|
|
|
*/
|
2019-01-20 18:13:34 +01:00
|
|
|
stopped = 'stopped',
|
2018-04-25 11:03:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The recording is available for downloading. This status is reached for all
|
2018-05-06 02:20:25 +02:00
|
|
|
* stopped recordings if [OpenVidu Server configuration](https://openvidu.io/docs/reference-docs/openvidu-server-params/)
|
2018-07-22 22:13:45 +02:00
|
|
|
* property `openvidu.recording.public-access` is true
|
2018-04-25 11:03:30 +02:00
|
|
|
*/
|
2019-01-20 18:13:34 +01:00
|
|
|
available = 'available',
|
2018-04-25 11:03:30 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The recording has failed
|
|
|
|
*/
|
2019-01-20 18:13:34 +01:00
|
|
|
failed = 'failed'
|
2018-03-14 18:48:29 +01:00
|
|
|
}
|
2019-01-18 20:59:27 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* See [[RecordingProperties.outputMode]]
|
|
|
|
*/
|
|
|
|
export enum OutputMode {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Record all streams in a grid layout in a single archive
|
|
|
|
*/
|
2019-01-20 18:13:34 +01:00
|
|
|
COMPOSED = 'COMPOSED',
|
2019-01-18 20:59:27 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Record each stream individually
|
|
|
|
*/
|
2019-01-20 18:13:34 +01:00
|
|
|
INDIVIDUAL = 'INDIVIDUAL'
|
2019-01-18 20:59:27 +01:00
|
|
|
}
|
2018-03-14 18:48:29 +01:00
|
|
|
}
|