Documentation
¶
Index ¶
- Constants
- Variables
- func ChatMessage(ts time.Time, text string) *livekit.ChatMessage
- func DecryptGCMAudioSample(sample, key, sifTrailer []byte) ([]byte, error)
- func DecryptGCMAudioSampleCustomCipher(sample, sifTrailer []byte, cipherBlock cipher.Block) ([]byte, error)
- func DeriveKeyFromBytes(secret []byte) ([]byte, error)
- func DeriveKeyFromBytesCustomSalt(secret []byte, salt string) ([]byte, error)
- func DeriveKeyFromString(password string) ([]byte, error)
- func DeriveKeyFromStringCustomSalt(password, salt string) ([]byte, error)
- func EncryptGCMAudioSample(sample, key []byte, kid uint8) ([]byte, error)
- func EncryptGCMAudioSampleCustomCipher(sample []byte, kid uint8, cipherBlock cipher.Block) ([]byte, error)
- func ReaderTrackWithFrameDuration(duration time.Duration) func(provider *ReaderSampleProvider)
- func ReaderTrackWithH26xStreamingFormat(h26xStreamingFormat H26xStreamingFormat) func(provider *ReaderSampleProvider)
- func ReaderTrackWithMime(mime string) func(provider *ReaderSampleProvider)
- func ReaderTrackWithOnWriteComplete(f func()) func(provider *ReaderSampleProvider)
- func ReaderTrackWithRTCPHandler(f func(rtcp.Packet)) func(provider *ReaderSampleProvider)
- func ReaderTrackWithSampleOptions(opts ...LocalTrackOptions) func(provider *ReaderSampleProvider)
- func SIPStatusFrom(err error) *livekit.SIPStatus
- func SetLogger(l protoLogger.Logger)
- type AgentClient
- func (c *AgentClient) CreateAgent(ctx context.Context, req *livekit.CreateAgentRequest) (*livekit.CreateAgentResponse, error)
- func (c *AgentClient) DeleteAgent(ctx context.Context, req *livekit.DeleteAgentRequest) (*livekit.DeleteAgentResponse, error)
- func (c *AgentClient) DeployAgent(ctx context.Context, req *livekit.DeployAgentRequest) (*livekit.DeployAgentResponse, error)
- func (c *AgentClient) GetClientSettings(ctx context.Context, req *livekit.ClientSettingsRequest) (*livekit.ClientSettingsResponse, error)
- func (c *AgentClient) ListAgentSecrets(ctx context.Context, req *livekit.ListAgentSecretsRequest) (*livekit.ListAgentSecretsResponse, error)
- func (c *AgentClient) ListAgentVersions(ctx context.Context, req *livekit.ListAgentVersionsRequest) (*livekit.ListAgentVersionsResponse, error)
- func (c *AgentClient) ListAgents(ctx context.Context, req *livekit.ListAgentsRequest) (*livekit.ListAgentsResponse, error)
- func (c *AgentClient) RestartAgent(ctx context.Context, req *livekit.RestartAgentRequest) (*livekit.RestartAgentResponse, error)
- func (c *AgentClient) RollbackAgent(ctx context.Context, req *livekit.RollbackAgentRequest) (*livekit.RollbackAgentResponse, error)
- func (c *AgentClient) UpdateAgent(ctx context.Context, req *livekit.UpdateAgentRequest) (*livekit.UpdateAgentResponse, error)
- func (c *AgentClient) UpdateAgentSecrets(ctx context.Context, req *livekit.UpdateAgentSecretsRequest) (*livekit.UpdateAgentSecretsResponse, error)
- type AgentDispatchClient
- func (c *AgentDispatchClient) CreateDispatch(ctx context.Context, req *livekit.CreateAgentDispatchRequest) (*livekit.AgentDispatch, error)
- func (c *AgentDispatchClient) DeleteDispatch(ctx context.Context, req *livekit.DeleteAgentDispatchRequest) (*livekit.AgentDispatch, error)
- func (c *AgentDispatchClient) ListDispatch(ctx context.Context, req *livekit.ListAgentDispatchRequest) (*livekit.ListAgentDispatchResponse, error)
- type AudioSampleProvider
- type BaseSampleProvider
- type ByteStreamHandler
- type ByteStreamInfo
- type ByteStreamReader
- type ByteStreamWriter
- type ConnectInfo
- type ConnectOption
- func WithAutoSubscribe(val bool) ConnectOption
- func WithDisableRegionDiscovery() ConnectOption
- func WithExtraAttributes(attrs map[string]string) ConnectOption
- func WithICETransportPolicy(iceTransportPolicy webrtc.ICETransportPolicy) ConnectOption
- func WithInterceptors(interceptors []interceptor.Factory) ConnectOption
- func WithMetadata(metadata string) ConnectOption
- func WithPacer(pacer pacer.Factory) ConnectOption
- func WithRetransmitBufferSize(val uint16) ConnectOption
- type ConnectionState
- type DataPacket
- type DataPublishOption
- type DataReceiveParams
- type DisconnectionReason
- type EgressClient
- func (c *EgressClient) ListEgress(ctx context.Context, req *livekit.ListEgressRequest) (*livekit.ListEgressResponse, error)
- func (c *EgressClient) StartParticipantEgress(ctx context.Context, req *livekit.ParticipantEgressRequest) (*livekit.EgressInfo, error)
- func (c *EgressClient) StartRoomCompositeEgress(ctx context.Context, req *livekit.RoomCompositeEgressRequest) (*livekit.EgressInfo, error)
- func (c *EgressClient) StartTrackCompositeEgress(ctx context.Context, req *livekit.TrackCompositeEgressRequest) (*livekit.EgressInfo, error)
- func (c *EgressClient) StartTrackEgress(ctx context.Context, req *livekit.TrackEgressRequest) (*livekit.EgressInfo, error)
- func (c *EgressClient) StartWebEgress(ctx context.Context, req *livekit.WebEgressRequest) (*livekit.EgressInfo, error)
- func (c *EgressClient) StopEgress(ctx context.Context, req *livekit.StopEgressRequest) (*livekit.EgressInfo, error)
- func (c *EgressClient) UpdateLayout(ctx context.Context, req *livekit.UpdateLayoutRequest) (*livekit.EgressInfo, error)
- func (c *EgressClient) UpdateStream(ctx context.Context, req *livekit.UpdateStreamRequest) (*livekit.EgressInfo, error)
- type H26xStreamingFormat
- type IngressClient
- func (c *IngressClient) CreateIngress(ctx context.Context, in *livekit.CreateIngressRequest) (*livekit.IngressInfo, error)
- func (c *IngressClient) DeleteIngress(ctx context.Context, in *livekit.DeleteIngressRequest) (*livekit.IngressInfo, error)
- func (c *IngressClient) ListIngress(ctx context.Context, in *livekit.ListIngressRequest) (*livekit.ListIngressResponse, error)
- func (c *IngressClient) UpdateIngress(ctx context.Context, in *livekit.UpdateIngressRequest) (*livekit.IngressInfo, error)
- type LocalParticipant
- func (p *LocalParticipant) Attributes() map[string]string
- func (p *LocalParticipant) AudioLevel() float32
- func (p *LocalParticipant) GetPublisherPeerConnection() *webrtc.PeerConnection
- func (p *LocalParticipant) GetSubscriberPeerConnection() *webrtc.PeerConnection
- func (p *LocalParticipant) GetTrackPublication(source livekit.TrackSource) TrackPublication
- func (p *LocalParticipant) HandleIncomingRpcAck(requestId string)
- func (p *LocalParticipant) HandleIncomingRpcResponse(requestId string, payload *string, error *RpcError)
- func (p *LocalParticipant) Identity() string
- func (p *LocalParticipant) IsCameraEnabled() bool
- func (p *LocalParticipant) IsMicrophoneEnabled() bool
- func (p *LocalParticipant) IsScreenShareAudioEnabled() bool
- func (p *LocalParticipant) IsScreenShareEnabled() bool
- func (p *LocalParticipant) IsSpeaking() bool
- func (p *LocalParticipant) Kind() ParticipantKind
- func (p *LocalParticipant) Metadata() string
- func (p *LocalParticipant) Name() string
- func (p *LocalParticipant) PerformRpc(params PerformRpcParams) (*string, error)
- func (p *LocalParticipant) Permissions() *livekit.ParticipantPermission
- func (p *LocalParticipant) PublishData(payload []byte, opts ...DataPublishOption) errordeprecated
- func (p *LocalParticipant) PublishDataPacket(pck DataPacket, opts ...DataPublishOption) error
- func (p *LocalParticipant) PublishSimulcastTrack(tracks []*LocalTrack, opts *TrackPublicationOptions, ...) (*LocalTrackPublication, error)
- func (p *LocalParticipant) PublishTrack(track webrtc.TrackLocal, opts *TrackPublicationOptions, ...) (*LocalTrackPublication, error)
- func (p *LocalParticipant) SID() string
- func (p *LocalParticipant) SendFile(filePath string, options StreamBytesOptions) (*ByteStreamInfo, error)
- func (p *LocalParticipant) SendText(text string, options StreamTextOptions) *TextStreamInfo
- func (p *LocalParticipant) SetAttributes(attrs map[string]string)
- func (p *LocalParticipant) SetLogger(log protoLogger.Logger)
- func (p *LocalParticipant) SetMetadata(metadata string)
- func (p *LocalParticipant) SetName(name string)
- func (p *LocalParticipant) SetSubscriptionPermission(sp *livekit.SubscriptionPermission)
- func (p *LocalParticipant) StreamBytes(options StreamBytesOptions) *ByteStreamWriter
- func (p *LocalParticipant) StreamText(options StreamTextOptions) *TextStreamWriter
- func (p *LocalParticipant) TrackPublications() []TrackPublication
- func (p *LocalParticipant) UnpublishTrack(sid string) error
- type LocalSampleTrack
- type LocalSampleTrackOptions
- type LocalTrack
- func NewLocalFileTrack(file string, options ...ReaderSampleProviderOption) (*LocalTrack, error)
- func NewLocalReaderTrack(in io.ReadCloser, mime string, options ...ReaderSampleProviderOption) (*LocalTrack, error)
- func NewLocalSampleTrack(c webrtc.RTPCodecCapability, opts ...LocalTrackOptions) (*LocalTrack, error)
- func NewLocalTrack(c webrtc.RTPCodecCapability, opts ...LocalTrackOptions) (*LocalTrack, error)
- func (s *LocalTrack) Bind(t webrtc.TrackLocalContext) (webrtc.RTPCodecParameters, error)
- func (s *LocalTrack) Close() error
- func (s *LocalTrack) Codec() webrtc.RTPCodecCapability
- func (s *LocalTrack) ID() string
- func (s *LocalTrack) IsBound() bool
- func (s *LocalTrack) Kind() webrtc.RTPCodecType
- func (s *LocalTrack) OnBind(f func())
- func (s *LocalTrack) OnUnbind(f func())
- func (s *LocalTrack) RID() string
- func (s *LocalTrack) SSRC() webrtc.SSRC
- func (s *LocalTrack) SetLogger(l protoLogger.Logger)
- func (s *LocalTrack) SetTransceiver(transceiver *webrtc.RTPTransceiver)
- func (s *LocalTrack) StartWrite(provider SampleProvider, onComplete func()) error
- func (s *LocalTrack) StreamID() string
- func (s *LocalTrack) Unbind(t webrtc.TrackLocalContext) error
- func (s *LocalTrack) WriteRTP(p *rtp.Packet, opts *SampleWriteOptions) error
- func (s *LocalTrack) WriteSample(sample media.Sample, opts *SampleWriteOptions) error
- type LocalTrackOptions
- type LocalTrackPublication
- func (p *LocalTrackPublication) CloseTrack()
- func (p *LocalTrackPublication) GetSimulcastTrack(quality livekit.VideoQuality) *LocalTrack
- func (p *LocalTrackPublication) IsMuted() bool
- func (p *LocalTrackPublication) IsSubscribed() bool
- func (p *LocalTrackPublication) Kind() TrackKind
- func (p *LocalTrackPublication) MimeType() string
- func (p *LocalTrackPublication) Name() string
- func (p *LocalTrackPublication) PublicationOptions() TrackPublicationOptions
- func (p *LocalTrackPublication) SID() string
- func (p *LocalTrackPublication) SetLogger(log protoLogger.Logger)
- func (p *LocalTrackPublication) SetMuted(muted bool)
- func (p *LocalTrackPublication) SimulateDisconnection(duration time.Duration)
- func (p *LocalTrackPublication) Source() livekit.TrackSource
- func (p *LocalTrackPublication) Track() Track
- func (p *LocalTrackPublication) TrackInfo() *livekit.TrackInfo
- func (p *LocalTrackPublication) TrackLocal() webrtc.TrackLocal
- func (p *LocalTrackPublication) TrackLocalForSimulcast() []*LocalTrack
- type LocalTrackPublishOption
- type LocalTrackPublishOptions
- type LocalTrackWithClose
- type MuteFunc
- type NullSampleProvider
- type PCTransport
- func (t *PCTransport) AddICECandidate(candidate webrtc.ICECandidateInit) error
- func (t *PCTransport) Close() error
- func (t *PCTransport) GetLocalOffer() (webrtc.SessionDescription, error)
- func (t *PCTransport) GetSelectedCandidatePair() (*webrtc.ICECandidatePair, error)
- func (t *PCTransport) IsConnected() bool
- func (t *PCTransport) Negotiate()
- func (t *PCTransport) OnRemoteDescriptionSettled(f func() error)
- func (t *PCTransport) PeerConnection() *webrtc.PeerConnection
- func (t *PCTransport) SetConfiguration(config webrtc.Configuration) error
- func (t *PCTransport) SetLocalOffer(offer webrtc.SessionDescription)
- func (t *PCTransport) SetLogger(l protoLogger.Logger)
- func (t *PCTransport) SetRTT(rtt uint32)
- func (t *PCTransport) SetRemoteDescription(sd webrtc.SessionDescription) error
- type PCTransportParams
- type PLIWriter
- type Participant
- type ParticipantAttributesChangedFunc
- type ParticipantCallback
- type ParticipantKind
- type PerformRpcParams
- type PhoneNumberClient
- func (p *PhoneNumberClient) GetPhoneNumber(ctx context.Context, in *livekit.GetPhoneNumberRequest) (*livekit.GetPhoneNumberResponse, error)
- func (p *PhoneNumberClient) ListPhoneNumbers(ctx context.Context, in *livekit.ListPhoneNumbersRequest) (*livekit.ListPhoneNumbersResponse, error)
- func (p *PhoneNumberClient) PurchasePhoneNumber(ctx context.Context, in *livekit.PurchasePhoneNumberRequest) (*livekit.PurchasePhoneNumberResponse, error)
- func (p *PhoneNumberClient) ReleasePhoneNumbers(ctx context.Context, in *livekit.ReleasePhoneNumbersRequest) (*livekit.ReleasePhoneNumbersResponse, error)
- func (p *PhoneNumberClient) SearchPhoneNumbers(ctx context.Context, in *livekit.SearchPhoneNumbersRequest) (*livekit.SearchPhoneNumbersResponse, error)
- func (p *PhoneNumberClient) UpdatePhoneNumber(ctx context.Context, in *livekit.UpdatePhoneNumberRequest) (*livekit.UpdatePhoneNumberResponse, error)
- type Private
- type PubCallback
- type RTCEngine
- func (e *RTCEngine) Close()
- func (e *RTCEngine) GetDataChannel(kind livekit.DataPacket_Kind) *webrtc.DataChannel
- func (e *RTCEngine) GetDataChannelSub(kind livekit.DataPacket_Kind) *webrtc.DataChannel
- func (e *RTCEngine) IsConnected() bool
- func (e *RTCEngine) JoinContext(ctx context.Context, url string, token string, ...) (bool, error)
- func (e *RTCEngine) OnAnswer(sd webrtc.SessionDescription, answerId uint32, _midToTrackID map[string]string)
- func (e *RTCEngine) OnClose(onClose func())
- func (e *RTCEngine) OnConnectionQuality(cqi []*livekit.ConnectionQualityInfo)
- func (e *RTCEngine) OnJoinResponse(res *livekit.JoinResponse) error
- func (e *RTCEngine) OnLeave(leave *livekit.LeaveRequest)
- func (e *RTCEngine) OnLocalTrackPublished(res *livekit.TrackPublishedResponse)
- func (e *RTCEngine) OnLocalTrackSubscribed(trackSubscribed *livekit.TrackSubscribed)
- func (e *RTCEngine) OnLocalTrackUnpublished(res *livekit.TrackUnpublishedResponse)
- func (e *RTCEngine) OnMediaSectionsRequirement(mediaSectionsRequirement *livekit.MediaSectionsRequirement)
- func (e *RTCEngine) OnOffer(sd webrtc.SessionDescription, offerId uint32, _midToTrackID map[string]string)
- func (e *RTCEngine) OnParticipantUpdate(info []*livekit.ParticipantInfo)
- func (e *RTCEngine) OnReconnectResponse(res *livekit.ReconnectResponse) error
- func (e *RTCEngine) OnRoomMoved(moved *livekit.RoomMovedResponse)
- func (e *RTCEngine) OnRoomUpdate(room *livekit.Room)
- func (e *RTCEngine) OnSpeakersChanged(si []*livekit.SpeakerInfo)
- func (e *RTCEngine) OnSubscribedAudioCodecUpdate(subscribedAudioCodecUpdate *livekit.SubscribedAudioCodecUpdate)
- func (e *RTCEngine) OnSubscribedQualityUpdate(subscribedQualityUpdate *livekit.SubscribedQualityUpdate)
- func (e *RTCEngine) OnTokenRefresh(refreshToken string)
- func (e *RTCEngine) OnTrackRemoteMuted(request *livekit.MuteTrackRequest)
- func (e *RTCEngine) OnTransportClose()
- func (e *RTCEngine) OnTrickle(init webrtc.ICECandidateInit, target livekit.SignalTarget)
- func (e *RTCEngine) Publisher() (*PCTransport, bool)
- func (e *RTCEngine) RegisterTrackPublishedListener(cid string, c chan *livekit.TrackPublishedResponse)
- func (e *RTCEngine) SendAddTrack(addTrack *livekit.AddTrackRequest) error
- func (e *RTCEngine) SendLeaveWithReason(reason livekit.DisconnectReason) error
- func (e *RTCEngine) SendMuteTrack(sid string, muted bool) error
- func (e *RTCEngine) SendSubscriptionPermission(subscriptionPermission *livekit.SubscriptionPermission) error
- func (e *RTCEngine) SendSyncState(syncState *livekit.SyncState) error
- func (e *RTCEngine) SendUpdateParticipantMetadata(metadata *livekit.UpdateParticipantMetadata) error
- func (e *RTCEngine) SendUpdateSubscription(updateSubscription *livekit.UpdateSubscription) error
- func (e *RTCEngine) SendUpdateTrackSettings(settings *livekit.UpdateTrackSettings) error
- func (e *RTCEngine) SetLogger(l protoLogger.Logger)
- func (e *RTCEngine) Simulate(scenario SimulateScenario)
- func (e *RTCEngine) Subscriber() (*PCTransport, bool)
- func (e *RTCEngine) UnregisterTrackPublishedListener(cid string)
- type ReaderSampleProvider
- type ReaderSampleProviderOption
- type RemoteParticipant
- func (p *RemoteParticipant) Attributes() map[string]string
- func (p *RemoteParticipant) AudioLevel() float32
- func (p *RemoteParticipant) GetTrackPublication(source livekit.TrackSource) TrackPublication
- func (p *RemoteParticipant) Identity() string
- func (p *RemoteParticipant) IsCameraEnabled() bool
- func (p *RemoteParticipant) IsMicrophoneEnabled() bool
- func (p *RemoteParticipant) IsScreenShareAudioEnabled() bool
- func (p *RemoteParticipant) IsScreenShareEnabled() bool
- func (p *RemoteParticipant) IsSpeaking() bool
- func (p *RemoteParticipant) Kind() ParticipantKind
- func (p *RemoteParticipant) Metadata() string
- func (p *RemoteParticipant) Name() string
- func (p *RemoteParticipant) Permissions() *livekit.ParticipantPermission
- func (p *RemoteParticipant) SID() string
- func (p *RemoteParticipant) SetLogger(logger protoLogger.Logger)
- func (p *RemoteParticipant) TrackPublications() []TrackPublication
- func (p *RemoteParticipant) WritePLI(ssrc webrtc.SSRC)
- type RemoteTrackPublication
- func (p *RemoteTrackPublication) IsEnabled() bool
- func (p *RemoteTrackPublication) IsMuted() bool
- func (p *RemoteTrackPublication) IsSubscribed() bool
- func (p *RemoteTrackPublication) Kind() TrackKind
- func (p *RemoteTrackPublication) MimeType() string
- func (p *RemoteTrackPublication) Name() string
- func (p *RemoteTrackPublication) OnRTCP(cb func(rtcp.Packet))
- func (p *RemoteTrackPublication) Receiver() *webrtc.RTPReceiver
- func (p *RemoteTrackPublication) SID() string
- func (p *RemoteTrackPublication) SetEnabled(enabled bool)
- func (p *RemoteTrackPublication) SetSubscribed(subscribed bool) error
- func (p *RemoteTrackPublication) SetVideoDimensions(width uint32, height uint32)
- func (p *RemoteTrackPublication) SetVideoQuality(quality livekit.VideoQuality) error
- func (p *RemoteTrackPublication) Source() livekit.TrackSource
- func (p *RemoteTrackPublication) Track() Track
- func (p *RemoteTrackPublication) TrackInfo() *livekit.TrackInfo
- func (p *RemoteTrackPublication) TrackRemote() *webrtc.TrackRemote
- type Room
- func (r *Room) ActiveSpeakers() []Participant
- func (r *Room) ConnectionState() ConnectionState
- func (r *Room) Disconnect()
- func (r *Room) DisconnectWithReason(reason livekit.DisconnectReason)
- func (r *Room) GetParticipantByIdentity(identity string) *RemoteParticipant
- func (r *Room) GetParticipantBySID(sid string) *RemoteParticipant
- func (r *Room) GetRemoteParticipants() []*RemoteParticipant
- func (r *Room) IsRecording() bool
- func (r *Room) Join(url string, info ConnectInfo, opts ...ConnectOption) error
- func (r *Room) JoinWithToken(url, token string, opts ...ConnectOption) error
- func (r *Room) Metadata() string
- func (r *Room) Name() string
- func (r *Room) OnConnectionQuality(updates []*livekit.ConnectionQualityInfo)
- func (r *Room) OnDataPacket(identity string, dataPacket DataPacket)
- func (r *Room) OnDisconnected(reason DisconnectionReason)
- func (r *Room) OnLocalTrackSubscribed(trackSubscribed *livekit.TrackSubscribed)
- func (r *Room) OnLocalTrackUnpublished(msg *livekit.TrackUnpublishedResponse)
- func (r *Room) OnMediaSectionsRequirement(mediaSectionsRequirement *livekit.MediaSectionsRequirement)
- func (r *Room) OnMediaTrack(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver)
- func (r *Room) OnParticipantDisconnect(rp *RemoteParticipant)
- func (r *Room) OnParticipantUpdate(participants []*livekit.ParticipantInfo)
- func (r *Room) OnRestarted(room *livekit.Room, participant *livekit.ParticipantInfo, ...)
- func (r *Room) OnRestarting()
- func (r *Room) OnResumed()
- func (r *Room) OnResuming()
- func (r *Room) OnRoomJoined(room *livekit.Room, participant *livekit.ParticipantInfo, ...)
- func (r *Room) OnRoomMoved(moved *livekit.RoomMovedResponse)
- func (r *Room) OnRoomUpdate(room *livekit.Room)
- func (r *Room) OnRpcAck(requestId string)
- func (r *Room) OnRpcRequest(callerIdentity, requestId, method, payload string, ...)
- func (r *Room) OnRpcResponse(requestId string, payload *string, error *RpcError)
- func (r *Room) OnSpeakersChanged(speakerUpdates []*livekit.SpeakerInfo)
- func (r *Room) OnStreamChunk(streamChunk *livekit.DataStream_Chunk)
- func (r *Room) OnStreamHeader(streamHeader *livekit.DataStream_Header, participantIdentity string)
- func (r *Room) OnStreamTrailer(streamTrailer *livekit.DataStream_Trailer)
- func (r *Room) OnSubscribedAudioCodecUpdate(subscribedAudioCodecUpdate *livekit.SubscribedAudioCodecUpdate)
- func (r *Room) OnSubscribedQualityUpdate(subscribedQualityUpdate *livekit.SubscribedQualityUpdate)
- func (r *Room) OnTrackRemoteMuted(msg *livekit.MuteTrackRequest)
- func (r *Room) OnTranscription(transcription *livekit.Transcription)
- func (r *Room) PrepareConnection(url, token string) error
- func (r *Room) RegisterByteStreamHandler(topic string, handler ByteStreamHandler) error
- func (r *Room) RegisterRpcMethod(method string, handler RpcHandlerFunc) error
- func (r *Room) RegisterTextStreamHandler(topic string, handler TextStreamHandler) error
- func (r *Room) SID() string
- func (r *Room) ServerInfo() *livekit.ServerInfo
- func (r *Room) SetLogger(l protoLogger.Logger)
- func (r *Room) SifTrailer() []byte
- func (r *Room) Simulate(scenario SimulateScenario)
- func (r *Room) UnregisterByteStreamHandler(topic string)
- func (r *Room) UnregisterRpcMethod(method string)
- func (r *Room) UnregisterTextStreamHandler(topic string)
- type RoomCallback
- type RoomServiceClient
- func (c *RoomServiceClient) CreateRoom(ctx context.Context, req *livekit.CreateRoomRequest) (*livekit.Room, error)
- func (c *RoomServiceClient) CreateToken() *auth.AccessToken
- func (c *RoomServiceClient) DeleteRoom(ctx context.Context, req *livekit.DeleteRoomRequest) (*livekit.DeleteRoomResponse, error)
- func (c *RoomServiceClient) ForwardParticipant(ctx context.Context, req *livekit.ForwardParticipantRequest) (*livekit.ForwardParticipantResponse, error)
- func (c *RoomServiceClient) GetParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (*livekit.ParticipantInfo, error)
- func (c *RoomServiceClient) ListParticipants(ctx context.Context, req *livekit.ListParticipantsRequest) (*livekit.ListParticipantsResponse, error)
- func (c *RoomServiceClient) ListRooms(ctx context.Context, req *livekit.ListRoomsRequest) (*livekit.ListRoomsResponse, error)
- func (c *RoomServiceClient) MoveParticipant(ctx context.Context, req *livekit.MoveParticipantRequest) (*livekit.MoveParticipantResponse, error)
- func (c *RoomServiceClient) MutePublishedTrack(ctx context.Context, req *livekit.MuteRoomTrackRequest) (*livekit.MuteRoomTrackResponse, error)
- func (c *RoomServiceClient) RemoveParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (*livekit.RemoveParticipantResponse, error)
- func (c *RoomServiceClient) SendData(ctx context.Context, req *livekit.SendDataRequest) (*livekit.SendDataResponse, error)
- func (c *RoomServiceClient) UpdateParticipant(ctx context.Context, req *livekit.UpdateParticipantRequest) (*livekit.ParticipantInfo, error)
- func (c *RoomServiceClient) UpdateRoomMetadata(ctx context.Context, req *livekit.UpdateRoomMetadataRequest) (*livekit.Room, error)
- func (c *RoomServiceClient) UpdateSubscriptions(ctx context.Context, req *livekit.UpdateSubscriptionsRequest) (*livekit.UpdateSubscriptionsResponse, error)
- type RpcError
- type RpcErrorCode
- type RpcHandlerFunc
- type RpcInvocationData
- type SIPClient
- func (s *SIPClient) CreateSIPDispatchRule(ctx context.Context, in *livekit.CreateSIPDispatchRuleRequest) (*livekit.SIPDispatchRuleInfo, error)
- func (s *SIPClient) CreateSIPInboundTrunk(ctx context.Context, in *livekit.CreateSIPInboundTrunkRequest) (*livekit.SIPInboundTrunkInfo, error)
- func (s *SIPClient) CreateSIPOutboundTrunk(ctx context.Context, in *livekit.CreateSIPOutboundTrunkRequest) (*livekit.SIPOutboundTrunkInfo, error)
- func (s *SIPClient) CreateSIPParticipant(ctx context.Context, in *livekit.CreateSIPParticipantRequest) (*livekit.SIPParticipantInfo, error)
- func (s *SIPClient) DeleteSIPDispatchRule(ctx context.Context, in *livekit.DeleteSIPDispatchRuleRequest) (*livekit.SIPDispatchRuleInfo, error)
- func (s *SIPClient) DeleteSIPTrunk(ctx context.Context, in *livekit.DeleteSIPTrunkRequest) (*livekit.SIPTrunkInfo, error)
- func (s *SIPClient) GetSIPDispatchRulesByIDs(ctx context.Context, ids []string) ([]*livekit.SIPDispatchRuleInfo, error)
- func (s *SIPClient) GetSIPInboundTrunksByIDs(ctx context.Context, ids []string) ([]*livekit.SIPInboundTrunkInfo, error)
- func (s *SIPClient) GetSIPOutboundTrunksByIDs(ctx context.Context, ids []string) ([]*livekit.SIPOutboundTrunkInfo, error)
- func (s *SIPClient) ListSIPDispatchRule(ctx context.Context, in *livekit.ListSIPDispatchRuleRequest) (*livekit.ListSIPDispatchRuleResponse, error)
- func (s *SIPClient) ListSIPInboundTrunk(ctx context.Context, in *livekit.ListSIPInboundTrunkRequest) (*livekit.ListSIPInboundTrunkResponse, error)
- func (s *SIPClient) ListSIPOutboundTrunk(ctx context.Context, in *livekit.ListSIPOutboundTrunkRequest) (*livekit.ListSIPOutboundTrunkResponse, error)
- func (s *SIPClient) ListSIPTrunk(ctx context.Context, in *livekit.ListSIPTrunkRequest) (*livekit.ListSIPTrunkResponse, error)deprecated
- func (s *SIPClient) TransferSIPParticipant(ctx context.Context, in *livekit.TransferSIPParticipantRequest) (*emptypb.Empty, error)
- func (s *SIPClient) UpdateSIPDispatchRule(ctx context.Context, in *livekit.UpdateSIPDispatchRuleRequest) (*livekit.SIPDispatchRuleInfo, error)
- func (s *SIPClient) UpdateSIPInboundTrunk(ctx context.Context, in *livekit.UpdateSIPInboundTrunkRequest) (*livekit.SIPInboundTrunkInfo, error)
- func (s *SIPClient) UpdateSIPOutboundTrunk(ctx context.Context, in *livekit.UpdateSIPOutboundTrunkRequest) (*livekit.SIPOutboundTrunkInfo, error)
- type SampleProvider
- type SampleWriteOptions
- type SimulateScenario
- type StreamBytesOptions
- type StreamTextOptions
- type TextStreamHandler
- type TextStreamInfo
- type TextStreamReader
- func (r TextStreamReader) OnProgress(onProgress *func(progress float64))
- func (r TextStreamReader) Read(bytes []byte) (int, error)
- func (r *TextStreamReader) ReadAll() string
- func (r TextStreamReader) ReadByte() (byte, error)
- func (r TextStreamReader) ReadBytes(delim byte) ([]byte, error)
- func (r *TextStreamReader) ReadRune() (rune, int, error)
- func (r *TextStreamReader) ReadString(delim byte) (string, error)
- type TextStreamWriter
- type Track
- type TrackKind
- type TrackLocalWithCodec
- type TrackPubCallback
- type TrackPublication
- type TrackPublicationOptions
- type TranscriptionSegment
- type UserDataPacket
Examples ¶
Constants ¶
const ( LIVEKIT_SDK_SALT = "LKFrameEncryptionKey" LIVEKIT_IV_LENGTH = 12 LIVEKIT_PBKDF_ITERATIONS = 100000 LIVEKIT_KEY_SIZE_BYTES = 16 LIVEKIT_HKDF_INFO_BYTES = 128 )
const ( ParticipantStandard = ParticipantKind(livekit.ParticipantInfo_STANDARD) ParticipantIngress = ParticipantKind(livekit.ParticipantInfo_INGRESS) ParticipantEgress = ParticipantKind(livekit.ParticipantInfo_EGRESS) ParticipantSIP = ParticipantKind(livekit.ParticipantInfo_SIP) ParticipantAgent = ParticipantKind(livekit.ParticipantInfo_AGENT) )
const ( MaxMessageBytes = 256 MaxDataBytes = 15360 // 15KiB // Maximum payload size for RPC requests and responses. If a payload exceeds this size, // the RPC call will fail with a RpcRequestPayloadTooLarge(1402) or RpcResponsePayloadTooLarge(1504) error. MaxPayloadBytes = 15360 // 15KiB )
const PROTOCOL = 16
const (
// default max chunk size for streams
STREAM_CHUNK_SIZE = 15_000
)
const (
SimulateSpeakerUpdateInterval = 5
)
const Version = "2.12.8"
Variables ¶
var ( ErrIncorrectKeyLength = errors.New("incorrect key length for encryption/decryption") ErrUnableGenerateIV = errors.New("unable to generate iv for encryption") ErrIncorrectIVLength = errors.New("incorrect iv length") ErrIncorrectSecretLength = errors.New("input secret provided to derivation function cannot be empty or nil") ErrIncorrectSaltLength = errors.New("input salt provided to derivation function cannot be empty or nil") ErrBlockCipherRequired = errors.New("input block cipher cannot be nil") )
var ( ErrConnectionTimeout = errors.New("could not connect after timeout") ErrTrackPublishTimeout = errors.New("timed out publishing track") ErrCannotDetermineMime = errors.New("cannot determine mimetype from file extension") ErrUnsupportedFileType = errors.New("ReaderSampleProvider does not support this mime type") ErrUnsupportedSimulcastKind = errors.New("simulcast is only supported for video") ErrInvalidSimulcastTrack = errors.New("simulcast track was not initiated correctly") ErrCannotFindTrack = errors.New("could not find the track") ErrInvalidMessageType = signalling.ErrInvalidMessageType ErrInvalidParameter = signalling.ErrInvalidParameter ErrCannotConnectSignal = errors.New("could not establish signal connection") ErrNoPeerConnection = errors.New("peer connection not established") ErrAborted = errors.New("operation was aborted") ErrMissingPrimaryCodec = errors.New("primary track must be TrackLocalWithCodec when backup codec is present") )
Functions ¶
func ChatMessage ¶ added in v2.10.0
func ChatMessage(ts time.Time, text string) *livekit.ChatMessage
ChatMessage creates a chat message that can be sent via WebRTC. If timestamp is zero, current time will be used.
func DecryptGCMAudioSample ¶ added in v2.4.1
Take audio sample (body of RTP) encrypted by LiveKit client SDK, extract IV and decrypt using provided key If sample matches sifTrailer, it's considered to be a non-encrypted Server Injected Frame and nil is returned Use DecryptGCMAudioSampleCustomCipher with cached aes cipher block for better (30%) performance
func DecryptGCMAudioSampleCustomCipher ¶ added in v2.4.1
func DecryptGCMAudioSampleCustomCipher(sample, sifTrailer []byte, cipherBlock cipher.Block) ([]byte, error)
Take audio sample (body of RTP) encrypted by LiveKit client SDK, extract IV and decrypt using provided cipherBlock If sample matches sifTrailer, it's considered to be a non-encrypted Server Injected Frame and nil is returned Encrypted sample format based on livekit client sdk ---------+-------------------------+---------+---- payload |IV...(length = IV_LENGTH)|IV_LENGTH|KID| ---------+-------------------------+---------+---- First byte of audio frame is not encrypted and only authenticated payload - variable bytes IV - variable bytes (equal to IV_LENGTH bytes) IV_LENGTH - 1 byte KID (Key ID) - 1 byte - ignored here, key is provided as parameter to function
func DeriveKeyFromBytes ¶ added in v2.4.1
func DeriveKeyFromBytesCustomSalt ¶ added in v2.4.1
func DeriveKeyFromString ¶ added in v2.4.1
func DeriveKeyFromStringCustomSalt ¶ added in v2.4.1
func EncryptGCMAudioSample ¶ added in v2.4.1
Take audio sample (body of RTP) and encrypts it using AES-GCM 128bit with provided key Use EncryptGCMAudioSampleCustomCipher with cached aes cipher block for better (20%) performance
func EncryptGCMAudioSampleCustomCipher ¶ added in v2.4.1
func EncryptGCMAudioSampleCustomCipher(sample []byte, kid uint8, cipherBlock cipher.Block) ([]byte, error)
Take audio sample (body of RTP) and encrypts it using AES-GCM 128bit with provided cipher block Encrypted sample format based on livekit client sdk ---------+-------------------------+---------+---- payload |IV...(length = IV_LENGTH)|IV_LENGTH|KID| ---------+-------------------------+---------+---- First byte of audio frame is not encrypted and only authenticated payload - variable bytes IV - variable bytes (equal to IV_LENGTH bytes) - 12 random bytes IV_LENGTH - 1 byte - 12 bytes fixed KID (Key ID) - 1 byte - taken from "kid" parameter
func ReaderTrackWithFrameDuration ¶
func ReaderTrackWithFrameDuration(duration time.Duration) func(provider *ReaderSampleProvider)
func ReaderTrackWithH26xStreamingFormat ¶ added in v2.12.6
func ReaderTrackWithH26xStreamingFormat(h26xStreamingFormat H26xStreamingFormat) func(provider *ReaderSampleProvider)
func ReaderTrackWithMime ¶
func ReaderTrackWithMime(mime string) func(provider *ReaderSampleProvider)
func ReaderTrackWithOnWriteComplete ¶
func ReaderTrackWithOnWriteComplete(f func()) func(provider *ReaderSampleProvider)
func ReaderTrackWithRTCPHandler ¶
func ReaderTrackWithRTCPHandler(f func(rtcp.Packet)) func(provider *ReaderSampleProvider)
func ReaderTrackWithSampleOptions ¶
func ReaderTrackWithSampleOptions(opts ...LocalTrackOptions) func(provider *ReaderSampleProvider)
func SIPStatusFrom ¶ added in v2.5.0
SIPStatusFrom unwraps an error and returns associated SIP call status, if any.
func SetLogger ¶
func SetLogger(l protoLogger.Logger)
SetLogger overrides default logger. To use a [logr](https://github.com/go-logr/logr) compatible logger, pass in SetLogger(logger.LogRLogger(logRLogger))
Types ¶
type AgentClient ¶ added in v2.6.0
type AgentClient struct {
// contains filtered or unexported fields
}
func NewAgentClient ¶ added in v2.6.0
func NewAgentClient(url string, apiKey string, apiSecret string, opts ...twirp.ClientOption) (*AgentClient, error)
func (*AgentClient) CreateAgent ¶ added in v2.6.0
func (c *AgentClient) CreateAgent(ctx context.Context, req *livekit.CreateAgentRequest) (*livekit.CreateAgentResponse, error)
func (*AgentClient) DeleteAgent ¶ added in v2.6.0
func (c *AgentClient) DeleteAgent(ctx context.Context, req *livekit.DeleteAgentRequest) (*livekit.DeleteAgentResponse, error)
func (*AgentClient) DeployAgent ¶ added in v2.6.0
func (c *AgentClient) DeployAgent(ctx context.Context, req *livekit.DeployAgentRequest) (*livekit.DeployAgentResponse, error)
func (*AgentClient) GetClientSettings ¶ added in v2.6.0
func (c *AgentClient) GetClientSettings(ctx context.Context, req *livekit.ClientSettingsRequest) (*livekit.ClientSettingsResponse, error)
func (*AgentClient) ListAgentSecrets ¶ added in v2.6.0
func (c *AgentClient) ListAgentSecrets(ctx context.Context, req *livekit.ListAgentSecretsRequest) (*livekit.ListAgentSecretsResponse, error)
func (*AgentClient) ListAgentVersions ¶ added in v2.6.0
func (c *AgentClient) ListAgentVersions(ctx context.Context, req *livekit.ListAgentVersionsRequest) (*livekit.ListAgentVersionsResponse, error)
func (*AgentClient) ListAgents ¶ added in v2.6.0
func (c *AgentClient) ListAgents(ctx context.Context, req *livekit.ListAgentsRequest) (*livekit.ListAgentsResponse, error)
func (*AgentClient) RestartAgent ¶ added in v2.9.2
func (c *AgentClient) RestartAgent(ctx context.Context, req *livekit.RestartAgentRequest) (*livekit.RestartAgentResponse, error)
func (*AgentClient) RollbackAgent ¶ added in v2.6.0
func (c *AgentClient) RollbackAgent(ctx context.Context, req *livekit.RollbackAgentRequest) (*livekit.RollbackAgentResponse, error)
func (*AgentClient) UpdateAgent ¶ added in v2.6.0
func (c *AgentClient) UpdateAgent(ctx context.Context, req *livekit.UpdateAgentRequest) (*livekit.UpdateAgentResponse, error)
func (*AgentClient) UpdateAgentSecrets ¶ added in v2.6.0
func (c *AgentClient) UpdateAgentSecrets(ctx context.Context, req *livekit.UpdateAgentSecretsRequest) (*livekit.UpdateAgentSecretsResponse, error)
type AgentDispatchClient ¶ added in v2.2.1
type AgentDispatchClient struct {
// contains filtered or unexported fields
}
func NewAgentDispatchServiceClient ¶ added in v2.2.1
func NewAgentDispatchServiceClient(url string, apiKey string, secretKey string, opts ...twirp.ClientOption) *AgentDispatchClient
func (*AgentDispatchClient) CreateDispatch ¶ added in v2.2.1
func (c *AgentDispatchClient) CreateDispatch(ctx context.Context, req *livekit.CreateAgentDispatchRequest) (*livekit.AgentDispatch, error)
func (*AgentDispatchClient) DeleteDispatch ¶ added in v2.2.1
func (c *AgentDispatchClient) DeleteDispatch(ctx context.Context, req *livekit.DeleteAgentDispatchRequest) (*livekit.AgentDispatch, error)
func (*AgentDispatchClient) ListDispatch ¶ added in v2.2.1
func (c *AgentDispatchClient) ListDispatch(ctx context.Context, req *livekit.ListAgentDispatchRequest) (*livekit.ListAgentDispatchResponse, error)
type AudioSampleProvider ¶
type AudioSampleProvider interface {
SampleProvider
CurrentAudioLevel() uint8
}
type BaseSampleProvider ¶
type BaseSampleProvider struct {
}
BaseSampleProvider provides empty implementations for OnBind and OnUnbind
func (*BaseSampleProvider) Close ¶
func (p *BaseSampleProvider) Close() error
func (*BaseSampleProvider) OnBind ¶
func (p *BaseSampleProvider) OnBind() error
func (*BaseSampleProvider) OnUnbind ¶
func (p *BaseSampleProvider) OnUnbind() error
type ByteStreamHandler ¶ added in v2.6.0
type ByteStreamHandler func(reader *ByteStreamReader, participantIdentity string)
ByteStreamHandler is a function that will be called when a byte stream is received. It will be called with the stream reader and the participant identity that sent the stream.
type ByteStreamInfo ¶ added in v2.6.0
type ByteStreamInfo struct {
Name *string
// contains filtered or unexported fields
}
Info for byte streams
- Id is the id of the stream
- MimeType is the mime type of the stream, determined for SendFile if not provided
- Topic is the topic of the stream
- Timestamp is the timestamp of sending the stream
- Size is the total size of the stream, if provided
- Attributes are any additional attributes of the stream
- Name is the name of the file or stream, if provided
type ByteStreamReader ¶ added in v2.6.0
type ByteStreamReader struct {
Info ByteStreamInfo
// contains filtered or unexported fields
}
func NewByteStreamReader ¶ added in v2.6.0
func NewByteStreamReader(info ByteStreamInfo, totalChunkCount *uint64) *ByteStreamReader
func (ByteStreamReader) OnProgress ¶ added in v2.6.0
func (r ByteStreamReader) OnProgress(onProgress *func(progress float64))
OnProgress sets the callback function that will be called when the stream is being read only called if TotalSize of the stream is set
func (ByteStreamReader) Read ¶ added in v2.6.0
Read reads the next len(p) bytes from the stream or until the stream buffer is drained. The return value is the number of bytes read. If the buffer has no data to return, it will wait for a write to the stream or return io.EOF if the stream is closed.
func (*ByteStreamReader) ReadAll ¶ added in v2.6.0
func (r *ByteStreamReader) ReadAll() []byte
ReadAll reads all the data from the stream and returns it as a byte slice. This will block until the stream is closed.
func (ByteStreamReader) ReadByte ¶ added in v2.6.0
ReadByte reads and returns the next byte from the buffer. If no byte is available, it will wait for a write to the stream or return io.EOF if the stream is closed.
func (ByteStreamReader) ReadBytes ¶ added in v2.6.0
ReadBytes reads until the first occurrence of delim in the input, returning a slice containing the data up to and including the delimiter. If ReadBytes encounters an error before finding a delimiter, it returns the data read before EOF, but does not return EOF until the stream is closed. ReadBytes returns err != nil if and only if the returned data does not end in delim.
type ByteStreamWriter ¶ added in v2.6.0
type ByteStreamWriter struct {
Info ByteStreamInfo
// contains filtered or unexported fields
}
ByteStreamWriter is a writer type for byte streams
func (ByteStreamWriter) Close ¶ added in v2.6.0
func (w ByteStreamWriter) Close()
Close the stream, this will send a stream trailer to notify the receiver that the stream is closed
func (ByteStreamWriter) Write ¶ added in v2.6.0
func (w ByteStreamWriter) Write(data T, onDone *func())
Write data to the stream, data can be a byte slice or a string depending on the type of the stream writer onDone is a callback function that will be called when the data provided is written to the stream
type ConnectInfo ¶
type ConnectOption ¶
type ConnectOption func(*signalling.ConnectParams)
func WithAutoSubscribe ¶
func WithAutoSubscribe(val bool) ConnectOption
WithAutoSubscribe sets whether the participant should automatically subscribe to tracks. Default is true.
func WithDisableRegionDiscovery ¶ added in v2.2.1
func WithDisableRegionDiscovery() ConnectOption
WithDisableRegionDiscovery disables automatic region discovery for LiveKit Cloud.
func WithExtraAttributes ¶ added in v2.9.2
func WithExtraAttributes(attrs map[string]string) ConnectOption
WithExtraAttributes sets additional key-value attributes for the participant. Empty string values will be ignored.
func WithICETransportPolicy ¶ added in v2.1.1
func WithICETransportPolicy(iceTransportPolicy webrtc.ICETransportPolicy) ConnectOption
WithICETransportPolicy sets the ICE transport policy (UDP, Relay, etc.).
func WithInterceptors ¶ added in v2.1.1
func WithInterceptors(interceptors []interceptor.Factory) ConnectOption
WithInterceptors sets custom RTP interceptors for the connection.
func WithMetadata ¶ added in v2.10.0
func WithMetadata(metadata string) ConnectOption
WithMetadata sets custom metadata for the participant.
func WithPacer ¶
func WithPacer(pacer pacer.Factory) ConnectOption
WithPacer enables the use of a pacer on this connection A pacer helps to smooth out video packet rate to avoid overwhelming downstream. Learn more at: https://chromium.googlesource.com/external/webrtc/+/master/modules/pacing/g3doc/index.md
func WithRetransmitBufferSize ¶
func WithRetransmitBufferSize(val uint16) ConnectOption
WithRetransmitBufferSize sets the retransmit buffer size to respond to NACK requests. Must be one of: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768.
type ConnectionState ¶ added in v2.2.0
type ConnectionState string
const ( ConnectionStateConnected ConnectionState = "connected" ConnectionStateReconnecting ConnectionState = "reconnecting" ConnectionStateDisconnected ConnectionState = "disconnected" )
type DataPacket ¶ added in v2.0.5
type DataPacket interface {
ToProto() *livekit.DataPacket
}
type DataPublishOption ¶
type DataPublishOption func(*dataPublishOptions)
func WithDataPublishDestination ¶
func WithDataPublishDestination(identities []string) DataPublishOption
WithDataPublishDestination sets specific participant identities to send data to. If not set, data will be sent to all participants.
func WithDataPublishReliable ¶
func WithDataPublishReliable(reliable bool) DataPublishOption
func WithDataPublishTopic ¶
func WithDataPublishTopic(topic string) DataPublishOption
type DataReceiveParams ¶
type DataReceiveParams struct {
Sender *RemoteParticipant
SenderIdentity string
Topic string // Deprecated: Use UserDataPacket.Topic
}
type DisconnectionReason ¶ added in v2.1.0
type DisconnectionReason string
const ( LeaveRequested DisconnectionReason = "leave requested by user" RejectedByUser DisconnectionReason = "rejected by remote user" Failed DisconnectionReason = "connection to room failed" RoomClosed DisconnectionReason = "room closed" ParticipantRemoved DisconnectionReason = "removed by server" DuplicateIdentity DisconnectionReason = "duplicate identity" OtherReason DisconnectionReason = "other reasons" )
func GetDisconnectionReason ¶ added in v2.3.0
func GetDisconnectionReason(reason livekit.DisconnectReason) DisconnectionReason
GetDisconnectionReason converts a protocol disconnect reason to a DisconnectionReason.
type EgressClient ¶
type EgressClient struct {
// contains filtered or unexported fields
}
func NewEgressClient ¶
func NewEgressClient(url string, apiKey string, secretKey string, opts ...twirp.ClientOption) *EgressClient
func (*EgressClient) ListEgress ¶
func (c *EgressClient) ListEgress(ctx context.Context, req *livekit.ListEgressRequest) (*livekit.ListEgressResponse, error)
func (*EgressClient) StartParticipantEgress ¶
func (c *EgressClient) StartParticipantEgress(ctx context.Context, req *livekit.ParticipantEgressRequest) (*livekit.EgressInfo, error)
func (*EgressClient) StartRoomCompositeEgress ¶
func (c *EgressClient) StartRoomCompositeEgress(ctx context.Context, req *livekit.RoomCompositeEgressRequest) (*livekit.EgressInfo, error)
func (*EgressClient) StartTrackCompositeEgress ¶
func (c *EgressClient) StartTrackCompositeEgress(ctx context.Context, req *livekit.TrackCompositeEgressRequest) (*livekit.EgressInfo, error)
func (*EgressClient) StartTrackEgress ¶
func (c *EgressClient) StartTrackEgress(ctx context.Context, req *livekit.TrackEgressRequest) (*livekit.EgressInfo, error)
func (*EgressClient) StartWebEgress ¶
func (c *EgressClient) StartWebEgress(ctx context.Context, req *livekit.WebEgressRequest) (*livekit.EgressInfo, error)
func (*EgressClient) StopEgress ¶
func (c *EgressClient) StopEgress(ctx context.Context, req *livekit.StopEgressRequest) (*livekit.EgressInfo, error)
func (*EgressClient) UpdateLayout ¶
func (c *EgressClient) UpdateLayout(ctx context.Context, req *livekit.UpdateLayoutRequest) (*livekit.EgressInfo, error)
func (*EgressClient) UpdateStream ¶
func (c *EgressClient) UpdateStream(ctx context.Context, req *livekit.UpdateStreamRequest) (*livekit.EgressInfo, error)
type H26xStreamingFormat ¶ added in v2.12.6
type H26xStreamingFormat int
const ( H26xStreamingFormatAnnexB H26xStreamingFormat = iota H26xStreamingFormatLengthPrefixed )
func (H26xStreamingFormat) String ¶ added in v2.12.6
func (f H26xStreamingFormat) String() string
type IngressClient ¶
type IngressClient struct {
// contains filtered or unexported fields
}
func NewIngressClient ¶
func NewIngressClient(url string, apiKey string, secretKey string, opts ...twirp.ClientOption) *IngressClient
func (*IngressClient) CreateIngress ¶
func (c *IngressClient) CreateIngress(ctx context.Context, in *livekit.CreateIngressRequest) (*livekit.IngressInfo, error)
func (*IngressClient) DeleteIngress ¶
func (c *IngressClient) DeleteIngress(ctx context.Context, in *livekit.DeleteIngressRequest) (*livekit.IngressInfo, error)
func (*IngressClient) ListIngress ¶
func (c *IngressClient) ListIngress(ctx context.Context, in *livekit.ListIngressRequest) (*livekit.ListIngressResponse, error)
func (*IngressClient) UpdateIngress ¶
func (c *IngressClient) UpdateIngress(ctx context.Context, in *livekit.UpdateIngressRequest) (*livekit.IngressInfo, error)
type LocalParticipant ¶
type LocalParticipant struct {
// contains filtered or unexported fields
}
func (*LocalParticipant) Attributes ¶ added in v2.2.1
func (*LocalParticipant) AudioLevel ¶
func (p *LocalParticipant) AudioLevel() float32
func (*LocalParticipant) GetPublisherPeerConnection ¶
func (p *LocalParticipant) GetPublisherPeerConnection() *webrtc.PeerConnection
GetPublisherPeerConnection is a power-user API that gives access to the underlying publisher peer connection. Local tracks are published to server via this PeerConnection.
func (*LocalParticipant) GetSubscriberPeerConnection ¶
func (p *LocalParticipant) GetSubscriberPeerConnection() *webrtc.PeerConnection
GetSubscriberPeerConnection is a power-user API that gives access to the underlying subscriber peer connection. Subscribed tracks are received using this PeerConnection.
func (*LocalParticipant) GetTrackPublication ¶
func (p *LocalParticipant) GetTrackPublication(source livekit.TrackSource) TrackPublication
func (*LocalParticipant) HandleIncomingRpcAck ¶ added in v2.9.2
func (p *LocalParticipant) HandleIncomingRpcAck(requestId string)
func (*LocalParticipant) HandleIncomingRpcResponse ¶ added in v2.9.2
func (p *LocalParticipant) HandleIncomingRpcResponse(requestId string, payload *string, error *RpcError)
func (*LocalParticipant) IsCameraEnabled ¶
func (p *LocalParticipant) IsCameraEnabled() bool
func (*LocalParticipant) IsMicrophoneEnabled ¶
func (p *LocalParticipant) IsMicrophoneEnabled() bool
func (*LocalParticipant) IsScreenShareAudioEnabled ¶
func (p *LocalParticipant) IsScreenShareAudioEnabled() bool
func (*LocalParticipant) IsScreenShareEnabled ¶
func (p *LocalParticipant) IsScreenShareEnabled() bool
func (*LocalParticipant) IsSpeaking ¶
func (p *LocalParticipant) IsSpeaking() bool
func (*LocalParticipant) Kind ¶
func (p *LocalParticipant) Kind() ParticipantKind
func (*LocalParticipant) PerformRpc ¶ added in v2.6.0
func (p *LocalParticipant) PerformRpc(params PerformRpcParams) (*string, error)
PerformRpc initiates an RPC call to a remote participant. Returns the response payload or an error if the call fails or times out.
func (*LocalParticipant) Permissions ¶
func (p *LocalParticipant) Permissions() *livekit.ParticipantPermission
func (*LocalParticipant) PublishData
deprecated
func (p *LocalParticipant) PublishData(payload []byte, opts ...DataPublishOption) error
PublishData sends custom user data via WebRTC data channel.
By default, the message can be received by all participants in a room, see WithDataPublishDestination for choosing specific participants.
Messages are sent via a LOSSY channel by default, see WithDataPublishReliable for sending reliable data.
Deprecated: Use PublishDataPacket with UserData instead.
func (*LocalParticipant) PublishDataPacket ¶ added in v2.0.5
func (p *LocalParticipant) PublishDataPacket(pck DataPacket, opts ...DataPublishOption) error
PublishDataPacket sends a packet via a WebRTC data channel. UserData can be used for sending custom user data.
By default, the message can be received by all participants in a room, see WithDataPublishDestination for choosing specific participants.
Messages are sent via UDP and offer no delivery guarantees, see WithDataPublishReliable for sending data reliably (with retries).
func (*LocalParticipant) PublishSimulcastTrack ¶
func (p *LocalParticipant) PublishSimulcastTrack(tracks []*LocalTrack, opts *TrackPublicationOptions, pubOpts ...LocalTrackPublishOption) (*LocalTrackPublication, error)
PublishSimulcastTrack publishes a simulcast track with up to three quality layers to the server. This allows the server to dynamically switch between different quality levels based on network conditions.
func (*LocalParticipant) PublishTrack ¶
func (p *LocalParticipant) PublishTrack(track webrtc.TrackLocal, opts *TrackPublicationOptions, pubOpts ...LocalTrackPublishOption) (*LocalTrackPublication, error)
PublishTrack publishes a local track to the room. The track will be available to other participants in the room.
func (*LocalParticipant) SendFile ¶ added in v2.6.0
func (p *LocalParticipant) SendFile(filePath string, options StreamBytesOptions) (*ByteStreamInfo, error)
SendFile sends a file to other participants as a byte stream. Returns ByteStreamInfo that can be used to get metadata about the stream. Returns an error if the file cannot be read.
func (*LocalParticipant) SendText ¶ added in v2.6.0
func (p *LocalParticipant) SendText(text string, options StreamTextOptions) *TextStreamInfo
SendText sends a text message as a stream to other participants. Returns TextStreamInfo that can be used to get metadata about the stream.
func (*LocalParticipant) SetAttributes ¶ added in v2.2.1
func (p *LocalParticipant) SetAttributes(attrs map[string]string)
SetAttributes sets the KV attributes of the current participant. To remove an attribute, set it to empty value. Updates will be performed only if the participant has canUpdateOwnMetadata grant.
func (*LocalParticipant) SetLogger ¶ added in v2.12.3
func (p *LocalParticipant) SetLogger(log protoLogger.Logger)
func (*LocalParticipant) SetMetadata ¶
func (p *LocalParticipant) SetMetadata(metadata string)
SetMetadata sets the metadata of the current participant. Updates will be performed only if the participant has canUpdateOwnMetadata grant.
func (*LocalParticipant) SetName ¶
func (p *LocalParticipant) SetName(name string)
SetName sets the name of the current participant. Updates will be performed only if the participant has canUpdateOwnMetadata grant.
func (*LocalParticipant) SetSubscriptionPermission ¶ added in v2.3.0
func (p *LocalParticipant) SetSubscriptionPermission(sp *livekit.SubscriptionPermission)
SetSubscriptionPermission controls who can subscribe to LocalParticipant's published tracks.
By default, all participants can subscribe. This allows fine-grained control over who is able to subscribe at a participant and track level.
Note: if access is given at a track-level (i.e. both `AllParticipants` and `TrackPermission.AllTracks` are false), any newer published tracks will not grant permissions to any participants and will require a subsequent permissions update to allow subscription.
func (*LocalParticipant) StreamBytes ¶ added in v2.6.0
func (p *LocalParticipant) StreamBytes(options StreamBytesOptions) *ByteStreamWriter
StreamBytes creates a new byte stream writer with the provided options.
func (*LocalParticipant) StreamText ¶ added in v2.6.0
func (p *LocalParticipant) StreamText(options StreamTextOptions) *TextStreamWriter
StreamText creates a new text stream writer with the provided options.
func (*LocalParticipant) TrackPublications ¶
func (p *LocalParticipant) TrackPublications() []TrackPublication
func (*LocalParticipant) UnpublishTrack ¶
func (p *LocalParticipant) UnpublishTrack(sid string) error
UnpublishTrack stops publishing a track and removes it from the room.
type LocalSampleTrack ¶
type LocalSampleTrack = LocalTrack
type LocalSampleTrackOptions ¶
type LocalSampleTrackOptions = LocalTrackOptions
type LocalTrack ¶
type LocalTrack struct {
// contains filtered or unexported fields
}
LocalTrack is a local track that simplifies writing samples. It handles timing and publishing of things, so as long as a SampleProvider is provided, the class takes care of publishing tracks at the right frequency This extends webrtc.TrackLocalStaticSample, and adds the ability to write RTP extensions
func NewLocalFileTrack ¶
func NewLocalFileTrack(file string, options ...ReaderSampleProviderOption) (*LocalTrack, error)
NewLocalFileTrack creates an *os.File reader for NewLocalReaderTrack
func NewLocalReaderTrack ¶
func NewLocalReaderTrack(in io.ReadCloser, mime string, options ...ReaderSampleProviderOption) (*LocalTrack, error)
NewLocalReaderTrack uses io.ReadCloser interface to adapt to various ingress types - mime: has to be one of webrtc.MimeType... (e.g. webrtc.MimeTypeOpus)
func NewLocalSampleTrack ¶
func NewLocalSampleTrack(c webrtc.RTPCodecCapability, opts ...LocalTrackOptions) (*LocalTrack, error)
func NewLocalTrack ¶
func NewLocalTrack(c webrtc.RTPCodecCapability, opts ...LocalTrackOptions) (*LocalTrack, error)
func (*LocalTrack) Bind ¶
func (s *LocalTrack) Bind(t webrtc.TrackLocalContext) (webrtc.RTPCodecParameters, error)
Bind is an interface for TrackLocal, not for external consumption.
func (*LocalTrack) Close ¶
func (s *LocalTrack) Close() error
Close stops the track and cleans up resources.
func (*LocalTrack) Codec ¶
func (s *LocalTrack) Codec() webrtc.RTPCodecCapability
Codec returns the codec capability of the track.
func (*LocalTrack) ID ¶
func (s *LocalTrack) ID() string
ID returns the unique identifier for this Track. This should be unique for the stream, but doesn't have to globally unique. A common example would be 'audio' or 'video' and StreamID would be 'desktop' or 'webcam'.
func (*LocalTrack) IsBound ¶
func (s *LocalTrack) IsBound() bool
IsBound returns whether the track is currently bound to a peer connection.
func (*LocalTrack) Kind ¶
func (s *LocalTrack) Kind() webrtc.RTPCodecType
Kind returns whether this TrackLocal is audio or video.
func (*LocalTrack) OnBind ¶
func (s *LocalTrack) OnBind(f func())
OnBind sets a callback to be called when the track has been negotiated for publishing and bound to a peer connection.
func (*LocalTrack) OnUnbind ¶
func (s *LocalTrack) OnUnbind(f func())
OnUnbind sets a callback to be called after the track is removed from a peer connection.
func (*LocalTrack) SSRC ¶ added in v2.1.1
func (s *LocalTrack) SSRC() webrtc.SSRC
SSRC returns the Synchronization Source identifier for this track.
func (*LocalTrack) SetLogger ¶ added in v2.2.1
func (s *LocalTrack) SetLogger(l protoLogger.Logger)
SetLogger overrides default logger for this track.
func (*LocalTrack) SetTransceiver ¶
func (s *LocalTrack) SetTransceiver(transceiver *webrtc.RTPTransceiver)
SetTransceiver sets the RTP transceiver for this track.
func (*LocalTrack) StartWrite ¶
func (s *LocalTrack) StartWrite(provider SampleProvider, onComplete func()) error
StartWrite starts writing samples from the provided SampleProvider. The onComplete callback is called when writing finishes.
func (*LocalTrack) StreamID ¶
func (s *LocalTrack) StreamID() string
StreamID returns the group this track belongs to. This must be unique.
func (*LocalTrack) Unbind ¶
func (s *LocalTrack) Unbind(t webrtc.TrackLocalContext) error
Unbind is an interface for TrackLocal, not for external consumption.
func (*LocalTrack) WriteRTP ¶
func (s *LocalTrack) WriteRTP(p *rtp.Packet, opts *SampleWriteOptions) error
WriteRTP writes an RTP packet to the track with optional sample write options.
func (*LocalTrack) WriteSample ¶
func (s *LocalTrack) WriteSample(sample media.Sample, opts *SampleWriteOptions) error
WriteSample writes a media sample to the track with optional write options. This handles timing, RTP packetization, and sample ordering automatically.
type LocalTrackOptions ¶
type LocalTrackOptions func(s *LocalTrack)
func WithRTCPHandler ¶
func WithRTCPHandler(cb func(rtcp.Packet)) LocalTrackOptions
WithRTCPHandler sets a callback to receive RTCP packets for the track.
func WithSimulcast ¶
func WithSimulcast(simulcastID string, layer *livekit.VideoLayer) LocalTrackOptions
WithSimulcast marks the current track for simulcasting. In order to use simulcast, simulcastID must be identical across all layers.
type LocalTrackPublication ¶
type LocalTrackPublication struct {
// contains filtered or unexported fields
}
func NewLocalTrackPublication ¶
func NewLocalTrackPublication(kind TrackKind, track Track, opts TrackPublicationOptions, engine *RTCEngine, log protoLogger.Logger) *LocalTrackPublication
func (*LocalTrackPublication) CloseTrack ¶
func (p *LocalTrackPublication) CloseTrack()
CloseTrack closes the underlying track and all simulcast tracks. This should be called when the track is no longer needed.
func (*LocalTrackPublication) GetSimulcastTrack ¶
func (p *LocalTrackPublication) GetSimulcastTrack(quality livekit.VideoQuality) *LocalTrack
GetSimulcastTrack returns the simulcast track for a specific quality level. Returns nil if simulcast is not enabled or the quality level doesn't exist.
func (*LocalTrackPublication) IsSubscribed ¶
func (p *LocalTrackPublication) IsSubscribed() bool
func (*LocalTrackPublication) PublicationOptions ¶
func (p *LocalTrackPublication) PublicationOptions() TrackPublicationOptions
func (*LocalTrackPublication) SetLogger ¶ added in v2.12.3
func (p *LocalTrackPublication) SetLogger(log protoLogger.Logger)
func (*LocalTrackPublication) SetMuted ¶
func (p *LocalTrackPublication) SetMuted(muted bool)
SetMuted mutes or unmutes the track. When muted, no media data will be sent to other participants.
func (*LocalTrackPublication) SimulateDisconnection ¶ added in v2.2.1
func (p *LocalTrackPublication) SimulateDisconnection(duration time.Duration)
SimulateDisconnection simulates a network disconnection for testing purposes. If duration is 0, the disconnection persists until manually reconnected.
func (*LocalTrackPublication) Source ¶
func (p *LocalTrackPublication) Source() livekit.TrackSource
func (*LocalTrackPublication) TrackLocal ¶
func (p *LocalTrackPublication) TrackLocal() webrtc.TrackLocal
func (*LocalTrackPublication) TrackLocalForSimulcast ¶ added in v2.12.3
func (p *LocalTrackPublication) TrackLocalForSimulcast() []*LocalTrack
type LocalTrackPublishOption ¶ added in v2.12.3
type LocalTrackPublishOption func(*LocalTrackPublishOptions)
func WithBackupCodec ¶ added in v2.12.3
func WithBackupCodec(backupCodecTrack TrackLocalWithCodec) LocalTrackPublishOption
func WithBackupCodecForSimulcastTrack ¶ added in v2.12.3
func WithBackupCodecForSimulcastTrack(backupCodecTracks []*LocalTrack) LocalTrackPublishOption
type LocalTrackPublishOptions ¶ added in v2.12.3
type LocalTrackPublishOptions struct {
// contains filtered or unexported fields
}
type LocalTrackWithClose ¶
type LocalTrackWithClose interface {
webrtc.TrackLocal
Close() error
}
type NullSampleProvider ¶
type NullSampleProvider struct {
BaseSampleProvider
BytesPerSample uint32
SampleDuration time.Duration
}
NullSampleProvider is a media provider that provides null packets, it could meet a certain bitrate, if desired
func NewNullSampleProvider ¶
func NewNullSampleProvider(bitrate uint32) *NullSampleProvider
func (*NullSampleProvider) NextSample ¶
type PCTransport ¶
type PCTransport struct {
OnOffer func(description webrtc.SessionDescription)
// contains filtered or unexported fields
}
PCTransport is a wrapper around PeerConnection, with some helper methods
func NewPCTransport ¶
func NewPCTransport(params PCTransportParams) (*PCTransport, error)
func (*PCTransport) AddICECandidate ¶
func (t *PCTransport) AddICECandidate(candidate webrtc.ICECandidateInit) error
func (*PCTransport) Close ¶
func (t *PCTransport) Close() error
func (*PCTransport) GetLocalOffer ¶ added in v2.10.0
func (t *PCTransport) GetLocalOffer() (webrtc.SessionDescription, error)
func (*PCTransport) GetSelectedCandidatePair ¶
func (t *PCTransport) GetSelectedCandidatePair() (*webrtc.ICECandidatePair, error)
func (*PCTransport) IsConnected ¶
func (t *PCTransport) IsConnected() bool
func (*PCTransport) Negotiate ¶
func (t *PCTransport) Negotiate()
func (*PCTransport) OnRemoteDescriptionSettled ¶
func (t *PCTransport) OnRemoteDescriptionSettled(f func() error)
func (*PCTransport) PeerConnection ¶
func (t *PCTransport) PeerConnection() *webrtc.PeerConnection
func (*PCTransport) SetConfiguration ¶ added in v2.2.1
func (t *PCTransport) SetConfiguration(config webrtc.Configuration) error
func (*PCTransport) SetLocalOffer ¶ added in v2.10.0
func (t *PCTransport) SetLocalOffer(offer webrtc.SessionDescription)
func (*PCTransport) SetLogger ¶ added in v2.2.1
func (t *PCTransport) SetLogger(l protoLogger.Logger)
SetLogger overrides default logger.
func (*PCTransport) SetRTT ¶
func (t *PCTransport) SetRTT(rtt uint32)
func (*PCTransport) SetRemoteDescription ¶
func (t *PCTransport) SetRemoteDescription(sd webrtc.SessionDescription) error
type PCTransportParams ¶
type Participant ¶
type Participant interface {
SID() string
Identity() string
Name() string
Kind() ParticipantKind
IsSpeaking() bool
AudioLevel() float32
TrackPublications() []TrackPublication
IsCameraEnabled() bool
IsMicrophoneEnabled() bool
Metadata() string
Attributes() map[string]string
GetTrackPublication(source livekit.TrackSource) TrackPublication
Permissions() *livekit.ParticipantPermission
// contains filtered or unexported methods
}
type ParticipantAttributesChangedFunc ¶ added in v2.2.1
type ParticipantAttributesChangedFunc func(changed map[string]string, p Participant)
ParticipantAttributesChangedFunc is callback for Participant attribute change event. The function is called with an already updated participant state and the map of changes attributes. Deleted attributes will have empty string value in the changed map.
type ParticipantCallback ¶
type ParticipantCallback struct {
// for local participant
OnLocalTrackPublished func(publication *LocalTrackPublication, lp *LocalParticipant)
OnLocalTrackUnpublished func(publication *LocalTrackPublication, lp *LocalParticipant)
// for all participants
OnTrackMuted func(pub TrackPublication, p Participant)
OnTrackUnmuted func(pub TrackPublication, p Participant)
OnMetadataChanged func(oldMetadata string, p Participant)
OnAttributesChanged ParticipantAttributesChangedFunc
OnIsSpeakingChanged func(p Participant)
OnConnectionQualityChanged func(update *livekit.ConnectionQualityInfo, p Participant)
// for remote participants
OnTrackSubscribed func(track *webrtc.TrackRemote, publication *RemoteTrackPublication, rp *RemoteParticipant)
OnTrackUnsubscribed func(track *webrtc.TrackRemote, publication *RemoteTrackPublication, rp *RemoteParticipant)
OnTrackSubscriptionFailed func(sid string, rp *RemoteParticipant)
OnTrackPublished func(publication *RemoteTrackPublication, rp *RemoteParticipant)
OnTrackUnpublished func(publication *RemoteTrackPublication, rp *RemoteParticipant)
OnDataReceived func(data []byte, params DataReceiveParams) // Deprecated: Use OnDataPacket instead
OnDataPacket func(data DataPacket, params DataReceiveParams)
OnTranscriptionReceived func(transcriptionSegments []*TranscriptionSegment, p Participant, publication TrackPublication)
}
func NewParticipantCallback ¶
func NewParticipantCallback() *ParticipantCallback
NewParticipantCallback creates a new ParticipantCallback with default no-op handlers.
func (*ParticipantCallback) Merge ¶
func (cb *ParticipantCallback) Merge(other *ParticipantCallback)
Merge copies non-nil callback functions from other to this callback.
type ParticipantKind ¶
type ParticipantKind int
type PerformRpcParams ¶ added in v2.6.0
type PerformRpcParams struct {
// The identity of the destination participant
DestinationIdentity string
// The name of the method to call
Method string
// The method payload
Payload string
// Timeout for receiving a response after the initial connection (in milliseconds).
// If a value less than 8000 ms is provided, it will be automatically clamped to 8000 ms
// to ensure sufficient time for round-trip latency buffering.
// Default: 15000 ms.
ResponseTimeout *time.Duration
}
Parameters for initiating an RPC call
type PhoneNumberClient ¶ added in v2.12.0
type PhoneNumberClient struct {
// contains filtered or unexported fields
}
func NewPhoneNumberClient ¶ added in v2.12.0
func NewPhoneNumberClient(url string, apiKey string, secretKey string, opts ...twirp.ClientOption) *PhoneNumberClient
NewPhoneNumberClient creates a LiveKit Phone Number client.
func (*PhoneNumberClient) GetPhoneNumber ¶ added in v2.12.0
func (p *PhoneNumberClient) GetPhoneNumber(ctx context.Context, in *livekit.GetPhoneNumberRequest) (*livekit.GetPhoneNumberResponse, error)
GetPhoneNumber gets a phone number from a project.
func (*PhoneNumberClient) ListPhoneNumbers ¶ added in v2.12.0
func (p *PhoneNumberClient) ListPhoneNumbers(ctx context.Context, in *livekit.ListPhoneNumbersRequest) (*livekit.ListPhoneNumbersResponse, error)
ListPhoneNumbers lists phone numbers for a project.
func (*PhoneNumberClient) PurchasePhoneNumber ¶ added in v2.12.0
func (p *PhoneNumberClient) PurchasePhoneNumber(ctx context.Context, in *livekit.PurchasePhoneNumberRequest) (*livekit.PurchasePhoneNumberResponse, error)
PurchasePhoneNumber purchases a phone number from inventory.
func (*PhoneNumberClient) ReleasePhoneNumbers ¶ added in v2.12.0
func (p *PhoneNumberClient) ReleasePhoneNumbers(ctx context.Context, in *livekit.ReleasePhoneNumbersRequest) (*livekit.ReleasePhoneNumbersResponse, error)
ReleasePhoneNumbers releases phone numbers.
func (*PhoneNumberClient) SearchPhoneNumbers ¶ added in v2.12.0
func (p *PhoneNumberClient) SearchPhoneNumbers(ctx context.Context, in *livekit.SearchPhoneNumbersRequest) (*livekit.SearchPhoneNumbersResponse, error)
SearchPhoneNumbers searches for available phone numbers in inventory.
func (*PhoneNumberClient) UpdatePhoneNumber ¶ added in v2.12.0
func (p *PhoneNumberClient) UpdatePhoneNumber(ctx context.Context, in *livekit.UpdatePhoneNumberRequest) (*livekit.UpdatePhoneNumberResponse, error)
UpdatePhoneNumber updates a phone number in a project.
type Private ¶ added in v2.9.1
type Private[T any] struct { // contains filtered or unexported fields }
func MakePrivate ¶ added in v2.9.1
type PubCallback ¶
type PubCallback func(pub TrackPublication, participant *RemoteParticipant)
type RTCEngine ¶
type RTCEngine struct {
// contains filtered or unexported fields
}
func NewRTCEngine ¶
func (*RTCEngine) GetDataChannel ¶
func (e *RTCEngine) GetDataChannel(kind livekit.DataPacket_Kind) *webrtc.DataChannel
func (*RTCEngine) GetDataChannelSub ¶
func (e *RTCEngine) GetDataChannelSub(kind livekit.DataPacket_Kind) *webrtc.DataChannel
func (*RTCEngine) IsConnected ¶
func (*RTCEngine) JoinContext ¶ added in v2.4.2
func (e *RTCEngine) JoinContext( ctx context.Context, url string, token string, connectParams *signalling.ConnectParams, ) (bool, error)
func (*RTCEngine) OnConnectionQuality ¶
func (e *RTCEngine) OnConnectionQuality(cqi []*livekit.ConnectionQualityInfo)
func (*RTCEngine) OnJoinResponse ¶ added in v2.9.2
func (e *RTCEngine) OnJoinResponse(res *livekit.JoinResponse) error
signalling.SignalProcessor implementation
func (*RTCEngine) OnLeave ¶ added in v2.9.2
func (e *RTCEngine) OnLeave(leave *livekit.LeaveRequest)
func (*RTCEngine) OnLocalTrackPublished ¶ added in v2.9.2
func (e *RTCEngine) OnLocalTrackPublished(res *livekit.TrackPublishedResponse)
func (*RTCEngine) OnLocalTrackSubscribed ¶ added in v2.9.1
func (e *RTCEngine) OnLocalTrackSubscribed(trackSubscribed *livekit.TrackSubscribed)
func (*RTCEngine) OnLocalTrackUnpublished ¶ added in v2.3.1
func (e *RTCEngine) OnLocalTrackUnpublished(res *livekit.TrackUnpublishedResponse)
func (*RTCEngine) OnMediaSectionsRequirement ¶ added in v2.11.2
func (e *RTCEngine) OnMediaSectionsRequirement(mediaSectionsRequirement *livekit.MediaSectionsRequirement)
func (*RTCEngine) OnParticipantUpdate ¶
func (e *RTCEngine) OnParticipantUpdate(info []*livekit.ParticipantInfo)
func (*RTCEngine) OnReconnectResponse ¶ added in v2.10.0
func (e *RTCEngine) OnReconnectResponse(res *livekit.ReconnectResponse) error
func (*RTCEngine) OnRoomMoved ¶ added in v2.8.2
func (e *RTCEngine) OnRoomMoved(moved *livekit.RoomMovedResponse)
func (*RTCEngine) OnRoomUpdate ¶
func (*RTCEngine) OnSpeakersChanged ¶
func (e *RTCEngine) OnSpeakersChanged(si []*livekit.SpeakerInfo)
func (*RTCEngine) OnSubscribedAudioCodecUpdate ¶ added in v2.12.3
func (e *RTCEngine) OnSubscribedAudioCodecUpdate(subscribedAudioCodecUpdate *livekit.SubscribedAudioCodecUpdate)
func (*RTCEngine) OnSubscribedQualityUpdate ¶ added in v2.9.2
func (e *RTCEngine) OnSubscribedQualityUpdate(subscribedQualityUpdate *livekit.SubscribedQualityUpdate)
func (*RTCEngine) OnTokenRefresh ¶ added in v2.9.2
func (*RTCEngine) OnTrackRemoteMuted ¶ added in v2.3.1
func (e *RTCEngine) OnTrackRemoteMuted(request *livekit.MuteTrackRequest)
func (*RTCEngine) OnTransportClose ¶ added in v2.9.2
func (e *RTCEngine) OnTransportClose()
signalling.SignalTransportHandler implementation
func (*RTCEngine) OnTrickle ¶ added in v2.9.2
func (e *RTCEngine) OnTrickle(init webrtc.ICECandidateInit, target livekit.SignalTarget)
func (*RTCEngine) Publisher ¶ added in v2.0.4
func (e *RTCEngine) Publisher() (*PCTransport, bool)
func (*RTCEngine) RegisterTrackPublishedListener ¶ added in v2.3.1
func (e *RTCEngine) RegisterTrackPublishedListener(cid string, c chan *livekit.TrackPublishedResponse)
func (*RTCEngine) SendAddTrack ¶ added in v2.9.2
func (e *RTCEngine) SendAddTrack(addTrack *livekit.AddTrackRequest) error
func (*RTCEngine) SendLeaveWithReason ¶ added in v2.9.2
func (e *RTCEngine) SendLeaveWithReason(reason livekit.DisconnectReason) error
func (*RTCEngine) SendMuteTrack ¶ added in v2.9.2
func (*RTCEngine) SendSubscriptionPermission ¶ added in v2.9.2
func (e *RTCEngine) SendSubscriptionPermission(subscriptionPermission *livekit.SubscriptionPermission) error
func (*RTCEngine) SendSyncState ¶ added in v2.9.2
func (*RTCEngine) SendUpdateParticipantMetadata ¶ added in v2.9.2
func (e *RTCEngine) SendUpdateParticipantMetadata(metadata *livekit.UpdateParticipantMetadata) error
func (*RTCEngine) SendUpdateSubscription ¶ added in v2.9.2
func (e *RTCEngine) SendUpdateSubscription(updateSubscription *livekit.UpdateSubscription) error
func (*RTCEngine) SendUpdateTrackSettings ¶ added in v2.9.2
func (e *RTCEngine) SendUpdateTrackSettings(settings *livekit.UpdateTrackSettings) error
func (*RTCEngine) SetLogger ¶ added in v2.2.1
func (e *RTCEngine) SetLogger(l protoLogger.Logger)
SetLogger overrides default logger.
func (*RTCEngine) Simulate ¶ added in v2.9.2
func (e *RTCEngine) Simulate(scenario SimulateScenario)
func (*RTCEngine) Subscriber ¶ added in v2.0.4
func (e *RTCEngine) Subscriber() (*PCTransport, bool)
func (*RTCEngine) UnregisterTrackPublishedListener ¶ added in v2.3.1
type ReaderSampleProvider ¶
type ReaderSampleProvider struct {
// Configuration
Mime string
FrameDuration time.Duration
OnWriteComplete func()
AudioLevel uint8
// contains filtered or unexported fields
}
ReaderSampleProvider provides samples by reading from an io.ReadCloser implementation
func (*ReaderSampleProvider) Close ¶
func (p *ReaderSampleProvider) Close() error
func (*ReaderSampleProvider) CurrentAudioLevel ¶
func (p *ReaderSampleProvider) CurrentAudioLevel() uint8
func (*ReaderSampleProvider) NextSample ¶
func (*ReaderSampleProvider) OnBind ¶
func (p *ReaderSampleProvider) OnBind() error
func (*ReaderSampleProvider) OnUnbind ¶
func (p *ReaderSampleProvider) OnUnbind() error
type ReaderSampleProviderOption ¶
type ReaderSampleProviderOption func(*ReaderSampleProvider)
type RemoteParticipant ¶
type RemoteParticipant struct {
// contains filtered or unexported fields
}
func (*RemoteParticipant) Attributes ¶ added in v2.2.1
func (*RemoteParticipant) AudioLevel ¶
func (p *RemoteParticipant) AudioLevel() float32
func (*RemoteParticipant) GetTrackPublication ¶
func (p *RemoteParticipant) GetTrackPublication(source livekit.TrackSource) TrackPublication
func (*RemoteParticipant) IsCameraEnabled ¶
func (p *RemoteParticipant) IsCameraEnabled() bool
func (*RemoteParticipant) IsMicrophoneEnabled ¶
func (p *RemoteParticipant) IsMicrophoneEnabled() bool
func (*RemoteParticipant) IsScreenShareAudioEnabled ¶
func (p *RemoteParticipant) IsScreenShareAudioEnabled() bool
func (*RemoteParticipant) IsScreenShareEnabled ¶
func (p *RemoteParticipant) IsScreenShareEnabled() bool
func (*RemoteParticipant) IsSpeaking ¶
func (p *RemoteParticipant) IsSpeaking() bool
func (*RemoteParticipant) Kind ¶
func (p *RemoteParticipant) Kind() ParticipantKind
func (*RemoteParticipant) Permissions ¶
func (p *RemoteParticipant) Permissions() *livekit.ParticipantPermission
func (*RemoteParticipant) SetLogger ¶ added in v2.12.3
func (p *RemoteParticipant) SetLogger(logger protoLogger.Logger)
func (*RemoteParticipant) TrackPublications ¶
func (p *RemoteParticipant) TrackPublications() []TrackPublication
func (*RemoteParticipant) WritePLI ¶
func (p *RemoteParticipant) WritePLI(ssrc webrtc.SSRC)
type RemoteTrackPublication ¶
type RemoteTrackPublication struct {
// contains filtered or unexported fields
}
func (*RemoteTrackPublication) IsEnabled ¶
func (p *RemoteTrackPublication) IsEnabled() bool
IsEnabled returns whether the track is enabled (not disabled). Disabled tracks will not receive media data even when subscribed.
func (*RemoteTrackPublication) IsSubscribed ¶
func (p *RemoteTrackPublication) IsSubscribed() bool
func (*RemoteTrackPublication) OnRTCP ¶
func (p *RemoteTrackPublication) OnRTCP(cb func(rtcp.Packet))
OnRTCP sets a callback to receive RTCP packets for this track.
func (*RemoteTrackPublication) Receiver ¶
func (p *RemoteTrackPublication) Receiver() *webrtc.RTPReceiver
Receiver returns the RTP receiver associated with this track publication.
func (*RemoteTrackPublication) SetEnabled ¶
func (p *RemoteTrackPublication) SetEnabled(enabled bool)
SetEnabled enables or disables the track. When disabled, the track will not receive media data even when subscribed.
func (*RemoteTrackPublication) SetSubscribed ¶
func (p *RemoteTrackPublication) SetSubscribed(subscribed bool) error
SetSubscribed subscribes or unsubscribes from this track. When subscribed, track data will be received from the server.
func (*RemoteTrackPublication) SetVideoDimensions ¶
func (p *RemoteTrackPublication) SetVideoDimensions(width uint32, height uint32)
SetVideoDimensions sets the preferred video dimensions to receive. This is a hint to the server about what resolution to send.
func (*RemoteTrackPublication) SetVideoQuality ¶
func (p *RemoteTrackPublication) SetVideoQuality(quality livekit.VideoQuality) error
SetVideoQuality sets the preferred video quality to receive.
func (*RemoteTrackPublication) Source ¶
func (p *RemoteTrackPublication) Source() livekit.TrackSource
func (*RemoteTrackPublication) TrackRemote ¶
func (p *RemoteTrackPublication) TrackRemote() *webrtc.TrackRemote
TrackRemote returns the underlying webrtc.TrackRemote if available. Returns nil if the track is not subscribed
type Room ¶
type Room struct {
LocalParticipant *LocalParticipant
// contains filtered or unexported fields
}
func ConnectToRoom ¶
func ConnectToRoom(url string, info ConnectInfo, callback *RoomCallback, opts ...ConnectOption) (*Room, error)
ConnectToRoom creates and joins the room
func ConnectToRoomWithToken ¶
func ConnectToRoomWithToken(url, token string, callback *RoomCallback, opts ...ConnectOption) (*Room, error)
ConnectToRoomWithToken creates and joins the room
func NewRoom ¶
func NewRoom(callback *RoomCallback) *Room
NewRoom can be used to update callbacks before calling Join
func (*Room) ActiveSpeakers ¶
func (r *Room) ActiveSpeakers() []Participant
ActiveSpeakers returns a list of currently active speakers. Speakers are ordered by audio level (loudest first).
func (*Room) ConnectionState ¶ added in v2.2.0
func (r *Room) ConnectionState() ConnectionState
ConnectionState returns the current connection state of the room.
func (*Room) Disconnect ¶
func (r *Room) Disconnect()
Disconnect leaves the room, indicating the client initiated the disconnect.
func (*Room) DisconnectWithReason ¶ added in v2.3.0
func (r *Room) DisconnectWithReason(reason livekit.DisconnectReason)
DisconnectWithReason leaves the room with a specific disconnect reason.
func (*Room) GetParticipantByIdentity ¶
func (r *Room) GetParticipantByIdentity(identity string) *RemoteParticipant
GetParticipantByIdentity returns a remote participant by their identity. Returns nil if not found. Note: this represents the current view from the local participant's perspective
func (*Room) GetParticipantBySID ¶
func (r *Room) GetParticipantBySID(sid string) *RemoteParticipant
GetParticipantBySID returns a remote participant by their session ID. Returns nil if not found. Note: this represents the current view from the local participant's perspective
func (*Room) GetRemoteParticipants ¶
func (r *Room) GetRemoteParticipants() []*RemoteParticipant
GetRemoteParticipants returns all remote participants in the room as seen by the local participant Note: this does not represent the exact state from the server's view. To get all participants that exists on the server, use RoomServiceClient.ListParticipants instead.
func (*Room) IsRecording ¶ added in v2.12.8
IsRecording returns true if the room is currently being recorded.
func (*Room) Join ¶
func (r *Room) Join(url string, info ConnectInfo, opts ...ConnectOption) error
Join - joins the room as with default permissions
func (*Room) JoinWithToken ¶
func (r *Room) JoinWithToken(url, token string, opts ...ConnectOption) error
JoinWithToken - customize participant options by generating your own token
func (*Room) OnConnectionQuality ¶ added in v2.9.2
func (r *Room) OnConnectionQuality(updates []*livekit.ConnectionQualityInfo)
func (*Room) OnDataPacket ¶ added in v2.9.2
func (r *Room) OnDataPacket(identity string, dataPacket DataPacket)
func (*Room) OnDisconnected ¶ added in v2.9.2
func (r *Room) OnDisconnected(reason DisconnectionReason)
func (*Room) OnLocalTrackSubscribed ¶ added in v2.9.2
func (r *Room) OnLocalTrackSubscribed(trackSubscribed *livekit.TrackSubscribed)
func (*Room) OnLocalTrackUnpublished ¶ added in v2.9.2
func (r *Room) OnLocalTrackUnpublished(msg *livekit.TrackUnpublishedResponse)
func (*Room) OnMediaSectionsRequirement ¶ added in v2.11.2
func (r *Room) OnMediaSectionsRequirement(mediaSectionsRequirement *livekit.MediaSectionsRequirement)
func (*Room) OnMediaTrack ¶ added in v2.9.2
func (r *Room) OnMediaTrack(track *webrtc.TrackRemote, receiver *webrtc.RTPReceiver)
engineHandler implementation
func (*Room) OnParticipantDisconnect ¶ added in v2.9.2
func (r *Room) OnParticipantDisconnect(rp *RemoteParticipant)
func (*Room) OnParticipantUpdate ¶ added in v2.9.2
func (r *Room) OnParticipantUpdate(participants []*livekit.ParticipantInfo)
func (*Room) OnRestarted ¶ added in v2.9.2
func (r *Room) OnRestarted( room *livekit.Room, participant *livekit.ParticipantInfo, otherParticipants []*livekit.ParticipantInfo, )
func (*Room) OnRestarting ¶ added in v2.9.2
func (r *Room) OnRestarting()
func (*Room) OnResuming ¶ added in v2.9.2
func (r *Room) OnResuming()
func (*Room) OnRoomJoined ¶ added in v2.10.0
func (r *Room) OnRoomJoined( room *livekit.Room, participant *livekit.ParticipantInfo, otherParticipants []*livekit.ParticipantInfo, serverInfo *livekit.ServerInfo, sifTrailer []byte, )
func (*Room) OnRoomMoved ¶ added in v2.9.2
func (r *Room) OnRoomMoved(moved *livekit.RoomMovedResponse)
func (*Room) OnRoomUpdate ¶ added in v2.9.2
func (*Room) OnRpcRequest ¶ added in v2.9.2
func (*Room) OnRpcResponse ¶ added in v2.9.2
func (*Room) OnSpeakersChanged ¶ added in v2.9.2
func (r *Room) OnSpeakersChanged(speakerUpdates []*livekit.SpeakerInfo)
func (*Room) OnStreamChunk ¶ added in v2.9.2
func (r *Room) OnStreamChunk(streamChunk *livekit.DataStream_Chunk)
func (*Room) OnStreamHeader ¶ added in v2.9.2
func (r *Room) OnStreamHeader(streamHeader *livekit.DataStream_Header, participantIdentity string)
func (*Room) OnStreamTrailer ¶ added in v2.9.2
func (r *Room) OnStreamTrailer(streamTrailer *livekit.DataStream_Trailer)
func (*Room) OnSubscribedAudioCodecUpdate ¶ added in v2.12.3
func (r *Room) OnSubscribedAudioCodecUpdate(subscribedAudioCodecUpdate *livekit.SubscribedAudioCodecUpdate)
func (*Room) OnSubscribedQualityUpdate ¶ added in v2.9.2
func (r *Room) OnSubscribedQualityUpdate(subscribedQualityUpdate *livekit.SubscribedQualityUpdate)
func (*Room) OnTrackRemoteMuted ¶ added in v2.9.2
func (r *Room) OnTrackRemoteMuted(msg *livekit.MuteTrackRequest)
func (*Room) OnTranscription ¶ added in v2.9.2
func (r *Room) OnTranscription(transcription *livekit.Transcription)
func (*Room) PrepareConnection ¶ added in v2.2.1
PrepareConnection - with LiveKit Cloud, determine the best edge data center for the current client to connect to
func (*Room) RegisterByteStreamHandler ¶ added in v2.6.0
func (r *Room) RegisterByteStreamHandler(topic string, handler ByteStreamHandler) error
RegisterByteStreamHandler registers a handler for incoming byte streams on a specific topic. The handler will be called when a byte stream is received for the given topic. It returns an error if a handler is already registered for this topic.
func (*Room) RegisterRpcMethod ¶ added in v2.6.0
func (r *Room) RegisterRpcMethod(method string, handler RpcHandlerFunc) error
Establishes the participant as a receiver for calls of the specified RPC method. Will overwrite any existing callback for the same method.
- @param method - The name of the indicated RPC method
- @param handler - Will be invoked when an RPC request for this method is received
- @returns A promise that resolves when the method is successfully registered
Example:
room.LocalParticipant?.registerRpcMethod(
"greet",
func (data: RpcInvocationData) => {
fmt.Println("Received greeting from ", data.callerIdentity, "with payload ", data.payload)
return "Hello, " + data.callerIdentity + "!";
}
);
The handler should return either a string or an error. If unable to respond within `responseTimeout`, the request will result in an error on the caller's side.
You may throw errors of type `RpcError` with a string `message` in the handler, and they will be received on the caller's side with the message intact. Other errors thrown in your handler will not be transmitted as-is, and will instead arrive to the caller as `1500` ("Application Error").
func (*Room) RegisterTextStreamHandler ¶ added in v2.6.0
func (r *Room) RegisterTextStreamHandler(topic string, handler TextStreamHandler) error
RegisterTextStreamHandler registers a handler for incoming text streams on a specific topic. The handler will be called when a text stream is received for the given topic. It returns an error if a handler is already registered for this topic.
func (*Room) SID ¶
SID returns the unique session ID of the room. This will block until session ID is available, which could take up to 2s after joining the room.
func (*Room) ServerInfo ¶
func (r *Room) ServerInfo() *livekit.ServerInfo
ServerInfo returns information about the LiveKit server.
func (*Room) SetLogger ¶ added in v2.2.1
func (r *Room) SetLogger(l protoLogger.Logger)
SetLogger overrides default logger.
func (*Room) SifTrailer ¶ added in v2.4.1
SifTrailer returns the SIF (Server Injected Frames) trailer data used by E2EE
func (*Room) Simulate ¶
func (r *Room) Simulate(scenario SimulateScenario)
Simulate triggers various test scenarios for debugging and testing purposes. This is primarily used for development and testing.
func (*Room) UnregisterByteStreamHandler ¶ added in v2.6.0
UnregisterByteStreamHandler removes a previously registered byte stream handler.
func (*Room) UnregisterRpcMethod ¶ added in v2.6.0
UnregisterRpcMethod unregisters a previously registered RPC method.
func (*Room) UnregisterTextStreamHandler ¶ added in v2.6.0
UnregisterTextStreamHandler removes a previously registered text stream handler.
type RoomCallback ¶
type RoomCallback struct {
OnDisconnected func()
OnDisconnectedWithReason func(reason DisconnectionReason)
OnParticipantConnected func(*RemoteParticipant)
OnParticipantDisconnected func(*RemoteParticipant)
OnActiveSpeakersChanged func([]Participant)
OnRoomMetadataChanged func(metadata string)
OnRecordingStatusChanged func(isRecording bool)
OnRoomMoved func(roomName string, token string)
OnReconnecting func()
OnReconnected func()
OnLocalTrackSubscribed func(publication *LocalTrackPublication, lp *LocalParticipant)
// participant events are sent to the room as well
ParticipantCallback
}
Example ¶
ExampleRoomCallback demonstrates usage of RoomCallback to handle various room events
package main
import (
"fmt"
"github.com/livekit/protocol/livekit"
lksdk "github.com/livekit/server-sdk-go/v2"
)
func main() {
// Create a new callback handler
cb := lksdk.NewRoomCallback()
// Handle data packets received from other participants
cb.OnDataPacket = func(data lksdk.DataPacket, params lksdk.DataReceiveParams) {
// handle DTMF
switch val := data.(type) {
case *livekit.SipDTMF:
fmt.Printf("Received DTMF from %s: %s (%d)\n", params.SenderIdentity, val.Digit, val.Code)
case *lksdk.UserDataPacket:
fmt.Printf("Received user data from %s: %s\n", params.SenderIdentity, string(val.Payload))
}
}
// Handle participant metadata changes
cb.OnAttributesChanged = func(changed map[string]string, p lksdk.Participant) {
fmt.Printf("Participant %s attributes changed: %v\n", p.Identity(), changed)
}
// Handle when current participant becomes disconnected
cb.OnDisconnectedWithReason = func(reason lksdk.DisconnectionReason) {
fmt.Printf("Disconnected from room: %s\n", reason)
}
// Create a new room with the callback
room := lksdk.NewRoom(cb)
room.JoinWithToken("wss://myproject.livekit.cloud", "my-token")
}
func NewRoomCallback ¶
func NewRoomCallback() *RoomCallback
NewRoomCallback creates a new RoomCallback with default no-op handlers.
func (*RoomCallback) Merge ¶
func (cb *RoomCallback) Merge(other *RoomCallback)
Merge copies non-nil callback functions from other to this callback.
type RoomServiceClient ¶
type RoomServiceClient struct {
// contains filtered or unexported fields
}
func NewRoomServiceClient ¶
func NewRoomServiceClient(url string, apiKey string, secretKey string, opts ...twirp.ClientOption) *RoomServiceClient
func (*RoomServiceClient) CreateRoom ¶
func (c *RoomServiceClient) CreateRoom(ctx context.Context, req *livekit.CreateRoomRequest) (*livekit.Room, error)
func (*RoomServiceClient) CreateToken ¶
func (c *RoomServiceClient) CreateToken() *auth.AccessToken
func (*RoomServiceClient) DeleteRoom ¶
func (c *RoomServiceClient) DeleteRoom(ctx context.Context, req *livekit.DeleteRoomRequest) (*livekit.DeleteRoomResponse, error)
func (*RoomServiceClient) ForwardParticipant ¶ added in v2.6.0
func (c *RoomServiceClient) ForwardParticipant(ctx context.Context, req *livekit.ForwardParticipantRequest) (*livekit.ForwardParticipantResponse, error)
Forward a participant's track(s) to another room. Requires `roomAdmin` and `destinationRoom`. The forwarding will stop when the participant leaves the room or `RemoveParticipant` has been called in the destination room. A participant can be forwarded to multiple rooms. The destination room will be created if it does not exist.
func (*RoomServiceClient) GetParticipant ¶
func (c *RoomServiceClient) GetParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (*livekit.ParticipantInfo, error)
func (*RoomServiceClient) ListParticipants ¶
func (c *RoomServiceClient) ListParticipants(ctx context.Context, req *livekit.ListParticipantsRequest) (*livekit.ListParticipantsResponse, error)
func (*RoomServiceClient) ListRooms ¶
func (c *RoomServiceClient) ListRooms(ctx context.Context, req *livekit.ListRoomsRequest) (*livekit.ListRoomsResponse, error)
func (*RoomServiceClient) MoveParticipant ¶ added in v2.7.1
func (c *RoomServiceClient) MoveParticipant(ctx context.Context, req *livekit.MoveParticipantRequest) (*livekit.MoveParticipantResponse, error)
Move a connected participant to a different room. Requires `roomAdmin` and `destinationRoom`. The participant will be removed from the current room and added to the destination room. From other observers' perspective, the participant would've disconnected from the previous room and joined the new one.
func (*RoomServiceClient) MutePublishedTrack ¶
func (c *RoomServiceClient) MutePublishedTrack(ctx context.Context, req *livekit.MuteRoomTrackRequest) (*livekit.MuteRoomTrackResponse, error)
func (*RoomServiceClient) RemoveParticipant ¶
func (c *RoomServiceClient) RemoveParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (*livekit.RemoveParticipantResponse, error)
func (*RoomServiceClient) SendData ¶
func (c *RoomServiceClient) SendData(ctx context.Context, req *livekit.SendDataRequest) (*livekit.SendDataResponse, error)
func (*RoomServiceClient) UpdateParticipant ¶
func (c *RoomServiceClient) UpdateParticipant(ctx context.Context, req *livekit.UpdateParticipantRequest) (*livekit.ParticipantInfo, error)
func (*RoomServiceClient) UpdateRoomMetadata ¶
func (c *RoomServiceClient) UpdateRoomMetadata(ctx context.Context, req *livekit.UpdateRoomMetadataRequest) (*livekit.Room, error)
func (*RoomServiceClient) UpdateSubscriptions ¶
func (c *RoomServiceClient) UpdateSubscriptions(ctx context.Context, req *livekit.UpdateSubscriptionsRequest) (*livekit.UpdateSubscriptionsResponse, error)
type RpcError ¶ added in v2.6.0
type RpcError struct {
Code RpcErrorCode
Message string
Data *string
}
Specialized error handling for RPC methods.
Instances of this type, when thrown in a method handler, will have their `message` serialized and sent across the wire. The sender will receive an equivalent error on the other side.
Built-in types are included but developers may use any string, with a max length of 256 bytes.
func NewRpcError ¶ added in v2.6.0
func NewRpcError(code RpcErrorCode, message string, data *string) *RpcError
Creates an error object with the given code and message, plus an optional data payload.
If thrown in an RPC method handler, the error will be sent back to the caller.
Error codes 1001-1999 are reserved for built-in errors.
Maximum message length is 256 bytes, and maximum data payload length is 15KiB. If a payload exceeds these limits, it will be truncated.
type RpcErrorCode ¶ added in v2.6.0
type RpcErrorCode uint32
const ( RpcApplicationError RpcErrorCode = 1500 + iota RpcConnectionTimeout RpcResponseTimeout RpcRecipientDisconnected RpcResponsePayloadTooLarge RpcSendFailed )
const ( RpcUnsupportedMethod RpcErrorCode = 1400 + iota RpcRecipientNotFound RpcRequestPayloadTooLarge RpcUnsupportedServer RpcUnsupportedVersion )
type RpcHandlerFunc ¶ added in v2.6.0
type RpcHandlerFunc func(data RpcInvocationData) (string, error)
type RpcInvocationData ¶ added in v2.6.0
type RpcInvocationData struct {
// The unique request ID. Will match at both sides of the call, useful for debugging or logging.
RequestID string
// The unique participant identity of the caller.
CallerIdentity string
// The payload of the request. User-definable format, could be JSON for example.
Payload string
// The maximum time the caller will wait for a response.
ResponseTimeout time.Duration
}
Data passed to method handler for incoming RPC invocations
type SIPClient ¶
type SIPClient struct {
// contains filtered or unexported fields
}
func NewSIPClient ¶
func NewSIPClient(url string, apiKey string, secretKey string, opts ...twirp.ClientOption) *SIPClient
NewSIPClient creates a LiveKit SIP client.
func (*SIPClient) CreateSIPDispatchRule ¶
func (s *SIPClient) CreateSIPDispatchRule(ctx context.Context, in *livekit.CreateSIPDispatchRuleRequest) (*livekit.SIPDispatchRuleInfo, error)
CreateSIPDispatchRule creates SIP Dispatch Rules.
func (*SIPClient) CreateSIPInboundTrunk ¶ added in v2.2.0
func (s *SIPClient) CreateSIPInboundTrunk(ctx context.Context, in *livekit.CreateSIPInboundTrunkRequest) (*livekit.SIPInboundTrunkInfo, error)
CreateSIPInboundTrunk creates a new SIP Trunk for accepting inbound calls to LiveKit.
func (*SIPClient) CreateSIPOutboundTrunk ¶ added in v2.2.0
func (s *SIPClient) CreateSIPOutboundTrunk(ctx context.Context, in *livekit.CreateSIPOutboundTrunkRequest) (*livekit.SIPOutboundTrunkInfo, error)
CreateSIPOutboundTrunk creates a new SIP Trunk for making outbound calls from LiveKit.
func (*SIPClient) CreateSIPParticipant ¶
func (s *SIPClient) CreateSIPParticipant(ctx context.Context, in *livekit.CreateSIPParticipantRequest) (*livekit.SIPParticipantInfo, error)
CreateSIPParticipant creates SIP Participant by making an outbound call.
func (*SIPClient) DeleteSIPDispatchRule ¶
func (s *SIPClient) DeleteSIPDispatchRule(ctx context.Context, in *livekit.DeleteSIPDispatchRuleRequest) (*livekit.SIPDispatchRuleInfo, error)
DeleteSIPDispatchRule deletes SIP Dispatch Rule given an ID.
func (*SIPClient) DeleteSIPTrunk ¶
func (s *SIPClient) DeleteSIPTrunk(ctx context.Context, in *livekit.DeleteSIPTrunkRequest) (*livekit.SIPTrunkInfo, error)
DeleteSIPTrunk deletes SIP Trunk given an ID.
func (*SIPClient) GetSIPDispatchRulesByIDs ¶ added in v2.4.1
func (s *SIPClient) GetSIPDispatchRulesByIDs(ctx context.Context, ids []string) ([]*livekit.SIPDispatchRuleInfo, error)
GetSIPDispatchRulesByIDs gets SIP Dispatch Rules by ID. Returned slice is in the same order as the IDs. Missing IDs will have nil in the corresponding position.
func (*SIPClient) GetSIPInboundTrunksByIDs ¶ added in v2.4.1
func (s *SIPClient) GetSIPInboundTrunksByIDs(ctx context.Context, ids []string) ([]*livekit.SIPInboundTrunkInfo, error)
GetSIPInboundTrunksByIDs gets SIP Inbound Trunks by ID. Returned slice is in the same order as the IDs. Missing IDs will have nil in the corresponding position.
func (*SIPClient) GetSIPOutboundTrunksByIDs ¶ added in v2.4.1
func (s *SIPClient) GetSIPOutboundTrunksByIDs(ctx context.Context, ids []string) ([]*livekit.SIPOutboundTrunkInfo, error)
GetSIPOutboundTrunksByIDs gets SIP Outbound Trunks by ID. Returned slice is in the same order as the IDs. Missing IDs will have nil in the corresponding position.
func (*SIPClient) ListSIPDispatchRule ¶
func (s *SIPClient) ListSIPDispatchRule(ctx context.Context, in *livekit.ListSIPDispatchRuleRequest) (*livekit.ListSIPDispatchRuleResponse, error)
ListSIPDispatchRule lists SIP Dispatch Rules.
func (*SIPClient) ListSIPInboundTrunk ¶ added in v2.2.0
func (s *SIPClient) ListSIPInboundTrunk(ctx context.Context, in *livekit.ListSIPInboundTrunkRequest) (*livekit.ListSIPInboundTrunkResponse, error)
ListSIPInboundTrunk lists SIP Trunks accepting inbound calls.
func (*SIPClient) ListSIPOutboundTrunk ¶ added in v2.2.0
func (s *SIPClient) ListSIPOutboundTrunk(ctx context.Context, in *livekit.ListSIPOutboundTrunkRequest) (*livekit.ListSIPOutboundTrunkResponse, error)
ListSIPOutboundTrunk lists SIP Trunks for making outbound calls.
func (*SIPClient) ListSIPTrunk
deprecated
func (s *SIPClient) ListSIPTrunk(ctx context.Context, in *livekit.ListSIPTrunkRequest) (*livekit.ListSIPTrunkResponse, error)
ListSIPTrunk lists SIP Trunks.
Deprecated: Use ListSIPInboundTrunk or ListSIPOutboundTrunk
func (*SIPClient) TransferSIPParticipant ¶ added in v2.3.0
func (s *SIPClient) TransferSIPParticipant(ctx context.Context, in *livekit.TransferSIPParticipantRequest) (*emptypb.Empty, error)
TransferSIPParticipant transfer an existing SIP participant to an outside SIP endpoint.
func (*SIPClient) UpdateSIPDispatchRule ¶ added in v2.6.0
func (s *SIPClient) UpdateSIPDispatchRule(ctx context.Context, in *livekit.UpdateSIPDispatchRuleRequest) (*livekit.SIPDispatchRuleInfo, error)
UpdateSIPDispatchRule updates an existing SIP Dispatch Rule.
func (*SIPClient) UpdateSIPInboundTrunk ¶ added in v2.6.0
func (s *SIPClient) UpdateSIPInboundTrunk(ctx context.Context, in *livekit.UpdateSIPInboundTrunkRequest) (*livekit.SIPInboundTrunkInfo, error)
UpdateSIPInboundTrunk updates an existing SIP Inbound Trunk.
func (*SIPClient) UpdateSIPOutboundTrunk ¶ added in v2.6.0
func (s *SIPClient) UpdateSIPOutboundTrunk(ctx context.Context, in *livekit.UpdateSIPOutboundTrunkRequest) (*livekit.SIPOutboundTrunkInfo, error)
UpdateSIPOutboundTrunk updates an existing SIP Outbound Trunk.
type SampleProvider ¶
type SampleWriteOptions ¶
type SampleWriteOptions struct {
AudioLevel *uint8
}
type SimulateScenario ¶
type SimulateScenario int
const ( SimulateSignalReconnect SimulateScenario = iota SimulateForceTCP SimulateForceTLS SimulateSpeakerUpdate SimulateMigration SimulateServerLeave SimulateNodeFailure )
type StreamBytesOptions ¶ added in v2.6.0
type StreamBytesOptions struct {
Topic string
MimeType string
DestinationIdentities []string
StreamId *string
TotalSize uint64
Attributes map[string]string
OnProgress func(progress float64)
FileName *string
}
Options for publishing a byte stream
- Topic is the topic of the stream
- MimeType is the mime type of the stream, determined for SendFile if not provided
- DestinationIdentities is the list of identities that will receive the stream, empty for all participants
- StreamId is the id of the stream, generated if not provided
- TotalSize is the total size of the stream, optional but calculated internally for SendFile
- Attributes are any additional attributes of the stream
- OnProgress is a callback function that will be called when the stream is being written
- FileName is the name of the file, optional
type StreamTextOptions ¶ added in v2.6.0
type StreamTextOptions struct {
Topic string
DestinationIdentities []string
StreamId *string
ReplyToStreamId *string
TotalSize uint64
Attributes map[string]string
OnProgress func(progress float64)
Attachments []string
AttachedStreamIds []string
}
Options for publishing a text stream with mime type "text/plain"
- Topic is the topic of the stream
- DestinationIdentities is the list of identities that will receive the stream, empty for all participants
- StreamId is the id of the stream, generated if not provided
- ReplyToStreamId is the id of the stream to reply to, optional
- TotalSize is the total size of the stream, optional but calculated internally for SendText if not provided
- Attributes are any additional attributes of the stream
- OnProgress is a callback function that will be called when the stream is being written
- Attachments is the list of file paths to attach to the stream, optional
- AttachedStreamIds is the list of stream ids that are attached to this stream, mapped by index to attachments, optional, generated if not provided
type TextStreamHandler ¶ added in v2.6.0
type TextStreamHandler func(reader *TextStreamReader, participantIdentity string)
TextStreamHandler is a function that will be called when a text stream is received. It will be called with the stream reader and the participant identity that sent the stream.
type TextStreamInfo ¶ added in v2.6.0
type TextStreamInfo struct {
// contains filtered or unexported fields
}
Info for text streams
- Id is the id of the stream
- MimeType is the mime type of the stream, always "text/plain" for text streams
- Topic is the topic of the stream
- Timestamp is the timestamp of sending the stream
- Size is the total size of the stream, if provided
- Attributes are any additional attributes of the stream
type TextStreamReader ¶ added in v2.6.0
type TextStreamReader struct {
Info TextStreamInfo
// contains filtered or unexported fields
}
func NewTextStreamReader ¶ added in v2.6.0
func NewTextStreamReader(info TextStreamInfo, totalChunkCount *uint64) *TextStreamReader
func (TextStreamReader) OnProgress ¶ added in v2.6.0
func (r TextStreamReader) OnProgress(onProgress *func(progress float64))
OnProgress sets the callback function that will be called when the stream is being read only called if TotalSize of the stream is set
func (TextStreamReader) Read ¶ added in v2.6.0
Read reads the next len(p) bytes from the stream or until the stream buffer is drained. The return value is the number of bytes read. If the buffer has no data to return, it will wait for a write to the stream or return io.EOF if the stream is closed.
func (*TextStreamReader) ReadAll ¶ added in v2.6.0
func (r *TextStreamReader) ReadAll() string
ReadAll reads all the data from the stream and returns it as a string. This will block until the stream is closed.
func (TextStreamReader) ReadByte ¶ added in v2.6.0
ReadByte reads and returns the next byte from the buffer. If no byte is available, it will wait for a write to the stream or return io.EOF if the stream is closed.
func (TextStreamReader) ReadBytes ¶ added in v2.6.0
ReadBytes reads until the first occurrence of delim in the input, returning a slice containing the data up to and including the delimiter. If ReadBytes encounters an error before finding a delimiter, it returns the data read before EOF, but does not return EOF until the stream is closed. ReadBytes returns err != nil if and only if the returned data does not end in delim.
func (*TextStreamReader) ReadRune ¶ added in v2.6.0
func (r *TextStreamReader) ReadRune() (rune, int, error)
ReadRune reads and returns the next UTF-8-encoded Unicode code point from the buffer. If no bytes are available, it will wait for a write to the stream or return io.EOF if the stream is closed. If the bytes are an erroneous UTF-8 encoding, it consumes one byte and returns U+FFFD, 1.
func (*TextStreamReader) ReadString ¶ added in v2.6.0
func (r *TextStreamReader) ReadString(delim byte) (string, error)
ReadString reads until the first occurrence of delim in the input, returning a string containing the data up to and including the delimiter. If ReadString encounters an error before finding a delimiter, it returns the data read before EOF, but does not return EOF until the stream is closed. ReadString returns err != nil if and only if the returned data does not end in delim.
type TextStreamWriter ¶ added in v2.6.0
type TextStreamWriter struct {
Info TextStreamInfo
// contains filtered or unexported fields
}
TextStreamWriter is a writer type for text streams
func (TextStreamWriter) Close ¶ added in v2.6.0
func (w TextStreamWriter) Close()
Close the stream, this will send a stream trailer to notify the receiver that the stream is closed
func (TextStreamWriter) Write ¶ added in v2.6.0
func (w TextStreamWriter) Write(data T, onDone *func())
Write data to the stream, data can be a byte slice or a string depending on the type of the stream writer onDone is a callback function that will be called when the data provided is written to the stream
type TrackKind ¶
type TrackKind string
func KindFromRTPType ¶
func KindFromRTPType(rt webrtc.RTPCodecType) TrackKind
type TrackLocalWithCodec ¶ added in v2.12.3
type TrackLocalWithCodec interface {
webrtc.TrackLocal
Codec() webrtc.RTPCodecCapability
}
type TrackPubCallback ¶
type TrackPubCallback func(track Track, pub TrackPublication, participant *RemoteParticipant)
type TrackPublication ¶
type TrackPublication interface {
Name() string
SID() string
Source() livekit.TrackSource
Kind() TrackKind
MimeType() string
IsMuted() bool
IsSubscribed() bool
TrackInfo() *livekit.TrackInfo
// Track is either a webrtc.TrackLocal or webrtc.TrackRemote
Track() Track
// contains filtered or unexported methods
}
type TrackPublicationOptions ¶
type TrackPublicationOptions struct {
Name string
Source livekit.TrackSource
// Set dimensions for video
VideoWidth int
VideoHeight int
// Opus only
DisableDTX bool
Stereo bool
// which stream the track belongs to, used to group tracks together.
// if not specified, server will infer it from track source to bundle camera/microphone, screenshare/audio together
Stream string
// encryption type
Encryption livekit.Encryption_Type
BackupCodecPolicy livekit.BackupCodecPolicy
}
type TranscriptionSegment ¶ added in v2.4.1
type TranscriptionSegment struct {
ID string
Text string
Language string
StartTime uint64
EndTime uint64
Final bool
}
func ExtractTranscriptionSegments ¶ added in v2.4.1
func ExtractTranscriptionSegments(transcription *livekit.Transcription) []*TranscriptionSegment
type UserDataPacket ¶ added in v2.0.5
UserDataPacket is a custom user data that can be sent via WebRTC on a custom topic.
func UserData ¶ added in v2.0.5
func UserData(data []byte) *UserDataPacket
UserData creates a UserDataPacket with opaque bytes that can be sent via WebRTC.
func (*UserDataPacket) ToProto ¶ added in v2.0.5
func (p *UserDataPacket) ToProto() *livekit.DataPacket
ToProto converts the UserDataPacket to a protobuf DataPacket.
Source Files
¶
- agent_client.go
- agent_dispatch_client.go
- auth.go
- callback.go
- data.go
- egressclient.go
- encryption.go
- engine.go
- errors.go
- ingressclient.go
- localparticipant.go
- localtrack.go
- localtrackoptions.go
- logger.go
- participant.go
- phonenumberclient.go
- private.go
- protocolversion.go
- publication.go
- readersampleprovider.go
- regionurlprovider.go
- remoteparticipant.go
- room.go
- roomclient.go
- rpc.go
- sampleprovider.go
- sipclient.go
- streams.go
- track.go
- transcription.go
- transport.go
- utils.go
- version.go
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
audiotrack
command
|
|
|
audiotracke2ee
command
|
|
|
datastreams
command
|
|
|
echo
command
|
|
|
echoe2ee
command
|
|
|
filesaver
command
|
|
|
filesender
command
|
|
|
openai_realtime_voice
command
|
|
|
rpc
command
|
|
|
pkg
|
|
|
samplebuilder
Package samplebuilder builds media frames from RTP packets.
|
Package samplebuilder builds media frames from RTP packets. |
|
synchronizer/synchronizerfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |