Recording
The Recording module allows you to create and schedule Recordings.
Instant recording
Think of this as pressing the "REC" button. First you need to have a Stream playing. Then call startRecording to immediately create a Recording of whatever is playing. Finaly call stopRecording.
Scheduled recording
You can use Schedules to plan a Recording ahead of time. There are two ways to specify a future time at which to record:
-
Absolute Time: You can schedule a recording by specifying which Channel you wish to record, at what time to start, and when to stop.
-
EPG Events: You can schedule a recording by specifying an EPG Event that you wish to record. EPG events contain information about which channel they are on and at what time. If EPG information changes, and the event is moved in time, then the Recording is also rescheduled.
You can also set the Schedule to repeat. Absolute Time Recordings can be made daily or weekly, by specifying on which Days they shold repeat. EPG Event Recordings can be set to repeat using the Event's series link information, if it is available.
In all cases you must first create and populate a Schedule object, then pass it to the setSchedule function. When a Schedule is no more needed, call clearSchedule to delete it.
Playback
Once a Recording is finished you can use the Playback module to play it. Call getRecordingsList to get a list of all completed Recordings.
Members
Days :number
Enum for the days of the week. These values are passed in an Array to the days property of the Schedule object.
Type.
- number
Properties:
| Name | Type | Description |
|---|---|---|
MONDAY | number | Monday |
TUESDAY | number | Tuesday |
WEDNESDAY | number | Wednesday |
THURSDAY | number | Thursday |
FRIDAY | number | Friday |
SATURDAY | number | Saturday |
SUNDAY | number | Sunday |
onRecordingError
Signal fired when a Recording enters an error state. The listener will be passed the following arguments:
- mrl: The Recording mrl that produced this Signal.
- error: The triggered error code of the Recording.
onRecordingStatusChanged
Signal fired when a Recording's status changes. The listener will be passed the following arguments:
- mrl: The Recording mrl that produced this Signal.
- newStatus: The Recording's new RecordingStatus.
- oldStatus: The Recording's former RecordingStatus.
RecordingError :number
Enum for the Recording errors.
Type.
- number
Properties:
| Name | Type | Description |
|---|---|---|
NONE | number | No Error |
GENERIC | number | Generic Error |
NO_SPACE | number | Not available space in disk drive |
PERMISSION_DENIED | number | Permission Denied |
OPEN_FILE | number | Open file error |
WRITE | number | File write error |
NO_SUCH_FILE_OR_DIRECTORY | number | File or directory does not exist |
RecordingStatus :number
Enum for the Recording status.
Type.
- number
Properties:
| Name | Type | Description |
|---|---|---|
NEW | number | New |
ACTIVE | number | Active |
FINISHED | number | Finished |
INCOMPLETE | number | Incomplete |
CORRUPTED | number | Corrupted |
UNKNOWN | number | Unknown |
Methods
activateSchedule(schedule_id)
Set a Schedule as active.
Parameters:
| Name | Type | Description |
|---|---|---|
schedule_id | ID | The ID of the Schedule to be activated. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
addSchedule(schedule)
Schedule one or more recordings by passing a Schedule.
Parameters:
| Name | Type | Description |
|---|---|---|
schedule | Schedule | The filled out Schedule object. |
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - id: A unique id that is mapped to the schedule. |
deactivateSchedule(schedule_id)
Set a Schedule as inactive.
Parameters:
| Name | Type | Description |
|---|---|---|
schedule_id | ID | The ID of the Schedule to be deactivated. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
getRecordingInfo(mrl)
Get a Recording's information.
Parameters:
| Name | Type | Description |
|---|---|---|
mrl | MRL | The MRL of the Recording. |
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: -recording: A Recording object. |
getRecordingsList()
Get all Recordings.
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: -recordings: An array of Recording objects. |
getSchedulesList()
Get all the Schedules that have been set.
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: -schedules: An array of Schedule objects. |
removeRecording(mrl)
Delete a Recording.
Parameters:
| Name | Type | Description |
|---|---|---|
mrl | MRL | The MRL of the Recording. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
removeSchedule(schedule_id)
Cancel a Schedule that has previously been set.
Parameters:
| Name | Type | Description |
|---|---|---|
schedule_id | ID | The ID of the Schedule to be canceled. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
startRecording(source, metadata)
Start an immediate Recording.
Parameters:
| Name | Type | Description |
|---|---|---|
source | MRL | The source mrl from which we wish to record. |
metadata | String | An optional string with metadata we may wish to keep related to the recording. |
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: -mrl: The virtual mrl that is mapped to the recording. |
stopRecording(mrl)
Stop an immediate Recording.
Parameters:
| Name | Type | Description |
|---|---|---|
mrl | MRL | The recording mrl of the Recording to be stopped. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
Type Definitions
Recording
This structure represents a Recording. The schedule property will only be set if the Recording was created using a Schedule.
Type:
- Object
Properties:
| Name | Type | Description |
|---|---|---|
mrl | MRL | The MRL of the Recording. |
metadata | String | Custom information associated with the recording. |
timeStart | Timestamp | When the Recording was started. |
timeEnd | Timestamp | When the Recording was stopped. |
schedule | Schedule | The Schedule that created this Recording. |
Schedule
This structure represents a Schedule. Either the event property must be present or the 3 properties mrl, from, and to must be present to specify what is to be recorded. Either the days or the series properties may be present to make this a repeating Schedule. The location property may be set to specify the MRL of a folder inside an external Drive where the completed Recording(s) will be saved.
Type:
- Object
Properties:
| Name | Type | Description |
|---|---|---|
id | Number | The ID of this Schedule. |
source | MRL | The MRL of the stream to be recorded. |
active | Boolean | If this Schedule is active or deactivated. |
from | Timestamp | When the Recording should start. |
to | Timestamp | When the Recording should stop. |
event | Event | The EPG Event to be recorded. |
days | Array | An array of days of the week on which the Schedule schould repeat. |
series | Boolean | A flag indicating that series link information schould be used for repeat recording. |
metadata | String | Custom information to associate with the recording. |