controller

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleGateway

func HandleGateway(frags *config.ProxyFlags, watch *utils.RecordWatcher, storage utils.TokenStorage) http.Handler

Types

type AdminRequest

type AdminRequest struct {
	RoomID string `json:"room_id"`
}

type AllowSpeak

type AllowSpeak struct {
	UserID string
}

func ParseAsAllowSpeakRequest

func ParseAsAllowSpeakRequest(body map[string]interface{}) *AllowSpeak

type CancelRaiseHand

type CancelRaiseHand struct {
	UserID string
}

func ParseAsCancelRaiseHandRequest

func ParseAsCancelRaiseHandRequest(userID string) *CancelRaiseHand

type Create

type Create struct {
	Request  string `json:"request"`
	AdminKey string `json:"admin_key"`
	RoomID   string `json:"room"`

	Secret       string   `json:"secret"`
	IsPrivate    bool     `json:"is_private"`
	SeatToken    []string `json:"allowed"`
	SamplingRate int      `json:"sampling_rate"`

	AudioActivePackets int  `json:"audio_active_packets"`
	AudiolevelEvent    bool `json:"audiolevel_event"`
	AudioLevelAverage  int  `json:"audio_level_average"`

	Record     bool   `json:"record"`
	RecordFile string `json:"record_file"`
}

func NewCreate

func NewCreate(adminKey string, roomID string, secret string, capacity int, recordFile string) *Create

type DeniedSpeak

type DeniedSpeak struct {
	UserID  string `json:"user_id"`
	Success bool   `json:"success"`
}

func (*DeniedSpeak) MarshalAsOutputEvent

func (a *DeniedSpeak) MarshalAsOutputEvent() *ExternalAdaptor

type DenySpeak

type DenySpeak struct {
	UserID string
}

func ParseAsDenySpeakRequest

func ParseAsDenySpeakRequest(body map[string]interface{}) *DenySpeak

type Destroy

type Destroy struct {
	Request string `json:"request"`
	RoomID  string `json:"room"`
	Secret  string `json:"secret"`
}

func NewDestroy

func NewDestroy(roomID string, secret string) *Destroy

func NewListParticipants

func NewListParticipants(roomID string) *Destroy

type Error

type Error struct {
	Reason string `json:"reason"`
}

func (*Error) OutputEvent

func (a *Error) OutputEvent() *ExternalAdaptor

type ExternalAdaptor

type ExternalAdaptor struct {
	Type string      `json:"type"`
	Body interface{} `json:"body"`
}

func (*ExternalAdaptor) BodyAsMap

func (a *ExternalAdaptor) BodyAsMap() map[string]interface{}

type ExternalAdaptorType

type ExternalAdaptorType = string
const (
	/* body: everyone
	{"sdp": {}}
	*/
	RequestTypeJoin ExternalAdaptorType = "join"
	/* body: everyone
	{"candidate": {}}
	*/
	RequestTypeTrickle ExternalAdaptorType = "trickle"

	/* body: everyone
	{}
	*/
	RequestTypeRaiseHand ExternalAdaptorType = "raise_hand"
	/* body: everyone
	{}
	*/
	RequestTypeCancelRaiseHand ExternalAdaptorType = "cancel_raise_hand"

	/* body: only author
	{"user_id": ""}
	*/
	RequestTypeAllowSpeak ExternalAdaptorType = "allow_speak"
	/* body: only author
	{"user_id": ""}
	*/
	RequestTypeDenySpeak ExternalAdaptorType = "deny_speak"

	/* body: only author
	{"user_id": ""}
	*/
	RequestTypeKickSpeak ExternalAdaptorType = "kick_speak"
)

{"type": "", "body": {}}

type ExternalEventType

type ExternalEventType = string
const (
	/* body: to myself
	{"success": true, "id": "0 | 1 | 2 | 3 | 4 | 5", "user_id": "", "sdp": {}}
	*/
	EventTypeJoined ExternalEventType = "joined"
	/* body: to myself
	{"success": true, "user_id": "", "sdp": {}}
	*/
	EventTypeJoinedAsListener ExternalEventType = "joined_as_listener"

	/* body: to everyone
	{"success": true, "user_id": ""}
	*/
	EventTypeRaisedHand ExternalEventType = "raised_hand"
	/* body: to everyone
	{"success": true, "user_id": ""}
	*/
	EventTypeDeniedSpeak ExternalEventType = "denied_speak"

	/* body: to everyone
	{"success": true, "user_id": ""}
	*/
	EventTypeKickedSpeak ExternalEventType = "kicked_speak"

	/* body: to everyone
	[{"id", "0 | 1 | 2 | 3 | 4 | 5", "user_id": "", "role": "author | guest | listener"}]
	*/
	EventTypeParticipants ExternalEventType = "participants"

	/* body: to everyone
	{"id": "0 | 1 | 2 | 3 | 4 | 5"}
	*/
	EventTypeTalking ExternalEventType = "talking"

	/* body: to everyone
	{"id": "0 | 1 | 2 | 3 | 4 | 5"}
	*/
	EventTypeStoppedTalking ExternalEventType = "stopped_talking"

	/* body: to myself
	{"reason": ""}
	*/
	EventTypeError ExternalEventType = "error"
)

