オープントーク

OpenTokセッションの作成、トークンの生成、およびアーカイブの操作を行うためのメソッドが含まれています。

新しい OpenTok オブジェクトを作成するには、OpenTok() コンストラクタを呼び出し、OpenTok API キー および API シークレットを指定してください。 OpenTok Video API Account. APIシークレットを 公に公開しないでください。このシークレットは、OpenTok()コンストラクタ(Web サーバー上でのみ)を使用してOpenTokセッションを作成する際に使用します。

api_key に VONAGE_APPLICATION_ID を、api_secret に VONAGE_PRIVATE_KEY_PATH を設定すると、SDK は 代わりに Vonage Auth を使用して Vonage Video にアクセスします。

Webサーバーには、OpenTokサーバーSDKを必ずすべて含めてください。

目次

$vonage  : bool

connectAudio()  : array<string|int, mixed> : 以下の処理を開始します オーディオ・コネクター WebSocket接続。Vonage Video APIセッションからWebSocketへ音声を送信します。

createSession()  : セッション : 新しい OpenTok セッションを作成し、そのセッションを一意に識別する セッション ID を返します。

deleteArchive()  : bool : OpenTokのアーカイブを削除します。

dial()  : SipCall : 発信側のSIP通話を開始します。

disableForceMute()  : bool : セッションのアクティブなミュート状態を解除します。このメソッドを呼び出した後、 セッションに公開される新しいストリームの音声は、ミュートされなくなります。

forceDisconnect()  : 混合 : 特定のクライアントをOpenTokセッションから切断します。

forceMuteAll()  : bool : OpenTok セッション内のすべてのストリーム(オプションで指定されたストリームの一覧を除く)について、 配信中のオーディオをミュートするように強制します。

forceMuteStream()  : bool : 特定のストリームの配信者に、配信中のオーディオをミュートするよう強制します。

generateToken()  : 文字列 : OpenTok セッションに接続するためのトークンを作成します。

getArchive()  : アーカイブ : 指定されたアーカイブ ID に対応する Archive オブジェクトを取得します。

getBroadcast()  : ブロードキャスト : OpenTokの放送に関する情報を取得します。

getRender()  : レンダー : 既存のレンダリングを取得してステータスを確認します。ステータスは以下のいずれかになります。 <UL> <LI><CODE>starting</CODE> — Vonage Video APIプラットフォームは、指定されたURLにあるリモートアプリケーションへの接続処理中です。これは初期状態です。</LI> <LI><CODE>started</CODE> — Vonage Video APIプラットフォームはリモートアプリケーションサーバーへの接続に成功し、そのメディアをVonage Video APIプラットフォームに再公開しています。</LI> <LI><CODE>stopped</CODE> — レンダリングが停止しました。</LI> <LI><CODE>failed</CODE> — エラーが発生し、レンダリングを続行できませんでした。opentokサーバーがリモートアプリケーションサーバーに接続できない場合や、ストリームを再公開できない場合に、起動時に発生する可能性があります。また、Vonage Video APIプラットフォーム側のエラーにより、レンダリング処理の途中で発生することもあります。</LI> </ul>

getStream()  : ストリーム : 指定されたストリームに関する情報を提供するStreamオブジェクトを取得します。

listArchives()  : アーカイブ一覧 : セッションのアーカイブの一覧を返します。

listRenders()  : mixed : OpenTok プロジェクトの Experience Composer レンダラーのリストを返します。

listStreams()  : ストリームリスト : 指定されたセッション ID に対応する StreamList オブジェクトを返します。

playDTMF()  : void : セッションまたは特定の接続に対してDTMF文字列を再生します

setArchiveLayout()  : void : OpenTokアーカイブ内のストリームレイアウトを更新します。

setStreamClassLists()  : mixed : セッション内のストリームのレイアウトクラス一覧を設定します。

signal()  : 混合 : OpenTokセッションに接続しているクライアント(または特定のクライアント)にシグナルを送信します。

startArchive()  : アーカイブ : OpenTokセッションのアーカイブを開始します。

startBroadcast()  : ブロードキャスト : OpenTok セッションのライブ配信を開始します。

startCaptions()  : array<string|int, mixed> : このメソッドを使用して、OpenTokセッションのリアルタイム「Live Captions」を開始します。

startRender()  : レンダー : OpenTok セッション用の Experience Composer レンダラーを起動します。

stopArchive()  : アーカイブ : 録画中のOpenTokアーカイブを停止します。

stopBroadcast()  : ブロードキャスト : ブロードキャストを停止します。

stopCaptions()  : 混合 : このメソッドを使用すると、セッションのライブキャプションを停止できます。

stopRender()  : 混合 : 進行中のレンダリングを停止します。

updateBroadcastLayout()  : void : ブロードキャストのレイアウトを更新します。

