The Archive class defines an object that represents an OpenTok archive.
You get a reference to an Archive object from an ArchiveEvent
object or from a SessionEvent object. These objects include an archives
property, which is an array of Archive objects.
The sessionConnected event object (defined
by the SessionEvent class) includes an archives property. This
property represents an array of archives that are currently created for the
session.
Archive objects include the following properties:
archiveId (String) – A unique identifier for the archive. Note that you should store a record of the archive IDs of archives you create, so that you can reference them later when loading the archive for playback.
title (String) – The title
assigned to the archive when it was created (when the createArchive()
method of a Session object was called).
type (String) – A string identifying the type of archive. This can be one of the following values:
"perSession" – Defines an archive that
records all streams in a session."perStream" – Defines an archive that can
be used to record selected streams in a session."individual" – Defines an archive that is
recorded using the Recorder class. (This is an archive of a single video, recorded
independently from an OpenTok session.)Note:Archive properties should only be used as read-only entities. The results of using JavaScript to directly change the values of Archive properties will be unpredictable.
Archive objects have the following methods:
| Method | Description |
|---|---|
| getStateManager():StateManager | Returns the StateManager object for the session, with which you can listen to state data changes in the archive. |
| startPlayback() | Starts playing back the archive. |
| stopPlayback() | Stops playing back the archive. |
Returns the StateManager object for the Archive. For an example, see the example in the StateManager documentation.
Note: The Archive State API is in beta testing. We welcome your comments.
Returns
StateManager The StateManager object for the Archive.
See
Starts playing back the archive.
Note: If all clients disconnect from a session, any archive playing in that session stops.
Events
playbackStarted (ArchiveEvent) Dispatched by the Session object on all connected clients.
exception (ExceptionEvent) The OpenTok library could not play back the archive. The TB object dispatches this event. The event object includes these properties:
|
|
|
|
|
|
|
|
Errors
The application throws an error if the archive is a created archive (used for recording), rather than a loaded archive (used for playback).
Stops playing back the archive.
Note: If all clients disconnect from a session, any archive playing in that session stops.
Events
playbackStarted (ArchiveEvent) The archive playback has started. The Session object dispatches this event.
playbackStopped (ArchiveEvent) Dispatched by the Session object on all connected clients.
exception (ExceptionEvent) The OpenTok library could not stop playing back the archive. The TB object dispatches this event. The event object includes these properties:
|
|
|
|
|
|
|
|