Documentation ¶
Index ¶
- Constants
- type AmazonS3Config
- type Archive
- type ArchiveList
- type ArchiveListOptions
- type ArchiveMode
- type ArchiveOptions
- type ArchiveOutputMode
- type AzureConfig
- type Broadcast
- type BroadcastList
- type BroadcastListOptions
- type BroadcastOptions
- type BroadcastOutputOptions
- type BroadcastUrls
- type DialOptions
- type HLSConfig
- type Layout
- type LayoutType
- type MediaMode
- type OpenTok
- func (ot *OpenTok) ChangeProjectStatus(projectApiKey string, projectStatus ProjectStatus) (*Project, error)
- func (ot *OpenTok) CreateProject(projectName string) (*Project, error)
- func (ot *OpenTok) CreateSession(opts SessionOptions) (*Session, error)
- func (ot *OpenTok) DeleteArchive(archiveId string) error
- func (ot *OpenTok) DeleteArchiveStorage() error
- func (ot *OpenTok) DeleteProject(projectApiKey string) error
- func (ot *OpenTok) Dial(sessionId string, opts DialOptions) (*SIPCall, error)
- func (ot *OpenTok) ForceDisconnect(sessionId, connectionId string) error
- func (ot *OpenTok) GenerateToken(sessionId string, opts TokenOptions) (*string, error)
- func (ot *OpenTok) GetArchive(archiveId string) (*Archive, error)
- func (ot *OpenTok) GetBroadcast(broadcastId string) (*Broadcast, error)
- func (ot *OpenTok) GetProject(projectApiKey string) (*Project, error)
- func (ot *OpenTok) GetStream(sessionId, streamId string) (*Stream, error)
- func (ot *OpenTok) ListArchives(opts ArchiveListOptions) (*ArchiveList, error)
- func (ot *OpenTok) ListBroadcasts(opts BroadcastListOptions) (*BroadcastList, error)
- func (ot *OpenTok) ListProjects() ([]*Project, error)
- func (ot *OpenTok) ListStreams(sessionId string) (*StreamList, error)
- func (ot *OpenTok) RefreshProjectSecret(projectApiKey string) (*Project, error)
- func (ot *OpenTok) SendConnectionSignal(sessionId, connectionId string, data SignalData) error
- func (ot *OpenTok) SendSessionSignal(sessionId string, data SignalData) error
- func (ot *OpenTok) SetArchiveLayout(archiveId string, layout Layout) (*Archive, error)
- func (ot *OpenTok) SetArchiveStorage(opts StorageOptions) (*StorageOptions, error)
- func (ot *OpenTok) SetBroadcastLayout(broadcastId string, layout Layout) (*Broadcast, error)
- func (ot *OpenTok) SetStreamClassLists(sessionId string, opts StreamClassOptions) (*StreamList, error)
- func (ot *OpenTok) StartArchive(sessionId string, opts ArchiveOptions) (*Archive, error)
- func (ot *OpenTok) StartBroadcast(sessionId string, opts BroadcastOptions) (*Broadcast, error)
- func (ot *OpenTok) StopArchive(archiveId string) (*Archive, error)
- func (ot *OpenTok) StopBroadcast(broadcastId string) (*Broadcast, error)
- type Project
- type ProjectStatus
- type RTMPConfig
- type Resolution
- type Role
- type SIP
- type SIPAuth
- type SIPCall
- type SIPHeaders
- type Session
- type SessionIdInfo
- type SessionOptions
- type SignalData
- type StorageOptions
- type Stream
- type StreamClass
- type StreamClassOptions
- type StreamList
- type TokenOptions
Constants ¶
View Source
const TOKEN_SENTINEL = "T1=="
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AmazonS3Config ¶ added in v1.5.0
type AmazonS3Config struct { AccessKey string `json:"accessKey"` // The Amazon Web Services access key. SecretKey string `json:"secretKey"` // The Amazon Web Services secret key. Bucket string `json:"bucket"` // The S3 bucket name. Endpoint string `json:"endpoint,omitempty"` // The S3 or S3-compatible storage endpoint. }
type Archive ¶ added in v1.4.0
type Archive struct { CreatedAt int `json:"createdAt"` // The time at which the archive was created, in milliseconds since the UNIX epoch. Duration int `json:"duration"` // The duration of the archive, in milliseconds. HasAudio bool `json:"hasAudio"` // Whether the archive has an audio track or not. HasVideo bool `json:"hasVideo"` // Whether the archive has an video track or not. Id string `json:"id"` // The unique archive ID. Name *string `json:"name"` // The name of the archive. OutputMode ArchiveOutputMode `json:"outputMode"` // The output mode to be generated for this archive. ProjectId int `json:"projectId"` // The API key associated with the archive. Reason string `json:"reason"` // This string describes the reason the archive stopped or failed. Resolution Resolution `json:"resolution"` // The resolution of the archive. SessionId string `json:"sessionId"` // The session ID of the OpenTok session associated with this archive. Size int `json:"size"` // The size of the MP4 file. Status string `json:"status"` // The status of the archive. Url *string `json:"url"` // The download URL of the available MP4 file. OpenTok *OpenTok `json:"-"` }
type ArchiveList ¶ added in v1.4.0
type ArchiveListOptions ¶ added in v1.4.0
type ArchiveMode ¶
type ArchiveMode string
const ( /** * Set to always to have the session archived automatically. */ AutoArchived ArchiveMode = "always" /** * Set to manual (the default), you can archive the session by calling the REST /archive POST method */ ManualArchived ArchiveMode = "manual" )
type ArchiveOptions ¶ added in v1.4.0
type ArchiveOptions struct { SessionId string `json:"sessionId"` HasAudio bool `json:"hasAudio,omitempty"` HasVideo bool `json:"hasVideo,omitempty"` Layout *Layout `json:"layout,omitempty"` Name string `json:"name,omitempty"` OutputMode ArchiveOutputMode `json:"outputMode,omitempty"` Resolution Resolution `json:"resolution,omitempty"` }
type ArchiveOutputMode ¶ added in v1.4.0
type ArchiveOutputMode string
const ( /** * The archive is a single MP4 file composed of all streams. */ Composed ArchiveOutputMode = "composed" /** * The archive is a ZIP container file with multiple individual media files * for each stream, and a JSON metadata file for video synchronization. */ Individual ArchiveOutputMode = "individual" )
type AzureConfig ¶ added in v1.5.0
type AzureConfig struct { AccountName string `json:"accountName"` // The Microsoft Azure account name. AccountKey string `json:"accountKey"` // The Microsoft Azure account key. Container string `json:"container"` // The Microsoft Azure container name. Domain string `json:"domain,omitempty"` // The Microsoft Azure domain in which the container resides. }
type Broadcast ¶ added in v1.7.0
type Broadcast struct { Id string `json:"id"` // The unique ID for the broadcast. SessionId string `json:"sessionId"` // The OpenTok session ID. ProjectId int `json:"projectId"` // The API key associated with the broadcast.. CreatedAt int `json:"createdAt"` // The time at which the broadcast was created, in milliseconds since the UNIX epoch. UpdatedAt int `json:"updatedAt"` // The time at which the broadcast was updated, in milliseconds since the UNIX epoch. Resolution Resolution `json:"resolution"` // The resolution of the broadcast. Status string `json:"status"` // The status of the broadcast. BroadcastUrls BroadcastUrls `json:"broadcastUrls"` // An object containing details about the HLS and RTMP broadcasts. OpenTok *OpenTok `json:"-"` }
type BroadcastList ¶ added in v1.7.0
type BroadcastListOptions ¶ added in v1.7.0
type BroadcastOptions ¶ added in v1.7.0
type BroadcastOptions struct { SessionId string `json:"sessionId"` Layout *Layout `json:"layout,omitempty"` MaxDuration int `json:"maxDuration,omitempty"` Outputs BroadcastOutputOptions `json:"outputs"` Resolution Resolution `json:"resolution,omitempty"` }
type BroadcastOutputOptions ¶ added in v1.7.0
type BroadcastOutputOptions struct { HLS *HLSConfig `json:"hls,omitempty"` RTMP []*RTMPConfig `json:"rtmp,omitempty"` }
type BroadcastUrls ¶ added in v1.7.0
type BroadcastUrls struct { HLS string `json:"hls"` RTMP []*RTMPConfig `json:rtmp` }
type DialOptions ¶ added in v1.8.0
type Layout ¶ added in v1.7.0
type Layout struct { Type LayoutType `json:"type,omitempty"` StyleSheet string `json:"stylesheet,omitempty"` }
type LayoutType ¶ added in v1.7.0
type LayoutType string
const ( /** * This is a tiled layout, which scales according to the number of videos. */ BestFit LayoutType = "bestFit" /** * This is a picture-in-picture layout, where a small stream is visible over * a full-size stream. */ PIP LayoutType = "pip" /** * This is a layout with one large stream on the right edge of the output, * and several smaller streams along the left edge of the output. */ VerticalPresentation LayoutType = "verticalPresentation" /** * This is a layout with one large stream on the top edge of the output, * and several smaller streams along the bottom edge of the output. */ HorizontalPresentation LayoutType = "horizontalPresentation" /** * To use a custom layout, set the type property for the layout to "custom" * and set an additional property, stylesheet, which is set to the CSS. */ Custom LayoutType = "custom" )
type OpenTok ¶
type OpenTok struct {
// contains filtered or unexported fields
}
func (*OpenTok) ChangeProjectStatus ¶
func (ot *OpenTok) ChangeProjectStatus(projectApiKey string, projectStatus ProjectStatus) (*Project, error)
*
- Account administrators can use this method to change a project's status.
func (*OpenTok) CreateProject ¶
*
- Use this method to create an OpenTok API key and secret for a project.
func (*OpenTok) CreateSession ¶
func (ot *OpenTok) CreateSession(opts SessionOptions) (*Session, error)
func (*OpenTok) DeleteArchiveStorage ¶ added in v1.5.0
*
- Delete the configuration of archive storage.
func (*OpenTok) DeleteProject ¶
*
- Use this method to delete a project. This prevents the use of the project API key (an any OpenTok sessions created with it).
func (*OpenTok) Dial ¶ added in v1.8.0
func (ot *OpenTok) Dial(sessionId string, opts DialOptions) (*SIPCall, error)
*
- The audio from your end of the SIP call is added to the OpenTok session as
- an audio-only stream. The OpenTok Media Router mixes audio from other streams
- in the session and sends the mixed audio to your SIP endpoint.
func (*OpenTok) ForceDisconnect ¶ added in v1.6.0
*
- Disconnect a client from an OpenTok session via server-side
func (*OpenTok) GenerateToken ¶
func (ot *OpenTok) GenerateToken(sessionId string, opts TokenOptions) (*string, error)
func (*OpenTok) GetProject ¶ added in v1.3.0
*
- Use this method to get a project details record describing the project.
func (*OpenTok) ListArchives ¶ added in v1.4.0
func (ot *OpenTok) ListArchives(opts ArchiveListOptions) (*ArchiveList, error)
*
- Get the list of archives for your project, both completed and in-progress.
func (*OpenTok) ListBroadcasts ¶ added in v1.7.0
func (ot *OpenTok) ListBroadcasts(opts BroadcastListOptions) (*BroadcastList, error)
*
- Get details on broadcasts that are in progress and started.
- Completed broadcasts are not included in the listing.
func (*OpenTok) ListProjects ¶ added in v1.3.0
*
- Use this method to get the records for all projects.
func (*OpenTok) ListStreams ¶ added in v1.6.0
func (ot *OpenTok) ListStreams(sessionId string) (*StreamList, error)
*
- Get information on an OpenTok all stream in a session
func (*OpenTok) RefreshProjectSecret ¶
*
- For security reasons, you may want to generate a new API secret for a project.
func (*OpenTok) SendConnectionSignal ¶ added in v1.6.0
func (ot *OpenTok) SendConnectionSignal(sessionId, connectionId string, data SignalData) error
*
- Send signals to a specific client in an active OpenTok session
func (*OpenTok) SendSessionSignal ¶ added in v1.6.0
func (ot *OpenTok) SendSessionSignal(sessionId string, data SignalData) error
*
- Send signals to all participants in an active OpenTok session
func (*OpenTok) SetArchiveLayout ¶ added in v1.5.0
*
- Dynamically change the layout type of a composed archive.
func (*OpenTok) SetArchiveStorage ¶ added in v1.5.0
func (ot *OpenTok) SetArchiveStorage(opts StorageOptions) (*StorageOptions, error)
*
- For an OpenTok project, you can have OpenTok upload completed archives to an
- Amazon S3 bucket (or an S3-compliant storage provider) or Microsoft Azure container.
func (*OpenTok) SetBroadcastLayout ¶ added in v1.7.0
*
- Dynamically change the layout type of a live streaming broadcast.
func (*OpenTok) SetStreamClassLists ¶ added in v1.7.0
func (ot *OpenTok) SetStreamClassLists(sessionId string, opts StreamClassOptions) (*StreamList, error)
*
- Change the composed archive layout classes for an OpenTok stream
func (*OpenTok) StartArchive ¶ added in v1.4.0
func (ot *OpenTok) StartArchive(sessionId string, opts ArchiveOptions) (*Archive, error)
*
- Start the recording of the archive. *
- To successfully start recording an archive, at least one client must be
- connected to the session.
- You can only record one archive at a time for a given session.
- You can only record archives of sessions that use the OpenTok Media Router.
func (*OpenTok) StartBroadcast ¶ added in v1.7.0
func (ot *OpenTok) StartBroadcast(sessionId string, opts BroadcastOptions) (*Broadcast, error)
*
- Use this method to start a live streaming for an OpenTok session.
- This broadcasts the session to an HLS (HTTP live streaming) or to RTMP streams.
func (*OpenTok) StopArchive ¶ added in v1.4.0
*
- Stop the recording of the archive. *
- Archives stop recording after 2 hours (120 minutes), or 60 seconds after the
- last client disconnects from the session, or 60 minutes after the last
- client stops publishing.
type Project ¶
type Project struct { Id string `json:"id"` // The OpenTok project API key UserId int `json:"userId"` // The OpenTok account id Secret string `json:"secret"` // The OpenTok project API secret Status string `json:"status"` // Whether the project is active ("VALID", "ACTIVE") or suspended ("SUSPENDED"). UserStatus string `json:"userStatus"` // The OpenTok account status Name string `json:"name"` // The name, if you specified one when creating the project; or an empty string if you did not specify a name ContactEmail string `json:"contactEmail"` // The OpenTok account email CreatedAt int `json:"createdAt"` // The time at which the project was created (a UNIX timestamp, in milliseconds) UpdatedAt int `json:"updatedAt"` // The time at which the project was updated (a UNIX timestamp, in milliseconds) EnvironmentId int `json:"environmentId"` // The environment id that project is running on EnvironmentName string `json:"environmentName"` // The environment name that project is running on EnvironmentDescription string `json:"environmentDescription"` // The environment description that project is running on ApiKey string `json:"apiKey"` // The OpenTok project API key }
type ProjectStatus ¶
type ProjectStatus string
const ( /** * Set to ACTIVE to use the project API key. */ ProjectActive ProjectStatus = "ACTIVE" /** * Set to SUSPENDED, you will not be able to use the project API key (and any OpenTok sessions created with it). */ ProjectSuspended ProjectStatus = "SUSPENDED" )
type RTMPConfig ¶ added in v1.7.0
type Resolution ¶ added in v1.7.0
type Resolution string
const ( // The resolution of the archive. SD Resolution = "640x480" HD Resolution = "1280x720" )
type Role ¶ added in v1.2.0
type Role string
const ( /** * A publisher can publish streams, subscribe to streams, and signal. */ Publisher Role = "publisher" /** * A subscriber can only subscribe to streams. */ Subscriber Role = "subscriber" /** * In addition to the privileges granted to a publisher, in clients using * the OpenTok.js library, a moderator can call the forceUnpublish() and * forceDisconnect() method of the Session object. */ Moderator Role = "moderator" )
type SIP ¶ added in v1.8.0
type SIP struct { URI string `json:"uri"` From string `json:"from,omitempty"` Headers *SIPHeaders `json:"headers,omitempty"` Auth *SIPAuth `json:"auth,omitempty"` Secure bool `json:"secure,omitempty"` }
type SIPCall ¶ added in v1.8.0
type SIPCall struct { Id string `json:"id"` // A unique ID for the SIP call. ConnectionId string `json:"connectionId"` // The OpenTok connection ID for the SIP call's connection in the OpenTok session. StreamId string `json:"streamId"` // The OpenTok stream ID for the SIP call's stream in the OpenTok session. }
type SIPHeaders ¶ added in v1.8.0
type Session ¶
type Session struct { SessionId string `json:"session_id"` ProjectId string `json:"project_id"` CreateDt string `json:"create_dt"` MediaServerURL string `json:"media_server_url"` OpenTok *OpenTok `json:"-"` }
func (*Session) GenerateToken ¶
func (s *Session) GenerateToken(opts TokenOptions) (*string, error)
type SessionIdInfo ¶
type SessionOptions ¶
type SessionOptions struct { ArchiveMode ArchiveMode Location string MediaMode MediaMode }
type SignalData ¶ added in v1.6.0
type StorageOptions ¶ added in v1.5.0
type StreamClass ¶ added in v1.7.0
type StreamClassOptions ¶ added in v1.7.0
type StreamClassOptions struct {
Items []*StreamClass `json:"items"`
}
type StreamList ¶ added in v1.6.0
Click to show internal directories.
Click to hide internal directories.