updateStream()  : mixed : ストリームのレイアウトクラス一覧を設定します。

returnLegacyToken()  : 文字列

プロパティ

$vonage

private bool $vonage = false

リクエストでVonage Authを使用してVonageサーバーにアクセスするかどうかを決定するためのオーバーライド

方法

connectAudio()

を開始します オーディオ・コネクター WebSocket接続。Vonage Video APIセッションからWebSocketへ音声を送信します。

public connectAudio(string $sessionId, string $token, array<string|int, mixed> $websocketOptions) : array<string|int, mixed>

パラメータ

$sessionId : string : セッションID。

$token : string : OpenTok セッションへのオーディオコネクタに使用する OpenTok トークン。 接続がオーディオコネクタのエンドポイントであることを識別するため、 またはその他の識別情報として、トークンデータを追加することができます。

$websocketOptions : array<string|int, mixed> : WebSocketの設定。以下のキーが含まれます:

- `'uri'` (string) — A publically reachable WebSocket URI controlled by the customer for the destination of the connect call. (f.e. wss://service.com/wsendpoint)
- `'streams'` (array) — (Optional) The stream IDs of the participants' whose audio is going to be connected. If not provided, all streams in session will be selected.
- `'headers'` (array) — (Optional) An object of key/val pairs with additional properties to send to your Websocket server, with a maximum length of 512 bytes.
戻り値

array<string|int, mixed> —

$response APIからの応答。構造は以下の通りです:

  • 'id' (文字列) — Audio Connector WebSocket を識別する一意の ID。
  • 'connectionId' (文字列) — 作成された Opentok クライアントの connectionId。この接続は、他の参加者と同様に、ペイロードで定義されたストリームを購読して WebSocket に転送し、セッション上で connectionCreated イベントを発生させます。

createSession()

新しい OpenTok セッションを作成し、そのセッションを一意に識別する セッション ID を返します。

public createSession([array<string|int, mixed> $options = array() ]) : Session

たとえば、OpenTok JavaScript ライブラリを使用する場合、 OT.initSession() メソッド(OpenTokセッションを初期化するため)。

OpenTokのセッションには有効期限はありません。ただし、認証トークンには有効期限があります( generateToken() メソッドを参照)。また、セッションを明示的に破棄することはできない点にもご注意ください。

セッションIDの文字列は、最大255文字まで可能です。

このメソッドを呼び出した際、エラーが発生すると OpenTokException が発生します。 詳細については、エラーメッセージを確認してください。

また、ご自身のアカウントにログインしてセッションを作成することもできます。 OpenTok Video API Account.

パラメータ

$options : array<string|int, mixed> = array() : (オプション) この配列は、セッションのオプションを定義します。この配列には、 以下のキーが含まれます(いずれもオプションです):

- `'archiveMode'` (ArchiveMode) — Whether the session is automatically
  archived (`ArchiveMode::ALWAYS`) or not (`ArchiveMode::MANUAL`).
  By default, the setting is `ArchiveMode.MANUAL`, and you must call the
  `OpenTok->startArchive()` method to start archiving. To archive the session
  (either automatically or not), you must set the `mediaMode` key to
  `MediaMode::ROUTED`.
- `'e2ee'` (Boolean) — Whether to enable
  [end-to-end encryption](https://tokbox.com/developer/guides/end-to-end-encryption)
  for a routed session.
- `archiveName` (String) — Name of the archives in auto archived sessions
- `archiveResolution` (Enum) — Resolution of the archives in
  auto archived sessions. Can be one of "480x640", "640x480", "720x1280", "1280x720", "1080x1920", "1920x1080"
- `'location'` (String) — An IP address that the OpenTok servers
  will use to situate the session in its global network. If you do not set a location hint,
  the OpenTok servers will be based on the first client connecting to the session.
- `'mediaMode'` (MediaMode) — Whether the session will transmit
  streams using the OpenTok Media Router (`MediaMode.ROUTED`) or not
  (`MediaMode.RELAYED`). By default, the `mediaMode` property
  is set to `MediaMode.RELAYED`.

  With the `mediaMode` parameter set to `MediaMode.RELAYED`, the
  session will attempt to transmit streams directly between clients. If clients cannot
  connect due to firewall restrictions, the session uses the OpenTok TURN server to relay
  audio-video streams.

  The
  [OpenTok Media Router](/opentok/guides/create-session/#media-mode) provides the following benefits:

  - The OpenTok Media Router can decrease bandwidth usage in multiparty sessions.
    (When the `mediaMode` parameter is set to `MediaMode.ROUTED`,
    each client must send a separate audio-video stream to each client subscribing to
    it.)
  - The OpenTok Media Router can improve the quality of the user experience through
    recovery. With these features, if a client's connectivity degrades to a degree
    that it does not support video for a stream it's subscribing to, the video is dropped
    on that client (without affecting other clients), and the client receives audio only.
    If the client's connectivity improves, the video returns.
  - The OpenTok Media Router supports the
    [archiving](/opentok/guides/archiving)
    feature, which lets you record, save, and retrieve OpenTok sessions.
戻り値

セッション

新しいセッションを表す Session オブジェクトです。 getSessionId() このオブジェクトのメソッドを使用してセッションIDを取得します。たとえば、 OpenTok.js ライブラリを使用する場合は、 OT.initSession() メソッドを使用する。

deleteArchive()

OpenTokのアーカイブを削除します。

public deleteArchive(string $archiveId) : bool

「利用可能」、「アップロード済み」、または「削除済み」のステータスを持つアーカイブのみ削除できます。 アーカイブを削除すると、アーカイブ一覧からその記録が削除されます。「利用可能」なアーカイブの場合、 アーカイブファイルも削除されるため、ダウンロードできなくなります。「削除済み」の アーカイブについては、削除された状態のままとなります。

パラメータ

$archiveId : string : 削除したいアーカイブのID。

タグ

スローされる例外 : ArchiveException

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

bool —

成功した場合は true を返します。

dial()

発信側のSIP通話を開始します。

public dial(string $sessionId, string $token, string $sipUri[, array<string|int, mixed> $options = [] ]) : SipCall

詳細は OpenTok SIP 相互接続 開発者ガイド.

パラメータ

$sessionId : string : 呼び出された参加者が参加するOpenTokセッションのID。

$token : string : 呼び出し先の参加者に使用する OpenTok トークン。 参加者が SIP エンドポイントであるかどうかを識別するためのデータや、 電話番号などのその他の識別情報をトークンに追加することができます。トークンは、 OpenTok::generateToken() または Session::generateToken() メソッドを使用する。

$sipUri : string : OpenTokからサードパーティのSIPプラットフォームに向けて発信されるSIPコールの宛先として使用されるSIP URI。

If the URI contains a transport=tlsheader, the negotiation between TokBox and
the SIP endpoint will be done securely. Note that this will only apply to the negotiation
itself, and not to the transmission of audio. To have audio transmission be encrypted,
see the "secure" property of the `options` parameter.

This is an example of secure call negotiation: "sip:access@thirparty.com;transport=tls".

This is an example of insecure call negotiation: "sip:access@thirparty.com".

$options : array<string|int, mixed> = [] : この配列は、SIP コールのオプションを定義します。これには 以下のキーが含まれており、いずれもオプションです:

- `'headers'` (array) — Headers​: Custom Headers to be added to the
  SIP INVITE request initiated from OpenTok to the Third Party SIP Platform.
- `'auth'` (array) — Auth​: Username and Password to be used in the SIP
  INVITE request for HTTP Digest authentication in case this is required by the Third Party
  SIP Platform.
  - `'username'` (string) — The username to be used
    in the the SIP INVITE​ request for HTTP digest authentication (if one
    is required).
  - `'password'` (string) — The password to be used
    in the the SIP INVITE​ request for HTTP digest authentication.
- `'secure'` (Boolean) — Indicates whether the media
  must be transmitted encrypted (true, the default) or not (false).
- `'observeForceMute'` (Boolean) — Whether the SIP endpoint should honor
  [force mute moderation](https://tokbox.com/developer/guides/moderation/#force_mute)
  (True) or not (False, the default).
- `'from'` (string) — The number or string that will be sent to
  the final SIP number as the caller. It must be a string in the form of
  "from@example.com", where from can be a string or a number. If from is set to a number
  (for example, "14155550101@example.com"), it will show up as the incoming number
  on PSTN phones. If from is undefined or set to a string (for example, "joe@example.com"),
  +00000000 will show up as the incoming number on PSTN phones.
- `'streams'` (array) — The Stream IDs of the participants which will included in the SIP
  call. If not provided, all streams in session will be selected.
戻り値

SipCall

このオブジェクトには、OpenTok セッション内の SIP 通話の接続に関する OpenTok 接続 ID およびストリーム ID が格納されています。この接続 ID を使用して、 以下の方法により SIP 通話を終了させることができます。 OpenTok::method_forceDisconnect() メソッドを使用する。

disableForceMute()

セッションのアクティブなミュート状態を解除します。このメソッドを呼び出した後、 セッションに公開される新しいストリームの音声は、ミュートされなくなります。

public disableForceMute(string $sessionId, array<string|int, string> $options) : bool

を呼び出した後、 OpenTok->forceMuteAll() メソッド この呼び出し後に公開されるすべてのストリームは、音声がミュートされた状態で公開されます。 disableForceMute() メソッドを呼び出すと、セッションのミュート状態が解除され、 新しく公開されるストリームが自動的にミュートされることがなくなります。

パラメータ

$sessionId : string : OpenTokのセッションID。

$options : array<string|int, string> : この配列はオプションを定義するもので、以下のキーが含まれます:

- `'excludedStreams'` (array, optional) — An array of stream IDs
  corresponding to streams that should not be muted. This is an optional property.
  If you omit this property, all streams in the session will be muted.
戻り値

bool —

その呼び出しが成功したか、失敗したか。

forceDisconnect()

OpenTokセッションから特定のクライアントを切断します。

public forceDisconnect(string $sessionId, string $connectionId) : mixed

パラメータ

$sessionId : string : クライアントが接続している OpenTok セッション ID。

$connectionId : string : セッション内の接続の接続ID。

戻り値

混合 —

forceMuteAll()

OpenTokセッション内のすべてのストリーム(オプションで指定されたストリームの一覧を除く)について、 配信中のオーディオをミュートするように強制します。

public forceMuteAll(string $sessionId, array<string|int, string> $options) : bool

既存のストリームに加え、このメソッドの呼び出し後に公開されるすべてのストリームは、 音声がミュートされた状態で公開されます。セッションのミュート状態を解除するには、 OpenTok->disableForceMute() メソッドを使用する。

また、以下の項目も参照してください。 OpenTok->forceMuteStream() メソッドを使用する。

パラメータ

$sessionId : string : OpenTokのセッションID。

$options : array<string|int, string> : この配列はオプションを定義するもので、以下のキーが含まれます:

- `'excludedStreams'` (array, optional) — An array of stream IDs
  corresponding to streams that should not be muted. This is an optional property.
  If you omit this property, all streams in the session will be muted.
戻り値

bool —

その呼び出しが成功したか、失敗したか。

forceMuteStream()

特定のストリームの配信者に、配信中の音声をミュートするよう強制する。

public forceMuteStream(string $sessionId, string $streamId) : bool

また、以下の項目も参照してください。 OpenTok->forceMuteAll() メソッドを使用する。

パラメータ

$sessionId : string : ストリームを含む OpenTok セッション ID。

$streamId : string : ストリームID。

戻り値

bool —

その呼び出しが成功したか、失敗したか。

generateToken()

OpenTokセッションに接続するためのトークンを作成します。

public generateToken(string $sessionId[, array<string|int, mixed> $payload = array() ][, bool $legacy = false ]) : string

OpenTokセッションに接続するユーザーを認証するために、 クライアントはセッションへの接続時にトークンを送信します。

テストを行うには、トークンを生成するか、または自分のアカウントにログインして OpenTok Video API Account.

パラメータ

$sessionId : string : ユーザーが接続するセッションに対応する セッションID。

$payload : array<string|int, mixed> = array() : この配列は、トークンのオプションを定義します。この配列には 以下のキーが含まれており、いずれもオプションです:

- `'role'` (string) — One of the constants defined in the RoleConstants
  class. The default role is publisher
- `'expireTime'` (int) — The timestamp for when the token expires,
  in milliseconds since the Unix epoch. The default expiration time is 24 hours
  after the token creation time. The maximum expiration time is 30 days after the
  token creation time.
- `'data'` (string) — A string containing connection metadata
  describing the end-user. For example, you can pass the user ID, name, or other data
  describing the end-user. The length of the string is limited to 1000 characters.
  This data cannot be updated once it is set.
- `initialLayoutClassList` (array) — An array of class names (strings)
  to be used as the initial layout classes for streams published by the client. Layout
  classes are used in customizing the layout of videos in
  [live streaming
  broadcasts](https://tokbox.com/developer/guides/broadcast/live-streaming/) and
  [composed
  archives](https://tokbox.com/developer/guides/archiving/layout-control.html).

$legacy : bool = false : 接続トークンは、SHA-256で署名されたJWTになりました。 これを次のように設定してください true レガシーT1形式を使用してトークンを作成するには。

戻り値

文字列 —

トークンの文字列。

getArchive()

指定されたアーカイブ ID に対応する Archive オブジェクトを取得します。

public getArchive(string $archiveId) : Archive

パラメータ

$archiveId : string : アーカイブID。

タグ

スローされる例外 : ArchiveException

There is no archive with the specified ID.

throws : InvalidArgumentException

The archive ID provided is null or an empty string.
戻り値

アーカイブ

Archive オブジェクト。

getBroadcast()

OpenTokの放送に関する情報を取得します。

public getBroadcast(string $broadcastId) : Broadcast

パラメータ

$broadcastId : string : 放送のID。

戻り値

ブロードキャスト

ブロードキャストを定義するプロパティを持つオブジェクト。

getRender()

既存のレンダリングを取得してステータスを確認します。ステータスは以下のいずれかになります。 <UL> <LI><CODE>starting</CODE> — Vonage Video APIプラットフォームは、指定されたURLにあるリモートアプリケーションへの接続処理中です。これは初期状態です。</LI> <LI><CODE>started</CODE> — Vonage Video APIプラットフォームはリモートアプリケーションサーバーへの接続に成功し、そのメディアをVonage Video APIプラットフォームに再公開しています。</LI> <LI><CODE>stopped</CODE> — レンダリングが停止しました。</LI> <LI><CODE>failed</CODE> — エラーが発生し、レンダリングを続行できませんでした。opentokサーバーがリモートアプリケーションサーバーに接続できない場合や、ストリームを再公開できない場合に、起動時に発生する可能性があります。また、Vonage Video APIプラットフォームでの何らかのエラーにより、レンダリング処理の途中で発生することもあります。</LI> </UL>

public getRender( $renderId) : Render

パラメータ

$renderId :

戻り値

レンダー

getStream()

指定されたストリームに関する情報を提供するStreamオブジェクトを取得します。

public getStream(string $sessionId, string $streamId) : Stream

パラメータ

$sessionId : string : ストリームを含む OpenTok セッションのセッション ID。

$streamId : string : ストリームID。

戻り値

ストリーム

Streamオブジェクト。

listArchives()

セッションのアーカイブの一覧を返します。

public listArchives(int $offset[, int $count = null ][, string $sessionId = null ]) : ArchiveList

について items() このオブジェクトのメソッドは、指定されたAPIキーに対して、 完了済みおよび進行中のアーカイブのリストを返します。

パラメータ

$offset : int : オプション。最初のアーカイブのインデックスオフセット。0 は 最も最近開始されたアーカイブのオフセットです。1 は、 その直前に開始されたアーカイブのオフセットです。オフセットを指定しない場合は、0 が使用されます。

$count : int = null : オプション。返すアーカイブの数。返されるアーカイブの最大数は 1000です。

$sessionId : string = null : オプション。アーカイブを取得したいOpenTokセッションID。セッションIDが 指定されていない場合、このメソッドは、そのAPIキーで作成されたすべてのセッションのアーカイブを返します。

戻り値

アーカイブ一覧

ArchiveList オブジェクトです。ArchiveList オブジェクトの items() メソッドを呼び出すと、 Archive オブジェクトの配列が返されます。

listRenders()

OpenTok プロジェクトの Experience Composer レンダラーのリストを返します。

public listRenders(int $offset[, int $count = 50 ]) : mixed

パラメータ

$offset : int

$count : int = 50

戻り値

混合 —

listStreams()

指定されたセッション ID に対応する StreamList オブジェクトを返します。

public listStreams(string $sessionId) : StreamList

パラメータ

$sessionId : string : セッションID。

戻り値

ストリームリスト

StreamList オブジェクト。StreamList オブジェクトの items() メソッドを呼び出すと、 Stream オブジェクトの配列が返されます。

playDTMF()

セッションまたは特定の接続に対してDTMF文字列を再生します

public playDTMF(string $sessionId, string $digits[, string $connectionId = null ]) : void

パラメータ

$sessionId : string : 呼び出された参加者が参加するOpenTokセッションのID。

$digits : string : 再生するDTMF数字 有効なDTMF数字は、0~9、p、#、*です。入力処理中に遅延が必要な場合、'p'は500msの休止を表します。

$connectionId : string = null : セッション内の特定の接続にDTMFトーンを送信するために使用されるオプションのパラメータです。

戻り値

void —

setArchiveLayout()

OpenTokアーカイブ内のストリームレイアウトを更新します。

public setArchiveLayout(string $archiveId, Layout $layoutType) : void

パラメータ

$archiveId : 文字列

$layoutType : レイアウト

戻り値

void —

setStreamClassLists()

セッション内のストリームのレイアウトクラス一覧を設定します。

public setStreamClassLists(string $sessionId[, array<string|int, mixed> $classListArray = array() ]) : mixed

レイアウトクラスは、 合成アーカイブやライブストリーミング放送のレイアウトで使用されます。詳細については、以下を参照してください。 アーカイブ内の 動画レイアウトのカスタマイズ そして OpenTokライブ配信の ビデオレイアウトの設定.

パラメータ

$sessionId : string : ストリームが属するセッションのセッションID。

$classListArray : array<string|int, mixed> = array() : セッション内の接続の connectionId。

戻り値

混合 —

signal()

OpenTokセッションに接続しているクライアント(または特定のクライアント)にシグナルを送信します。

public signal(string $sessionId, array<string|int, mixed> $payload[, string $connectionId = null ]) : mixed

パラメータ

$sessionId : string : シグナルが送信される OpenTok セッション ID。

$payload : array<string|int, mixed> : この配列は、シグナルのペイロードを定義します。この配列には 以下のキーが含まれており、各キーの型は任意です:

- `'data'` (string) — The data string for the signal. You can send a maximum of 8kB.
- `'type'` (string) — (Optional) The type string for the signal. You can send a maximum of 128 characters, and only the following characters are allowed: A-Z, a-z, numbers (0-9), '-', '\_', and '~'.

$connectionId : string = null : セッション内の特定の接続にシグナルを送信するために使用されるオプションのパラメータ。

戻り値

混合 —

startArchive()

OpenTokセッションのアーカイブを開始します。

public startArchive(string $sessionId[, array<string|int, mixed> $options = [] ]) : Archive

アーカイブの録画を正常に開始するには、クライアントがOpenTokセッションに アクティブに接続されている必要があります。

1つのセッションにつき、一度に記録できるアーカイブは1つだけです。記録できるのは、 OpenTok Media Router を使用しているセッションのアーカイブのみです( メディアモード (ルーティング設定に設定されている場合);メディアモードが「中継」に設定されているセッションはアーカイブできません。

アーカイブに関する詳細については、以下の OpenTokのアーカイブ機能 プログラミング ガイド。

パラメータ

$sessionId : string : アーカイブ対象の OpenTok セッションのセッション ID。

$options : array<string|int, mixed> = [] : (オプション) この配列は、アーカイブのオプションを定義します。この配列には 以下のキーが含まれます(いずれもオプションです):

- `'name'` (String) — The name of the archive. You can use this name to
  identify the archive. It is a property of the Archive object, and it is a property of
  archive-related events in the OpenTok client SDKs.
- `'hasVideo'` (Boolean) — Whether the archive will record video
  (true, the default) or not (false). If you set both `hasAudio` and
  `hasVideo` to false, the call to the `startArchive()` method results
  in an error.
- `'streamMode'` (String) — Whether streams included in the archive are
  selected automatically (`StreamMode.AUTO`, the default) 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](https://tokbox.com/developer/guides/archive-broadcast-layout/#stream-prioritization-rules).
- `'hasAudio'` (Boolean) — Whether the archive will record audio
  (true, the default) or not (false). If you set both `hasAudio` and
  `hasVideo` to false, the call to the `startArchive()` method results
  in an error.
- `'multiArchiveTag'` (String) (Optional) — Set this to support recording multiple archives
  for the same session simultaneously. Set this to a unique string for each simultaneous archive of an ongoing
  session. You must also set this option when manually starting an archive
  that is {https://tokbox.com/developer/guides/archiving/#automatic automatically archived}.
  Note that the `multiArchiveTag` value is not included in the response for the methods to
  {https://tokbox.com/developer/rest/#listing\_archives list archives} and
  {https://tokbox.com/developer/rest/#retrieve\_archive\_info retrieve archive information}.
  If you do not specify a unique `multiArchiveTag`, you can only record one archive at a time for a given session.
  {https://tokbox.com/developer/guides/archiving/#simultaneous-archives See Simultaneous archives}.
- `'outputMode'` (OutputMode) — Whether all streams in the
  archive are recorded to a single file (`OutputMode::COMPOSED`, the default)
  or to individual files (`OutputMode::INDIVIDUAL`).
- `'resolution'` (String) — 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). This property only applies to composed archives. If you set
  this property and set the outputMode property to "individual", a call to the method
  results in an error.
戻り値

アーカイブ

Archive オブジェクトには、アーカイブ ID を含む、 アーカイブを定義するプロパティが含まれています。

startBroadcast()

OpenTokセッションのライブ配信を開始します。

public startBroadcast(string $sessionId[, array<string|int, mixed> $options = [] ]) : Broadcast

パラメータ

$sessionId : string : 配信対象のセッションのセッションID。

$options : array<string|int, mixed> = [] : (オプション) ブロードキャストのオプションを含む配列。この配列には 以下のプロパティがあります:

- `layout` (Layout) — (Optional) An object defining the initial
  layout type of the broadcast. If you do not specify an initial layout type,
  the broadcast stream uses the Best Fit layout type. For more information, see
  [Configuring
  Video Layout for the OpenTok live streaming feature](https://tokbox.com/developer/guides/broadcast/live-streaming/#configuring-live-streaming-video-layout).
- `streamMode` (String) — Whether streams included in the broadcast
  are selected automatically (`StreamMode.AUTO`, the default) or manually
  (`StreamMode.MANUAL`). When streams are selected automatically
  (`StreamMode.AUTO`), all streams in the session can be included in the broadcast.
  When streams are selected manually (`StreamMode.MANUAL`), you specify streams
  to be included based on calls to the `Broadcast.addStreamToBroadcast()` and
  `Broadcast.removeStreamFromBroadcast()` methods. With manual mode, you can specify
  whether a stream's audio, video, or both are included in the broadcast. In both automatic and
  manual modes, the broadcast composer includes streams based on
  [stream
  prioritization rules](https://tokbox.com/developer/guides/archive-broadcast-layout/#stream-prioritization-rules).
- `multiBroadcastTag` (String) (Optional) — Set this to support multiple broadcasts for
  the same session simultaneously. Set this to a unique string for each simultaneous broadcast of an ongoing session.
  Note that the `multiBroadcastTag` value is \*not\* included in the response for the methods to
  {https://tokbox.com/developer/rest/#list\_broadcasts list live streaming broadcasts} and
  {https://tokbox.com/developer/rest/#get\_info\_broadcast get information about a live streaming broadcast}.
  {https://tokbox.com/developer/guides/broadcast/live-streaming#simultaneous-broadcasts See Simultaneous broadcasts}.
- `resolution` — The resolution of the broadcast: either "640x480" (SD landscape, the default), "1280x720" (HD landscape),
  "1920x1080" (FHD landscape), "480x640" (SD portrait), "720x1280" (HD portrait), or "1080x1920"
  (FHD portrait).
- `maxBitRate` — Max Bitrate allowed for the broadcast composing. Must be between
  400000 and 2000000.
- `outputs` (Array) —
  Defines the HLS broadcast and RTMP streams. You can provide the following keys:
  - `hls` (Array) — available with the following options:
    - `'dvr'` (Bool) — Whether to enable
      [DVR functionality](https://tokbox.com/developer/guides/broadcast/live-streaming/#dvr)
      — rewinding, pausing, and resuming — in players that support it (`true`),
      or not (`false`, the default). With DVR enabled, the HLS URL will include
      a ?DVR query string appended to the end.
    - `'lowLatency'` (Bool) — Whether to enable
      [low-latency mode](https://tokbox.com/developer/guides/broadcast/live-streaming/#low-latency)
      for the HLS stream. Some HLS players do not support low-latency mode. This feature
      is incompatible with DVR mode HLS broadcasts.
  - `rtmp` (Array) — An array of arrays defining RTMP streams to broadcast. You
    can specify up to five target RTMP streams. Each RTMP stream array has the following keys:
    - `id` (String) — The stream ID (optional)
    - `serverUrl` (String) — The RTMP server URL
    - `streamName` (String) — The stream name, such as
      the YouTube Live stream name or the Facebook stream key
戻り値

ブロードキャスト

ブロードキャストを定義するプロパティを持つオブジェクト。

startCaptions()

この方法を使用して、OpenTokセッションでリアルタイムのライブキャプションを開始します。

public startCaptions(string $sessionId, string $token[, string $languageCode = null ][, int $maxDuration = null ][, bool $partialCaptions = null ][, string $statusCallbackUrl = null ]) : array<string|int, mixed>

許可される最大時間は4時間です。この時間を過ぎると、音声キャプションは停止しますが、 進行中のOpenTokセッションには影響はありません。キャプションの開始時にコールバックURLが指定されている場合、そのURLにイベントが送信されます。

各OpenTokセッションでは、1つの音声キャプションセッションのみをサポートしています。

「ライブキャプション」機能の詳細については、『ライブキャプション開発者ガイド』をご覧ください。

パラメータ

$sessionId : string : OpenTok セッションのセッション ID。このセッションに配信を行っている パブリッシャーからの音声が、キャプションの生成に使用されます。

$token : string : ロールが「Moderator」に設定された有効な OpenTok トークン。

$languageCode : string = null : (オプション) この呼び出しで使用される話し言葉の BCP-47 コード。デフォルト 値は "en-US" です。以下の言語コードがサポートされています: "en-AU" (英語、オーストラリア)、"en-GB" (英語、英国)、「en-US」(英語、米国)、「es-US」(スペイン語、米国)、「zh-CN」(中国語、簡体字)、「fr-FR」(フランス語)、「fr-CA」(フランス語、カナダ) "de-DE"(ドイツ語)、"hi-IN"(ヒンディー語、インド)、"it-IT"(イタリア語)、"ja-JP"(日本語)、"ko-KR"(韓国語)、 「pt-BR」(ポルトガル語、ブラジル)、 「th-TH」(タイ語)。

$maxDuration : int = null : (オプション)音声キャプションの最大再生時間(秒単位)。デフォルト値は 14,400秒(4時間)で、これは許可される最大再生時間です。

$partialCaptions : bool = null : (オプション) ある程度の 不正確さを許容する代わりに、キャプション生成を高速化するためにこの機能を有効にするかどうか。デフォルト値は true です。

$statusCallbackUrl : string = null : (オプション) 顧客が管理し、外部からアクセス可能なURLで、 ユーザーの操作を必要とせずにレンダリング対象のコンテンツを生成できるもの。URLの 最小長は15文字、最大長は2048文字です。詳細については、 以下を参照してください。 ライブキャプションのステータス更新。

戻り値

array<string|int, mixed> —

startRender()

OpenTok セッション用の Experience Composer レンダラーを起動します。

public startRender( $sessionId,  $token,  $url,  $maxDuration,  $resolution,  $properties) : Render

詳細は Experience Composer 開発者ガイド.

パラメータ

$sessionId : : (文字列) Experience Composerのストリームが含まれるOpenTokセッションのセッションID。

$token : : (文字列) Publisher ロールを持つ有効な OpenTok トークン。また、出力ストリームに関連付ける接続データ(オプション)を含みます。

$url : : (文字列) 顧客が管理し、ユーザーの操作を必要とせずにレンダリング対象のコンテンツを生成できる、外部からアクセス可能なURL。 URLの最小長は15文字、最大長は2048文字です。

$maxDuration : : (int) (オプション) エクスペリエンス・コンポーザーの最大実行時間(秒単位)。この時間が経過しても実行が継続している場合、自動的に停止されます。 最大値は 36000(10 時間)、最小値は 60(1 分)、デフォルト値は 7200(2 時間)です。 エクスペリエンス・コンポーザーが終了すると、そのストリームの公開が解除され、Accountポータルで設定されている場合は、コールバックURLにイベントが送信されます。

$resolution : : (文字列) (オプション) Experience Composer の解像度。「640x480」(SD 横向き)、「480x640」(SD 縦向き)、「1280x720」(HD 横向き)、 「720x1280」(HD 縦向き)、「1920x1080」(FHD 横向き)、または「1080x1920」(FHD 縦向き)のいずれかです。 デフォルトでは、この解像度は「1280x720」(HD 横向き、デフォルト)です。

$properties : : (配列) (オプション) 合成された出力ストリームに対する Publisher プロパティの初期設定。

- `name` (String) (optional) — Serves as the name of the composed output stream which is published to the session. The name must have a minimum length of 1 and
  a maximum length of 200.
戻り値

レンダー

レンダリングオブジェクト。これには、レンダリングIDを含む、レンダリングを定義するプロパティが含まれています。

stopArchive()

録画中のOpenTokアーカイブを停止します。

public stopArchive(string $archiveId) : Archive

アーカイブは、120分経過するか、アーカイブ対象のセッションからすべてのクライアントが切断されると、自動的に記録を停止します。

パラメータ

$archiveId : string : 記録を停止したいアーカイブのID。

戻り値

アーカイブ

停止されるアーカイブに対応するArchiveオブジェクト。

stopBroadcast()

ブロードキャストを停止します。

public stopBroadcast(string $broadcastId) : Broadcast

パラメータ

$broadcastId : string : 放送のID。

戻り値

ブロードキャスト

stopCaptions()

セッションのライブキャプションを停止するには、この方法を使用してください。

public stopCaptions(string $captionsId) : mixed

パラメータ

$captionsId : 文字列

戻り値

混合 —

stopRender()

既存のレンダリングを停止します。

public stopRender( $renderId) : mixed

パラメータ

$renderId :

戻り値

混合 —

updateBroadcastLayout()

放送のレイアウトを更新します。

public updateBroadcastLayout(string $broadcastId, Layout $layout) : void

参照 OpenTokライブ配信の ビデオレイアウトの設定.

パラメータ

$broadcastId : string : 放送のID。

$layout : レイアウト : ブロードキャストのレイアウトタイプを定義するオブジェクト。

戻り値

void —

updateStream()

ストリームのレイアウトクラス一覧を設定します。

public updateStream(string $sessionId, string $streamId[, array<string|int, mixed> $properties = array() ]) : mixed

レイアウトクラスは、 合成アーカイブやライブストリーミング放送のレイアウトで使用されます。

詳細については、以下を参照してください。 アーカイブ内の 動画レイアウトのカスタマイズ そして OpenTokライブ配信の ビデオレイアウトの設定.

クライアントがセッションに接続するために使用するトークンを生成する際、 クライアントが公開するストリームの初期レイアウトクラス一覧を設定できます。詳細は、 OpenTok::generateToken() メソッドを使用する。

パラメータ

$sessionId : string : ストリームが属するセッションのセッションID。

$streamId : string : ストリームID。

$properties : array<string|int, mixed> = array() : 1つのプロパティを含む配列: $layoutClassList. このプロパティは、ストリームに適用するクラス名(文字列)の配列です。 設定 $layoutClassList ストリームのレイアウトクラス一覧をクリアするには、空の配列を指定します。 たとえば、次のコードでは、ストリームが2つのクラスを使用するように設定しています:

```

$streamProperties = array(
  '$layoutClassList' => array('bottom', 'right')
);
$opentok->updateStream($sessionId, $streamId, $streamProperties);
```
戻り値

混合 —

returnLegacyToken()

private returnLegacyToken(string $sessionId[, array<string|int, mixed> $options = [] ]) : string

パラメータ

$sessionId : 文字列

$options : array<string|int, mixed> = []

戻り値

文字列 —