Class MediaLine
Media line abstraction for a peer connection.
This container binds together a source component (MediaTrackSource) and/or a receiver component (MediaReceiver) on one side, with a transceiver on the other side. The media line is a declarative representation of this association, which is then turned into a binding by the implementation during an SDP negotiation. This forms the core of the algorithm allowing automatic transceiver pairing between the two peers based on the declaration of intent of the user.
Assigning Unity components to the Source and Receiver properties serves
as an indication of the user intent to send and/or receive media through the transceiver, and is
used during the SDP exchange to derive the
Users typically interact with this class through the peer connection transceiver collection in the Unity inspector window, though direct manipulation via code is also possible.
Inherited Members
Namespace: Microsoft.MixedReality.WebRTC.Unity
Assembly: cs.temp.dll.dll
Syntax
public class MediaLine
Properties
LocalTrack
Local track created from a local source.
Declaration
public LocalMediaTrack LocalTrack { get; }
Property Value
Type | Description |
---|---|
LocalMediaTrack |
Remarks
This is non-null
when a live source is attached to the MediaLine, and the owning
PeerConnection is connected.
MediaKind
Kind of media of the media line and its attached transceiver.
This is assiged when the media line is created with AddMediaLine(MediaKind) and is immutable for the lifetime of the peer connection.
Declaration
public MediaKind MediaKind { get; }
Property Value
Type | Description |
---|---|
MediaKind |
Peer
PeerConnection owning this MediaLine.
Declaration
public PeerConnection Peer { get; }
Property Value
Type | Description |
---|---|
PeerConnection |
Receiver
Media receiver consuming the media received through the transceiver attached to this media line.
Declaration
public MediaReceiver Receiver { get; set; }
Property Value
Type | Description |
---|---|
MediaReceiver |
Remarks
This must be an instance of a class derived from AudioReceiver or VideoReceiver
depending on whether MediaKind is
If this is non-null
then the peer connection will negotiate receiving some media, otherwise
it will signal the remote peer that it does not wish to receive (send-only or inactive).
If Transceiver is valid, that is a first session negotiation has already been conducted,
then changing this value raises a
Must be changed on the main Unity app thread.
SenderTrackName
Name of the local media track this component will create when calling
Declaration
public string SenderTrackName { get; set; }
Property Value
Type | Description |
---|---|
String |
Remarks
This value must comply with the 'msid' attribute rules as defined in https://tools.ietf.org/html/draft-ietf-mmusic-msid-05#section-2, which in particular constraints the set of allowed characters to those allowed for a 'token' element as specified in https://tools.ietf.org/html/rfc4566#page-43:
- Symbols [!#$%'*+-.^_`{|}~] and ampersand &
- Alphanumerical characters [A-Za-z0-9]
Users can manually test if a string is a valid SDP token with the utility method
Validate(String, Boolean). The property setter will
use this and throw an
The sender track name is taken into account each time the track is created. If this property is assigned after the track was created (already negotiated), the value will be used only for the next negotiation, and the current sender track will keep its current track name (either a previous value or a generated one).
See Also
Source
Media source producing the media to send through the transceiver attached to this media line.
Declaration
public MediaTrackSource Source { get; set; }
Property Value
Type | Description |
---|---|
MediaTrackSource |
Remarks
This must be an instance of a class derived from AudioTrackSource or VideoTrackSource
depending on whether MediaKind is
Internally the peer connection will automatically create and manage a media track to bridge the media source with the transceiver.
If this is non-null
then the peer connection will negotiate sending some media, otherwise
it will signal the remote peer that it does not wish to send (receive-only or inactive).
If Transceiver is valid, that is a first session negotiation has already been completed,
then changing this value raises a
Must be changed on the main Unity app thread.
Transceiver
Transceiver attached with this media line.
On the offering peer this changes during StartConnection(), while this is updated by
Because transceivers cannot be destroyed, once this property is assigned a non-null
value it keeps that
value until the peer connection owning the media line is closed.
Declaration
public Transceiver Transceiver { get; }
Property Value
Type | Description |
---|---|
Transceiver |