ToiMediaRecorder Interface Reference
Description
The ToiMediaRecorder interface is the access point for a media recorder. Access to this interface is acquired through the ToiMediaService::createRecorderInstance() function. It is possible to create multiple private media recorder instances. Each application gets its own private instance of this interface for each of its media recorder instances.
- See also:
- ToiMediaRecorderBase
-
ToiMediaService
import "ToiMediaRecorder.idl";
List of all members.
Public Member Functions |
void | open (in string url, in string assetId) raises (TToiSessionViolationException, TToiInvalidArgumentException, TToiBusyException, TToiUnavailableException, TToiInvalidPreconditionException) |
void | close () raises (TToiSessionViolationException) |
void | record () raises (TToiSessionViolationException, TToiOperationNotSupportedException) |
void | recordAt (in unsigned long offset) raises (TToiSessionViolationException, TToiOperationNotSupportedException) |
void | setParameter (in string name, in string value) raises (TToiInvalidArgumentException, TToiPermissionDeniedException) |
void | unsetParameter (in string name) raises (TToiInvalidArgumentException, TToiPermissionDeniedException) |
TToiMediaRecorderState | getState () |
ToiMediaSession::TToiSessionId | getSessionId () raises (TToiSessionViolationException) |
string | getUrl () raises (TToiSessionViolationException) |
string | getAssetId () raises (TToiSessionViolationException) |
string | getParameter (in string name) raises (TToiInvalidArgumentException) |
void | subscribeParameter (in ToiEventListener eventListener, in string name) raises (TToiInvalidArgumentException) |
void | unsubscribeParameter (in ToiEventListener eventListener, in string name) raises (TToiInvalidArgumentException) |
void | releaseInstance () |
void | addEventListener (in long type, in ToiEventListener listener) raises (TToiInvalidArgumentException) |
void | removeEventListener (in long type, in ToiEventListener listener) raises (TToiInvalidArgumentException) |
Public Attributes |
|
|
const long | ON_STATE_CHANGED = 1800 |
const long | ON_PARAMETER_CHANGED = 1801 |
|
|
const TToiMediaRecorderState | STATE_IDLE = 0 |
const TToiMediaRecorderState | STATE_CONNECTING = 1 |
const TToiMediaRecorderState | STATE_PAUSED = 2 |
const TToiMediaRecorderState | STATE_RECORDING = 3 |
const TToiMediaRecorderState | STATE_FAILED = 4 |
Public Types |
typedef long | TToiMediaRecorderState |
Member Typedef Documentation
State identifier used to identify the media recorder state.
Member Function Documentation
This method registers an event listener for a specific event. Multiple listeners can be added for the same event. Events are broadcast to all registered listeners.
- Parameters:
-
| type | The event type of the event to subscribe to. |
| listener | The JavaScript function that will receive events. |
- Exceptions:
-
| TInvalidArgumentException | Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the application calls addEventListener with the same combination of type and listener twice. |
Returns the asset used for recording.
- Return values:
-
| assetId | The asset identifier. |
- Exceptions:
-
Returns the session identifier. This identifier can be used to open a session object with (C++) ToiMediaService::OpenSession().
- Return values:
-
| id | The session identifier. |
- Exceptions:
-
- See also:
- ToiMediaService::openSession()
Returns the current state of the media recorder instance.
- Return values:
-
| state | The current recorder state. |
Returns the URL for the media stream.
- Return values:
-
| url | The URL for the media stream. |
- Exceptions:
-
This function starts a new recording session by trying to establish a connection to a media source. If this function returns successfully, the recorder state has changed to STATE_CONNECTING. If an exception is raised, the recorder state is unaffected.
Depending on the success of the connection attempt to the media source, the recorder will make a second state transition to either STATE_PAUSED or STATE_FAILED, on success and failure, respectively. In any respect, the application will be notified about this event by a call to its ToiMediaRecorderStateChangedEvent function.
The application ends the session by calling ToiMediaRecorder::close(), which makes the recorder change state to STATE_IDLE.
- Parameters:
-
| url | The URL identifying the media source. The URL string may contain additional parameter information in accordance to the extended URL format. |
| assetId | Identifies the asset to record to. |
- Exceptions:
-
- See also:
- ToiMediaRecorder::close()
-
TToiMediaRecorderState
This function starts a recording of the stream. If this function returns successfully, the recorder state has changed to STATE_RECORDING. If an exception is raised, the recorder state is unaffected.
- Exceptions:
-
- See also:
- TToiMediaRecorderState
- Technical Preview:
- This method is a TECHNICAL PREVIEW, it may change. This function starts a new recording session and may reuse existing recorded content from another ongoing recording session, including a possible timeshift session, sharing the same source.
Depending on the success of the connection attempt to the media source, the recorder will change state to STATE_RECORDING. If something goes wrong it will end up in state STATE_FAILED. In any respect, the application will be notified about those state transistions by calls to its ToiMediaRecorderStateChangedEvent function.
- Parameters:
-
| offset | The offset (in milliseconds) relative to the current position, i.e. a value of 1000 means that one second back in time will be reused. If the specified offset time is not available less data than requested will be given. |
- Exceptions:
-
- See also:
- ToiMediaRecorder::close()
-
TToiMediaRecorderState
void ToiMediaRecorderBase::releaseInstance |
( |
|
) |
[inherited] |
This function releases the resources used by this instance. When this function returns all observers has also been released.
This method removes an event listener for a specific event.
- Parameters:
-
| type | The event type of the event to remove the listener from. |
| listener | The JavaScript function that was previously added as an event listener. |
- Exceptions:
-
| TInvalidArgumentException | Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the listener had not previously been added. |
This function sets the value of a parameter. Depending on the current state, the new value is used differently. If the function is called when in idle state, the new value is used for all sessions started after the parameter is set. If the function is called in any other state but the idle state, the new value is applied to that session only and is discarded automatically when the session ends.
- Parameters:
-
| name | The name of the parameter to set. |
| value | The value to set the parameter to. |
- Exceptions:
-
- See also:
- ToiMediaRecorder::unsetParameter()
-
ToiMediaRecorder::getParameter()
This function makes the application subscribe to updates of a specific named parameter. When the subscription is made there will be an immediate call to (C++) ToiMediaRecorderObserver::OnParameterChanged() if there is a value available.
- Parameters:
-
| eventListener | ToiEventListener |
| name | The name of the parameter for which changes the application wants to subscribe to. |
- Exceptions:
-
- See also:
- ToiMediaRecorderBase::unsubscribeParameter()
This function restores the value of a parameter to the default. Depending on the current state, the new value is used differently. If the function is called when in idle state, all sessions started after the parameter is restored will use the default value. If the function is called in any other state but the idle state, the value is changed for that session only.
- Parameters:
-
| name | The name of the parameter for which the value is to be restored to the default. |
- Exceptions:
-
- See also:
- ToiMediaRecorder::setParameter()
-
ToiMediaRecorder::getParameter()
Member Data Documentation
In STATE_CONNECTING the media recorder has an active session and is in the process of establishing a connection to a media stream source.
This constant can also be accessed from toi.consts.ToiMediaRecorderBase.STATE_CONNECTING.
In STATE_FAILED the media recorder may or may not have a connection to a media source but the process of getting the stream from that source has failed in some fatal way.
This constant can also be accessed from toi.consts.ToiMediaRecorderBase.STATE_FAILED.
In STATE_IDLE there is no active session. The media recorder does not handle a stream, and consequently has no connection to a media stream source. All functions requiring a session will raise a TToiSessionViolationException in STATE_IDLE.
This constant can also be accessed from toi.consts.ToiMediaRecorderBase.STATE_IDLE.
In STATE_PAUSED the media recorder has a connection to a media source but is not yet recording the stream.
This constant can also be accessed from toi.consts.ToiMediaRecorderBase.STATE_PAUSED.
In STATE_RECORDING the media recorder has a connection to a media source and records the stream.
This constant can also be accessed from toi.consts.ToiMediaRecorderBase.STATE_RECORDING.