Suggestions

close search

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal

Class: OpenTok::Archive

Inherits:
Object
Defined in:
lib/opentok/archive.rb

Overview

Represents an archive of an OpenTok session.

"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).
 This property is only set for composed archives.

Instance Attribute Summary

Instance Method Summary

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object

Instance Attribute Details

#created_atint

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

Returns:

  • (int)

    the current value of created_at

#durationstring

The duration of the archive, in seconds.

Returns:

  • (string)

    the current value of duration

#has_audiotrue, false

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

Returns:

  • (true, false)

    the current value of has_audio

#has_videotrue, false

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

Returns:

  • (true, false)

    the current value of has_video

#idstring

The archive ID.

Returns:

  • (string)

    the current value of id

#multi_archive_tagObject (readonly)

Returns the value of attribute multi_archive_tag.

#namestring

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

Returns:

  • (string)

    the current value of name

#output_modeString

Whether all streams in the archive are recorded to a single file (:composed) or to individual files (:individual).

Returns:

  • (String)

    the current value of output_mode

#projectIdstring

The API key associated with the archive.

Returns:

  • (string)

    the current value of projectId

#reasonstring

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

Returns:

  • (string)

    the current value of reason

#resolutionstring

The resolution of the archive, either “640x480” (SD landscape, the default), “1280x720” (HD landscape),

Returns:

  • (string)

    the current value of resolution

#session_idstring

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

Returns:

  • (string)

    the current value of session_id

#sizefloat

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

Returns:

  • (float)

    the current value of size

#statusstring

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 for your OpenTok project.

Returns:

  • (string)

    the current value of status

#streamModestring

Whether streams included in the archive are selected automatically (“auto”, the default) or manually (“manual”).

Returns:

  • (string)

    the current value of streamMode

#urlstring

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.

Returns:

  • (string)

    the current value of url

Instance Method Details

#add_stream(stream_id, opts = {}) ⇒ Object

Adds a stream to currently running composed archive that was started with the streamMode set to “manual”. For a description of the feature, see https://tokbox.com/developer/rest/#selecting-archive-streams.

You can call the method repeatedly with add_stream set to the same stream ID, to toggle the stream's audio or video in the archive. If you set both has_audio and has_video to false, you will get error response.

Parameters:

  • stream_id (String)

    The ID for the stream to be added to the archive

  • opts (Hash) (defaults to: {})

    a customizable set of options

Options Hash (opts):

  • :has_audio (true, false) — default: Boolean, optional

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

  • :has_video (true, false) — default: Boolean, optional

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

Raises:

#deleteObject

Deletes an OpenTok archive.

You can only delete an archive which has a status of “available” or “uploaded”. 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.

#layout(opts = {}) ⇒ Object

Sets the layout type for a composed archive. For a description of layout types, see Customizing the video layout for composed archives.

Parameters:

  • options (Hash)

    a customizable set of options

Raises:

  • (ArgumentError)

    The archive_id or options parameter is empty. Or the “custom” type was specified without a stylesheet option. Or a stylesheet was passed in for a type other than custom. Or an invalid type was passed in.

  • (OpenTokAuthenticationError)

    Authentication failed.

  • (ArgumentError)

    The archive_id or options parameter is empty.

  • (ArgumentError)

    The “custom” type was specified without a stylesheet option.

  • (ArgumentError)

    A stylesheet was passed in for a type other than custom. Or an invalid type was passed in.

  • (ArgumentError)

    An invalid layout type was passed in.

  • (OpenTokError)

    OpenTok server error.

  • (OpenTokArchiveError)

    Setting the layout failed.

#remove_stream(stream_id) ⇒ Object

Removes a stream to currently running composed archive that was started with the streamMode set to “manual”. For a description of the feature, see https://tokbox.com/developer/rest/#selecting-archive-streams.

Parameters:

  • stream_id (String)

    The ID for the stream to be removed from the archive

Raises:

#stopObject

Stops an OpenTok archive that is being recorded.

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

#to_jsonObject

A JSON-encoded string representation of the archive.