Class LiveKitMedia
The media of a call through LiveKit, as one IMediaConnection: this side's frames encrypted and sent on the room it publishes to, and the others' received on the rooms it subscribes to, decrypted with each sender's key.
Namespace: Uniform.LiveKit
Assembly: Uniform.LiveKit.dll
public sealed class LiveKitMedia : IMediaConnection
Constructors
|
Edit this page
View Source
Send on room's publisher connection, encrypting with OwnKey when encrypted.
Declaration
public LiveKitMedia(LiveKitRoom room, bool encrypted)
Parameters
Exceptions
Properties
|
Edit this page
View Source
Whether frames are encrypted end to end.
Declaration
public bool Encrypted { get; }
Property Value
|
Edit this page
View Source
Frames of this side that did not encrypt, and were dropped.
Declaration
public long EncryptionFailures { get; }
Property Value
|
Edit this page
View Source
Frames received from someone whose key is not known.
Declaration
public long FramesWithoutKey { get; }
Property Value
|
Edit this page
View Source
This side's key, that its frames are encrypted with; set it and send it to the others.
Declaration
public FrameCryptor OwnKey { get; }
Property Value
|
Edit this page
View Source
Declaration
public bool ReceivesVideo { get; }
Property Value
|
Edit this page
View Source
Whether the rotation of sent frames reaches the receiver, with the video orientation extension; when not, frames must be sent upright.
Declaration
public bool SendsOrientation { get; }
Property Value
|
Edit this page
View Source
Declaration
public bool SendsVideo { get; }
Property Value
Methods
|
Edit this page
View Source
Move the media from old to replacement, a room joined again, e.g. after the network changed: publishing there when old published, and receiving there; the voice and video pipelines stay as they are.
Declaration
public void Replace(LiveKitRoom old, LiveKitRoom replacement)
Parameters
Exceptions
|
Edit this page
View Source
Ask the SFUs for a video layer that fits bitsPerSecond, and the senders for at most it.
Declaration
public Task RequestBitrateAsync(long bitsPerSecond)
Parameters
| Type |
Name |
Description |
| long |
bitsPerSecond |
|
Returns
|
Edit this page
View Source
Ask the sender of the video received for a keyframe.
Declaration
public Task RequestKeyframeAsync()
Returns
|
Edit this page
View Source
Send a frame of Opus, samples long at 48 kHz.
Declaration
public ValueTask SendAudioAsync(byte[] opus, int samples = 960, CancellationToken cancellationToken = default)
Parameters
Returns
|
Edit this page
View Source
Send a VP8 frame, captured now, shown upright with rotation degrees clockwise.
Declaration
public ValueTask SendVideoAsync(byte[] frame, CancellationToken cancellationToken = default, int rotation = 0)
Parameters
Returns
|
Edit this page
View Source
Set the key of identity, a participant on the SFUs, e.g. @bob:example.org:DEVICE, at index.
Declaration
public void SetKey(string identity, byte index, ReadOnlySpan<byte> rawKey)
Parameters
|
Edit this page
View Source
Skip samples without sending, e.g. while muted, so the timestamps stay in time.
Declaration
public void SkipAudio(int samples = 960)
Parameters
| Type |
Name |
Description |
| int |
samples |
|
|
Edit this page
View Source
Receive the others' media on room, e.g. another member's SFU.
Declaration
public void Subscribe(LiveKitRoom room)
Parameters
|
Edit this page
View Source
Stop receiving on room, e.g. one that is left.
Declaration
public void Unsubscribe(LiveKitRoom room)
Parameters
Events
|
Edit this page
View Source
Raised for each audio packet received, its payload Opus; on a network thread.
Declaration
public event Action<RtpPacket>? AudioReceived
Event Type
|
Edit this page
View Source
Raised when the receiver asks to limit the video sent to a bitrate, in bits per second.
Declaration
public event Action<long>? BitrateRequested
Event Type
|
Edit this page
View Source
Raised with the sender's identity when its frame did not decrypt, e.g. before its key came; on a network thread.
Declaration
public event Action<string>? DecryptionFailed
Event Type
|
Edit this page
View Source
Raised when the receiver asks for a keyframe of the video sent.
Declaration
public event Action? KeyframeRequested
Event Type
|
Edit this page
View Source
Raised for each whole VP8 frame received, in order; on a network thread.
Declaration
public event Action<Vp8EncodedFrame>? VideoReceived
Event Type
Implements