client

package
v1.9.8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 40 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWebSocketConn

func NewWebSocketConn(host, token string, opts *Options) (*websocket.Conn, error)

func SetAuthorizationToken

func SetAuthorizationToken(header http.Header, token string)

Types

type AddTrackOption added in v1.8.1

type AddTrackOption func(params *AddTrackParams)

func AddTrackNoWriter added in v1.8.1

func AddTrackNoWriter() AddTrackOption

type AddTrackParams added in v1.8.1

type AddTrackParams struct {
	NoWriter bool
}

type DataChannelReader added in v1.8.1

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

func NewDataChannelReader added in v1.8.1

func NewDataChannelReader(bitrate int) *DataChannelReader

func (*DataChannelReader) Read added in v1.8.1

func (d *DataChannelReader) Read(p []byte, sid string)

type DataTrackRemote added in v1.9.7

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

func NewDataTrackRemote added in v1.9.7

func NewDataTrackRemote(
	publisherIdentity livekit.ParticipantIdentity,
	publisherID livekit.ParticipantID,
	handle uint16,
	trackID livekit.TrackID,
	logger logger.Logger,
) *DataTrackRemote

func (*DataTrackRemote) Close added in v1.9.7

func (d *DataTrackRemote) Close()

func (*DataTrackRemote) Handle added in v1.9.7

func (d *DataTrackRemote) Handle() uint16

func (*DataTrackRemote) ID added in v1.9.7

func (*DataTrackRemote) NumReceivedPackets added in v1.9.7

func (d *DataTrackRemote) NumReceivedPackets() uint32

func (*DataTrackRemote) PacketReceived added in v1.9.7

func (d *DataTrackRemote) PacketReceived(packet *datatrack.Packet)

type Options added in v0.9.4

type Options struct {
	AutoSubscribe             bool
	Publish                   string
	Attributes                map[string]string
	ClientInfo                *livekit.ClientInfo
	DisabledCodecs            []webrtc.RTPCodecCapability
	TokenCustomizer           func(token *auth.AccessToken, grants *auth.VideoGrant)
	SignalRequestInterceptor  SignalRequestInterceptor
	SignalResponseInterceptor SignalResponseInterceptor
	UseJoinRequestQueryParam  bool
}

type RTCClient

type RTCClient struct {
	OnConnected             func()
	OnDataReceived          func(data []byte, sid string)
	OnDataUnlabeledReceived func(data []byte)
	// contains filtered or unexported fields
}

func NewRTCClient

func NewRTCClient(conn *websocket.Conn, useSinglePeerConnection bool, opts *Options) (*RTCClient, error)

func (*RTCClient) AddFileTrack

func (c *RTCClient) AddFileTrack(path string, id string, label string) (writer TrackWriter, err error)

func (*RTCClient) AddStaticTrack

func (c *RTCClient) AddStaticTrack(mime string, id string, label string, opts ...AddTrackOption) (writer TrackWriter, err error)

func (*RTCClient) AddStaticTrackWithCodec added in v0.14.2

func (c *RTCClient) AddStaticTrackWithCodec(codec webrtc.RTPCodecCapability, id string, label string, opts ...AddTrackOption) (writer TrackWriter, err error)

func (*RTCClient) AddTrack

func (c *RTCClient) AddTrack(track *webrtc.TrackLocalStaticSample, path string, opts ...AddTrackOption) (writer TrackWriter, err error)

func (*RTCClient) BytesReceived

func (c *RTCClient) BytesReceived() uint64

func (*RTCClient) GetPublishedTrackIDs added in v0.15.3

func (c *RTCClient) GetPublishedTrackIDs() []string

func (*RTCClient) GetRemoteParticipant added in v0.15.2

func (c *RTCClient) GetRemoteParticipant(sid livekit.ParticipantID) *livekit.ParticipantInfo

func (*RTCClient) GetSubscriptionResponseAndClear added in v1.4.3

func (c *RTCClient) GetSubscriptionResponseAndClear() *livekit.SubscriptionResponse

func (*RTCClient) ID

func (*RTCClient) LastAnswer added in v1.4.3

func (c *RTCClient) LastAnswer() *webrtc.SessionDescription

LastAnswer return SDP of the last answer for the publisher connection

func (*RTCClient) PongReceivedAt added in v1.2.0

func (c *RTCClient) PongReceivedAt() int64

func (*RTCClient) PublishData added in v0.13.0

func (c *RTCClient) PublishData(data []byte, kind livekit.DataPacket_Kind) error

func (*RTCClient) PublishDataTrack added in v1.9.7

func (c *RTCClient) PublishDataTrack() (writer TrackWriter, err error)

func (*RTCClient) PublishDataUnlabeled added in v1.9.0

func (c *RTCClient) PublishDataUnlabeled(data []byte) error

func (*RTCClient) ReadResponse

func (c *RTCClient) ReadResponse() (*livekit.SignalResponse, error)

func (*RTCClient) RefreshToken added in v0.15.3

func (c *RTCClient) RefreshToken() string

func (*RTCClient) RemoteParticipants

func (c *RTCClient) RemoteParticipants() []*livekit.ParticipantInfo

func (*RTCClient) Run

func (c *RTCClient) Run() error

create an offer for the server

func (*RTCClient) SendAddTrack

func (c *RTCClient) SendAddTrack(cid string, mimeType string, name string, trackType livekit.TrackType) error

send AddTrack command to server to initiate server-side negotiation

func (*RTCClient) SendIceCandidate

func (c *RTCClient) SendIceCandidate(ic *webrtc.ICECandidate, target livekit.SignalTarget) error

func (*RTCClient) SendNacks

func (c *RTCClient) SendNacks(count int)

func (*RTCClient) SendPing added in v1.2.0

func (c *RTCClient) SendPing() error

func (*RTCClient) SendRequest

func (c *RTCClient) SendRequest(msg *livekit.SignalRequest) error

func (*RTCClient) SetAttributes added in v1.6.3

func (c *RTCClient) SetAttributes(attrs map[string]string) error

func (*RTCClient) Stop

func (c *RTCClient) Stop()

func (*RTCClient) SubscribedDataTracks added in v1.9.7

func (c *RTCClient) SubscribedDataTracks() map[livekit.ParticipantID]map[uint16]*DataTrackRemote

func (*RTCClient) SubscribedTracks

func (c *RTCClient) SubscribedTracks() map[livekit.ParticipantID][]*webrtc.TrackRemote

func (*RTCClient) WaitUntilConnected

func (c *RTCClient) WaitUntilConnected() error

type SignalRequestHandler added in v1.4.5

type SignalRequestHandler func(msg *livekit.SignalRequest) error

type SignalRequestInterceptor added in v1.4.5

type SignalRequestInterceptor func(msg *livekit.SignalRequest, next SignalRequestHandler) error

type SignalResponseHandler added in v1.4.5

type SignalResponseHandler func(msg *livekit.SignalResponse) error

type SignalResponseInterceptor added in v1.4.5

type SignalResponseInterceptor func(msg *livekit.SignalResponse, next SignalResponseHandler) error

type TrackWriter

type TrackWriter interface {
	Start() error
	Stop()
}

func NewDataTrackWriter added in v1.9.7

func NewDataTrackWriter(ctx context.Context, handle uint16, transport types.DataTrackTransport) TrackWriter

func NewTrackWriter

func NewTrackWriter(ctx context.Context, track *webrtc.TrackLocalStaticSample, filePath string) TrackWriter

Jump to

Keyboard shortcuts

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