type JanusClient

type JanusClient struct {
	// contains filtered or unexported fields
}

func NewJanusClient

func NewJanusClient(wsUri string, roomID, userID string, isAuthor, isListener bool) *JanusClient

func (*JanusClient) Close

func (a *JanusClient) Close() error

func (*JanusClient) Connect

func (a *JanusClient) Connect() error

func (*JanusClient) Create

func (a *JanusClient) Create(capacity int) error

func (*JanusClient) Destroy

func (a *JanusClient) Destroy() error

func (*JanusClient) MetaFile

func (a *JanusClient) MetaFile() string

func (*JanusClient) Reader

func (a *JanusClient) Reader(conn *websocket.Conn)

func (*JanusClient) RecordFile

func (a *JanusClient) RecordFile() string

func (*JanusClient) WorkDir

func (a *JanusClient) WorkDir() string

func (*JanusClient) Writer

func (a *JanusClient) Writer(conn *websocket.Conn)

type Join

type Join struct {
	Request    string `json:"request"`
	RoomID     string `json:"room"`
	SeatToken  string `json:"id"`
	Token      string `json:"token"`
	UserID     string `json:"display"`
	Pin        string `json:"pin"`
	IsListener bool   `json:"muted"`

	Jsep interface{} `json:"jsep"`
}

func ParseAsJoinRequest

func ParseAsJoinRequest(body map[string]interface{}, roomID, userID, token string, isListener bool) *Join

type Joined

type Joined struct {
	ID        string      `json:"id"`
	UserID    string      `json:"user_id"`
	AnswerSdp interface{} `json:"sdp"`
	Success   bool        `json:"success"`
}

func (*Joined) MarshalAsOutputEvent

func (a *Joined) MarshalAsOutputEvent() *ExternalAdaptor

type JoinedAsListener

type JoinedAsListener struct {
	UserID    string      `json:"user_id"`
	AnswerSdp interface{} `json:"sdp"`
	Success   bool        `json:"success"`
}

func (*JoinedAsListener) MarshalAsOutputEvent

func (a *JoinedAsListener) MarshalAsOutputEvent() *ExternalAdaptor

type KickSpeak

type KickSpeak struct {
	UserID string
}

func ParseAsKickSpeakRequest

func ParseAsKickSpeakRequest(body map[string]interface{}) *KickSpeak

type KickedSpeak

type KickedSpeak struct {
	UserID  string `json:"user_id"`
	Success bool   `json:"success"`
}

func (*KickedSpeak) MarshalAsOutputEvent

func (a *KickedSpeak) MarshalAsOutputEvent() *ExternalAdaptor

type ListParticipants

type ListParticipants struct {
	Request string `json:"request"`
	RoomID  string `json:"room"`
}

type Metadata

type Metadata struct {
	Timestamp int64       `json:"timestamp"`
	Data      interface{} `json:"data"`
}

type Participant

type Participant struct {
	ID     string `json:"id"`
	UserID string `json:"user_id"`
	Role   string `json:"role"`
}

type Participants

type Participants []Participant

func (Participants) HaveSeatToken

func (a Participants) HaveSeatToken(token string) bool

func (Participants) MarshalAsOutputEvent

func (a Participants) MarshalAsOutputEvent() *ExternalAdaptor

type RaiseHand

type RaiseHand struct {
	UserID string
}

func ParseAsRaiseHandRequest

func ParseAsRaiseHandRequest(userID string) *RaiseHand

type RaisedHand

type RaisedHand struct {
	UserID  string `json:"user_id"`
	Success bool   `json:"success"`
}

func (*RaisedHand) MarshalAsOutputEvent

func (a *RaisedHand) MarshalAsOutputEvent() *ExternalAdaptor

type StoppedTalking

type StoppedTalking struct {
	UserID string `json:"id"`
}

func (*StoppedTalking) MarshalAsOutputEvent

func (a *StoppedTalking) MarshalAsOutputEvent() *ExternalAdaptor

type Talking

type Talking struct {
	UserID string `json:"id"`
}

func (*Talking) MarshalAsOutputEvent

func (a *Talking) MarshalAsOutputEvent() *ExternalAdaptor

type Trickle

type Trickle struct {
	Candidate interface{} `json:"candidate"`
}

func ParseAsTrickleRequest

func ParseAsTrickleRequest(body map[string]interface{}) *Trickle

func (*Trickle) MarshalToJanusRequest

func (a *Trickle) MarshalToJanusRequest() ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL