Documentation

Archive
in package

Represents an archive of an OpenTok session.

Table of Contents

PERMITTED_AUTO_RESOLUTIONS  = ['480x640', "640x480", "720x1280", "1280x720", "1080x1920", "1920x1080"]
$createdAt  : int
$duration  : string
$hasAudio  : bool
$hasVideo  : bool
$id  : string
$multiArchiveTag  : string
$name  : string
$outputMode  : string
$partnerId  : string
$reason  : string
$resolution  : string
$sessionId  : string
$size  : string
$status  : string
$streamMode  : string
$url  : string
addStreamToArchive()  : bool
Adds a stream to a currently running archive that was started with the the streamMode set to StreamMode.Manual. You can call the method repeatedly with the same stream ID, to toggle the stream's audio or video in the archive.
delete()  : mixed
Deletes an OpenTok archive.
getPermittedResolutions()  : mixed
jsonSerialize()  : mixed
removeStreamFromArchive()  : bool
Removes a stream from a currently running archive that was started with the the streamMode set to StreamMode.Manual.
stop()  : mixed
Stops the OpenTok archive, if it is being recorded.
toArray()  : mixed
Returns an associative array representation of this Archive object.
toJson()  : mixed
Returns a JSON representation of this Archive object.

Constants

PERMITTED_AUTO_RESOLUTIONS

private mixed|null PERMITTED_AUTO_RESOLUTIONS = ['480x640', "640x480", "720x1280", "1280x720", "1080x1920", "1920x1080"]

Properties

$createdAt

public int $createdAt

The time at which the archive was created, in milliseconds since the UNIX epoch.

$duration

public string $duration

The duration of the archive, in seconds.

$hasAudio

public bool $hasAudio

Whether the archive has an audio track (true) or not (false).

$hasVideo

public bool $hasVideo

Whether the archive has a video track (true) or not (false).

$id

public string $id

The archive ID.

$multiArchiveTag

public string $multiArchiveTag

Whether Multiple Archive is switched on, which will be a unique string for each simultaneous archive of an ongoing session. See https://tokbox.com/developer/guides/archiving/#simultaneous-archives for more information.

$name

public string $name

The name of the archive. If no name was provided when the archive was created, this is set to null.

$outputMode

public string $outputMode

The name of the archive. If no name was provided when the archive was created, this is set to null.

$partnerId

public string $partnerId

The API key associated with the archive.

$reason

public string $reason

For archives with the status "stopped" or "failed", this string describes the reason the archive stopped (such as "maximum duration exceeded") or failed.

$resolution

public string $resolution

The resolution of the archive, either "640x480" (SD landscape, the default), "1280x720" (HD landscape), "1920x1080" (FHD landscape), "480x640" (SD portrait), "720x1280" (HD portrait), or "1080x1920" (FHD portrait). You may want to use a portrait aspect ratio for archives that include video streams from mobile devices (which often use the portrait aspect ratio).

$sessionId

public string $sessionId

The session ID of the OpenTok session associated with this archive.

$size

public string $size

The size of the MP4 file. For archives that have not been generated, this value is set to 0.

$status

public string $status

The status of the archive, which can be one of the following:

  • "available" -- The archive is available for download from the OpenTok cloud.
  • "expired" -- The archive is no longer available for download from the OpenTok cloud.
  • "failed" -- The archive recording failed.
  • "paused" -- The archive is in progress and no clients are publishing streams to the session. When an archive is in progress and any client publishes a stream, the status is "started". When an archive is "paused", nothing is recorded. When a client starts publishing a stream, the recording starts (or resumes). If all clients disconnect from a session that is being archived, the status changes to "paused", and after 60 seconds the archive recording stops (and the status changes to "stopped").
  • "started" -- The archive started and is in the process of being recorded.
  • "stopped" -- The archive stopped recording.
  • "uploaded" -- The archive is available for download from the the upload target Amazon S3 bucket or Windows Azure container you set up for your OpenTok project.

$streamMode

public string $streamMode

Whether streams included in the archive are selected automatically (StreamMode.AUTO) or manually (StreamMode.MANUAL). When streams are selected automatically (StreamMode.AUTO), all streams in the session can be included in the archive. When streams are selected manually (StreamMode.MANUAL), you specify streams to be included based on calls to the Archive.addStreamToArchive() and Archive.removeStreamFromArchive() methods. With manual mode, you can specify whether a stream's audio, video, or both are included in the archive. In both automatic and manual modes, the archive composer includes streams based on stream prioritization rules.

$url

public string $url

The download URL of the available MP4 file. This is only set for an archive with the status set to "available"; for other archives, (including archives with the status "uploaded") this property is set to null. The download URL is obfuscated, and the file is only available from the URL for 10 minutes. To generate a new URL, call the Archive.listArchives() or OpenTok.getArchive() method.

Methods

addStreamToArchive()

Adds a stream to a currently running archive that was started with the the streamMode set to StreamMode.Manual. You can call the method repeatedly with the same stream ID, to toggle the stream's audio or video in the archive.

public addStreamToArchive(string $streamId, bool $hasAudio, bool $hasVideo) : bool
Parameters
$streamId : string

The stream ID.

$hasAudio : bool

Whether the archive should include the stream's audio (true, the default) or not (false).

$hasVideo : bool

Whether the archive should include the stream's video (true, the default) or not (false).

Return values
bool

Returns true on success.

delete()

Deletes an OpenTok archive.

public delete() : mixed

You can only delete an archive which has a status of "available", "uploaded", or "deleted". Deleting an archive removes its record from the list of archives. For an "available" archive, it also removes the archive file, making it unavailable for download. For a "deleted" archive, the archive remains deleted.

Tags
throws
ArchiveException

There archive status is not "available", "updated", or "deleted".

Return values
mixed

getPermittedResolutions()

public static getPermittedResolutions() : mixed
Return values
mixed

jsonSerialize()

public jsonSerialize() : mixed
Return values
mixed

removeStreamFromArchive()

Removes a stream from a currently running archive that was started with the the streamMode set to StreamMode.Manual.

public removeStreamFromArchive(string $streamId) : bool
Parameters
$streamId : string

The stream ID.

Return values
bool

Returns true on success.

stop()

Stops the OpenTok archive, if it is being recorded.

public stop() : mixed

Archives automatically stop recording after 120 minutes or when all clients have disconnected from the session being archived.

Tags
throws
ArchiveException

The archive is not being recorded.

Return values
mixed

toArray()

Returns an associative array representation of this Archive object.

public toArray() : mixed
Tags
deprecated
3.0.0

A more standard name for this method is supplied by JsonSerializable

see
Archive::jsonSerialize()

for a method with the same behavior

Return values
mixed

toJson()

Returns a JSON representation of this Archive object.

public toJson() : mixed
Return values
mixed

Search results