Documentation ¶
Overview ¶
Author: majianyu Create Date: 2019-06-06 Description: version V1.0
Index ¶
- Constants
- func CheckResponseError(resp *http.Response) error
- type Archive
- type ArchiveOptions
- type ArchiveReq
- type ArchiveResponse
- type ArchiveService
- type ArchiveServiceOp
- func (this *ArchiveServiceOp) Delete(archiveId string) (err error)
- func (this *ArchiveServiceOp) Get(archiveId string) (resp *Archive, err error)
- func (this *ArchiveServiceOp) List(options interface{}) (resp *ArchiveResponse, err error)
- func (this *ArchiveServiceOp) Start(data ArchiveReq) (resp *Archive, err error)
- func (this *ArchiveServiceOp) Stop(archiveId string) (resp *Archive, err error)
- type Layout
- type MediaMode
- type ResponseError
- type Role
- type Session
- type StreamItem
- type StreamOption
- type StreamResponse
- type StreamService
- type StreamServiceOp
- type Tokbox
- func (this *Tokbox) CreateAndDo(method, path string, data, options, resource interface{}) error
- func (this *Tokbox) Delete(path string, resource, options interface{}) error
- func (this *Tokbox) Do(req *http.Request, v interface{}) error
- func (this *Tokbox) Get(path string, resource, options interface{}) error
- func (this *Tokbox) NewRequest(method, urlStr string, body, options interface{}) (*http.Request, error)
- func (t *Tokbox) NewSession(location string, mm MediaMode, ctx ...context.Context) (*Session, error)
- func (this *Tokbox) Post(path string, data, resource interface{}) error
- func (this *Tokbox) Put(path string, data, resource interface{}) error
Constants ¶
View Source
const ( Days30 = 2592000 //30 * 24 * 60 * 60 Weeks1 = 604800 //7 * 24 * 60 * 60 Hours24 = 86400 //24 * 60 * 60 Hours2 = 7200 //60 * 60 * 2 Hours1 = 3600 //60 * 60 )
View Source
const ( /** * A publisher can publish streams, subscribe to streams, and signal. */ Publisher Role = "publisher" /** * A subscriber can only subscribe to streams. */ Subscriber = "subscriber" /** * In addition to the privileges granted to a publisher, in clients using the OpenTok.js 2.2 * library, a moderator can call the <code>forceUnpublish()</code> and * <code>forceDisconnect()</code> method of the Session object. */ Moderator = "moderator" )
Variables ¶
This section is empty.
Functions ¶
func CheckResponseError ¶
Types ¶
type Archive ¶
type Archive struct { CreatedAt int64 `json:"createdAt"` Duration int `json:"duration"` HasAudio bool `json:"hasAudio"` HasVideo bool `json:"hasVideo"` ID string `json:"id"` // archive id Name string `json:"name"` OutputMode string `json:"outputMode"` ProjectID int `json:"projectId"` Reason string `json:"reason"` Resolution string `json:"resolution"` SessionID string `json:"sessionId"` Size int `json:"size"` Status string `json:"status"` URL interface{} `json:"url"` }
type ArchiveOptions ¶
type ArchiveOptions struct { Offset int `url:"offset,omitempty"` // default 0 Count int `url:"count,omitempty"` // default 50 SessionId string `url:"session_id,omitempty"` // default null, get all archive list }
url query options
type ArchiveReq ¶
type ArchiveReq struct { SessionID string `json:"sessionId"` HasAudio bool `json:"hasAudio"` HasVideo bool `json:"hasVideo"` Layout Layout `json:"layout"` Name string `json:"name"` // (Optional) The name of the archive (for your own identification) OutputMode string `json:"outputMode"` // composed (default) | individual Resolution string `json:"resolution"` // 640x480 (default) | 1280x720 }
request body
func DefaultArchiveReq ¶
func DefaultArchiveReq(sessionId, name string) ArchiveReq
type ArchiveResponse ¶
response
func (*ArchiveResponse) Json ¶
func (this *ArchiveResponse) Json() string
type ArchiveService ¶
type ArchiveServiceOp ¶
type ArchiveServiceOp struct {
// contains filtered or unexported fields
}
func (*ArchiveServiceOp) Delete ¶
func (this *ArchiveServiceOp) Delete(archiveId string) (err error)
func (*ArchiveServiceOp) Get ¶
func (this *ArchiveServiceOp) Get(archiveId string) (resp *Archive, err error)
func (*ArchiveServiceOp) List ¶
func (this *ArchiveServiceOp) List(options interface{}) (resp *ArchiveResponse, err error)
func (*ArchiveServiceOp) Start ¶
func (this *ArchiveServiceOp) Start(data ArchiveReq) (resp *Archive, err error)
type MediaMode ¶
type MediaMode string
const ( /** * The session will send streams using the OpenTok Media Router. */ MediaRouter MediaMode = "disabled" /** * The session will attempt send streams directly between clients. If clients cannot connect * due to firewall restrictions, the session uses the OpenTok TURN server to relay streams. */ P2P = "enabled" )
type ResponseError ¶
type ResponseError struct { Code int `json:"code"` Message string `json:"message"` Description string `json:"description"` }
func (ResponseError) Error ¶
func (this ResponseError) Error() string
type Session ¶
type Session struct { SessionId string `json:"session_id"` ProjectId string `json:"project_id"` PartnerId string `json:"partner_id"` CreateDt string `json:"create_dt"` SessionStatus string `json:"session_status"` MediaServerURL string `json:"media_server_url"` T *Tokbox `json:"-"` }
type StreamItem ¶
type StreamItem struct { ID string `json:"id"` SessionID string `json:"sessionId"` ProjectID int `json:"projectId"` CreatedAt int64 `json:"createdAt"` UpdatedAt int64 `json:"updatedAt"` Resolution string `json:"resolution"` BroadcastUrls struct { Hls string `json:"hls"` Rtmp struct { Foo struct { ServerURL string `json:"serverUrl"` StreamName string `json:"streamName"` Status string `json:"status"` } `json:"foo"` Bar struct { ServerURL string `json:"serverUrl"` StreamName string `json:"streamName"` Status string `json:"status"` } `json:"bar"` } `json:"rtmp"` } `json:"broadcastUrls"` Status string `json:"status"` }
type StreamOption ¶
type StreamResponse ¶
type StreamResponse struct { Count int `json:"count"` Items []StreamItem `json:"items"` }
func (StreamResponse) Json ¶
func (this StreamResponse) Json() string
type StreamService ¶
type StreamService interface {
List(interface{}) (resp *StreamResponse, error error)
}
type StreamServiceOp ¶
type StreamServiceOp struct {
// contains filtered or unexported fields
}
func (*StreamServiceOp) List ¶
func (this *StreamServiceOp) List(options interface{}) (resp *StreamResponse, err error)
type Tokbox ¶
type Tokbox struct { Client *http.Client BetaUrl string //Endpoint for Beta Programs Archive ArchiveService // Archive sdk Stream StreamService // Stream sdk // contains filtered or unexported fields }
func (*Tokbox) CreateAndDo ¶
func (*Tokbox) NewRequest ¶
func (*Tokbox) NewSession ¶
func (t *Tokbox) NewSession(location string, mm MediaMode, ctx ...context.Context) (*Session, error)
Creates a new tokbox session or returns an error. See README file for full documentation: https://github.com/pjebs/tokbox NOTE: ctx must be nil if *not* using Google App Engine
Click to show internal directories.
Click to hide internal directories.