types

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

View Source
const DefaultProtocol = 2

Variables

This section is empty.

Functions

This section is empty.

Types

type MediaTrack added in v0.15.0

type MediaTrack interface {
	ID() string
	Kind() livekit.TrackType
	Name() string
	IsMuted() bool
	SetMuted(muted bool)
	UpdateVideoLayers(layers []*livekit.VideoLayer)
	Source() livekit.TrackSource
	IsSimulcast() bool

	// subscribers
	AddSubscriber(participant Participant) error
	RemoveSubscriber(participantId string)
	IsSubscriber(subId string) bool
	RemoveAllSubscribers()
	// returns quality information that's appropriate for width & height
	GetQualityForDimension(width, height uint32) livekit.VideoQuality

	NotifySubscriberMute(subscriberID string)
	NotifySubscriberMaxQuality(subscriberID string, quality livekit.VideoQuality)
	OnSubscribedMaxQualityChange(f func(trackSid string, subscribedQualities []*livekit.SubscribedQuality) error)
}

MediaTrack represents a media track

type Participant

type Participant interface {
	ID() string
	Identity() string
	State() livekit.ParticipantInfo_State
	ProtocolVersion() ProtocolVersion
	IsReady() bool
	ConnectedAt() time.Time
	ToProto() *livekit.ParticipantInfo
	RTCPChan() chan []rtcp.Packet
	SetMetadata(metadata string)
	SetPermission(permission *livekit.ParticipantPermission)
	GetResponseSink() routing.MessageSink
	SetResponseSink(sink routing.MessageSink)
	SubscriberMediaEngine() *webrtc.MediaEngine
	Negotiate()
	ICERestart() error

	AddTrack(req *livekit.AddTrackRequest)
	GetPublishedTrack(sid string) PublishedTrack
	GetPublishedTracks() []PublishedTrack
	GetSubscribedTrack(sid string) SubscribedTrack
	GetSubscribedTracks() []SubscribedTrack
	HandleOffer(sdp webrtc.SessionDescription) (answer webrtc.SessionDescription, err error)
	HandleAnswer(sdp webrtc.SessionDescription) error
	AddICECandidate(candidate webrtc.ICECandidateInit, target livekit.SignalTarget) error
	AddSubscriber(op Participant) (int, error)
	SendJoinResponse(info *livekit.Room, otherParticipants []*livekit.ParticipantInfo, iceServers []*livekit.ICEServer) error
	SendParticipantUpdate(participants []*livekit.ParticipantInfo, updatedAt time.Time) error
	SendSpeakerUpdate(speakers []*livekit.SpeakerInfo) error
	SendDataPacket(packet *livekit.DataPacket) error
	SendRoomUpdate(room *livekit.Room) error
	SendConnectionQualityUpdate(update *livekit.ConnectionQualityUpdate) error
	SetTrackMuted(trackId string, muted bool, fromAdmin bool)
	GetAudioLevel() (level uint8, active bool)
	GetConnectionQuality() *livekit.ConnectionQualityInfo
	IsSubscribedTo(identity string) bool
	// returns list of participant identities that the current participant is subscribed to
	GetSubscribedParticipants() []string

	// permissions
	CanPublish() bool
	CanSubscribe() bool
	CanPublishData() bool
	Hidden() bool
	IsRecorder() bool
	SubscriberAsPrimary() bool

	Start()
	Close() error

	OnStateChange(func(p Participant, oldState livekit.ParticipantInfo_State))
	// OnTrackPublished - remote added a remoteTrack
	OnTrackPublished(func(Participant, PublishedTrack))
	// OnTrackUpdated - one of its publishedTracks changed in status
	OnTrackUpdated(callback func(Participant, PublishedTrack))
	OnMetadataUpdate(callback func(Participant))
	OnDataPacket(callback func(Participant, *livekit.DataPacket))
	OnClose(func(Participant))

	// package methods
	AddSubscribedTrack(st SubscribedTrack)
	RemoveSubscribedTrack(st SubscribedTrack)
	SubscriberPC() *webrtc.PeerConnection

	DebugInfo() map[string]interface{}
}

type ProtocolVersion

type ProtocolVersion int

func (ProtocolVersion) HandlesDataPackets

func (v ProtocolVersion) HandlesDataPackets() bool

func (ProtocolVersion) SubscriberAsPrimary added in v0.13.0

func (v ProtocolVersion) SubscriberAsPrimary() bool

SubscriberAsPrimary indicates clients initiate subscriber connection as primary

func (ProtocolVersion) SupportsConnectionQuality added in v0.14.0

func (v ProtocolVersion) SupportsConnectionQuality() bool

SupportsConnectionQuality - avoid sending frequent ConnectionQuality updates for lower protocol versions

func (ProtocolVersion) SupportsPackedStreamId

func (v ProtocolVersion) SupportsPackedStreamId() bool

func (ProtocolVersion) SupportsProtobuf added in v0.11.0

func (v ProtocolVersion) SupportsProtobuf() bool

func (ProtocolVersion) SupportsSpeakerChanged added in v0.13.0

func (v ProtocolVersion) SupportsSpeakerChanged() bool

SupportsSpeakerChanged - if client handles speaker info deltas, instead of a comprehensive list

func (ProtocolVersion) SupportsTransceiverReuse added in v0.13.3

func (v ProtocolVersion) SupportsTransceiverReuse() bool

SupportsTransceiverReuse - if transceiver reuse is supported, optimizes SDP size

type PublishedTrack

type PublishedTrack interface {
	MediaTrack

	SignalCid() string
	SdpCid() string
	ToProto() *livekit.TrackInfo

	// returns number of uptracks that are publishing, registered
	NumUpTracks() (uint32, uint32)
	PublishLossPercentage() uint32
	Receiver() sfu.TrackReceiver
	GetConnectionScore() float64

	// callbacks
	AddOnClose(func())
}

PublishedTrack is the main interface representing a track published to the room it's responsible for managing subscribers and forwarding data from the input track to all subscribers

type Room added in v0.15.0

type Room interface {
	Name() string
	UpdateSubscriptions(participant Participant, trackIDs []string, subscribe bool) error
}

Room is a container of participants, and can provide room level actions

type SubscribedTrack

type SubscribedTrack interface {
	OnBind(f func())
	ID() string
	PublisherIdentity() string
	DownTrack() *sfu.DownTrack
	MediaTrack() MediaTrack
	IsMuted() bool
	SetPublisherMuted(muted bool)
	UpdateSubscriberSettings(settings *livekit.UpdateTrackSettings)
	// selects appropriate video layer according to subscriber preferences
	UpdateVideoLayer()
}

type TrackRemote

type TrackRemote interface {
	SSRC() webrtc.SSRC
	StreamID() string
	Kind() webrtc.RTPCodecType
	Codec() webrtc.RTPCodecParameters
}

interface for properties of webrtc.TrackRemote

type WebsocketClient

type WebsocketClient interface {
	ReadMessage() (messageType int, p []byte, err error)
	WriteMessage(messageType int, data []byte) error
	WriteControl(messageType int, data []byte, deadline time.Time) error
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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