client

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: AGPL-3.0, Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TrackTypeVoice  = "voice"
	TrackTypeScreen = "screen"
)

Variables

View Source
var (
	ErrAlreadySubscribed = errors.New("already subscribed")
)

Functions

func ParseTrackID

func ParseTrackID(trackID string) (string, string, error)

ParseTrackID returns the track type and session ID for the given track ID.

Types

type CallJobState

type CallJobState struct {
	Type    string `json:"type"`
	InitAt  int64  `json:"init_at"`
	StartAt int64  `json:"start_at"`
	EndAt   int64  `json:"end_at"`
	Err     string `json:"err,omitempty"`
}

func (*CallJobState) FromMap

func (cjs *CallJobState) FromMap(m map[string]any)

type CallJoinMessage

type CallJoinMessage struct {
	ChannelID string `json:"channelID"`
	JobID     string `json:"jobID"`
}

type CallReconnectMessage

type CallReconnectMessage struct {
	ChannelID      string `json:"channelID"`
	OriginalConnID string `json:"originalConnID"`
	PrevConnID     string `json:"prevConnID"`
}

type Client

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

Client is a Golang implementation of a client for Mattermost Calls.

func New

func New(cfg Config, opts ...Option) (*Client, error)

New initializes and returns a new Calls client.

func (*Client) Close

func (c *Client) Close() error

Close permanently disconnects the client.

func (*Client) Connect

func (c *Client) Connect() error

Connect connects a call in the configured channel.

func (*Client) GetCallsConfig added in v0.15.0

func (c *Client) GetCallsConfig() (map[string]any, error)

TODO: return a proper Config object, ideally exposed in github.com/mattermost/mattermost-plugin-calls/server/public.

func (*Client) LowerHand added in v0.15.0

func (c *Client) LowerHand() error

func (*Client) Mute added in v0.15.0

func (c *Client) Mute() error

func (*Client) On

func (c *Client) On(eventType EventType, h EventHandler) error

On is used to subscribe to any events fired by the client. Note: there can only be one subscriber per event type.

func (*Client) RaiseHand added in v0.15.0

func (c *Client) RaiseHand() error

func (*Client) SendWS added in v0.14.0

func (c *Client) SendWS(ev string, msg any, binary bool) error

func (*Client) StartRecording added in v0.15.0

func (c *Client) StartRecording() error

func (*Client) StartScreenShare added in v0.15.0

func (c *Client) StartScreenShare(tracks []webrtc.TrackLocal) (*webrtc.RTPTransceiver, error)

func (*Client) StopRecording added in v0.15.0

func (c *Client) StopRecording() error

func (*Client) StopScreenShare added in v0.15.0

func (c *Client) StopScreenShare() error

func (*Client) Unmute added in v0.15.0

func (c *Client) Unmute(track webrtc.TrackLocal) error

type Config

type Config struct {
	// SiteURL is the URL of the Mattermost installation to connect to.
	SiteURL string
	// AuthToken is a valid user session authentication token.
	AuthToken string
	// ChannelID is the id of the channel to start or join a call in.
	ChannelID string
	// JobID is an id used to identify bot initiated sessions (e.g.
	// recording/transcription)
	JobID string
	// contains filtered or unexported fields
}

func (*Config) Parse

func (c *Config) Parse() error

type EventHandler

type EventHandler func(ctx any) error

type EventType

type EventType string
const (
	RTCConnectEvent    EventType = "RTCConnect"
	RTCDisconnectEvent EventType = "RTCDisconnect"
	RTCTrackEvent      EventType = "RTCTrack"

	CloseEvent EventType = "Close"
	ErrorEvent EventType = "Error"

	WSConnectEvent            EventType = "WSConnect"
	WSDisconnectEvent         EventType = "WSDisconnect"
	WSCallJoinEvent           EventType = "WSCallJoin"
	WSCallRecordingStateEvent EventType = "WSCallRecordingState" // DEPRECATED
	WSCallJobStateEvent       EventType = "WSCallJobState"
	WSJobStopEvent            EventType = "WSStopJobEvent"
	WSCallHostChangedEvent    EventType = "WSCallHostChanged"
	WSCallMutedEvent          EventType = "WSCallMuted"
	WSCallUnmutedEvent        EventType = "WSCallUnmuted"
	WSCallRaisedHandEvent     EventType = "WSCallRaisedHand"
	WSCallLoweredHandEvent    EventType = "WSCallLoweredHand"
	WSCallScreenOnEvent       EventType = "WSCallScreenOn"
	WSCallScreenOffEvent      EventType = "WSCallScreenOff"
)

func (EventType) IsValid added in v0.15.0

func (e EventType) IsValid() bool

type Option

type Option func(c *Client) error

Jump to

Keyboard shortcuts

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