Class RemoteVideoSource
This component represents a remote video source added as a video track to an existing WebRTC peer connection by a remote peer and received locally. The video track can optionally be displayed locally with a MediaPlayer.
Inherited Members
Namespace: Microsoft.MixedReality.WebRTC.Unity
Assembly: cs.temp.dll.dll
Syntax
public class RemoteVideoSource : VideoSource
Fields
AutoPlayOnAdded
Automatically play the remote video track when it is added. This is equivalent to manually calling Play() when the peer connection is initialized.
Declaration
public bool AutoPlayOnAdded
Field Value
Type | Description |
---|---|
Boolean |
See Also
PeerConnection
Peer connection this remote video source is extracted from.
Declaration
public PeerConnection PeerConnection
Field Value
Type | Description |
---|---|
PeerConnection |
Properties
IsPlaying
Is the video source currently playing? The concept of playing is described in the Play() function.
Declaration
public bool IsPlaying { get; }
Property Value
Type | Description |
---|---|
Boolean |
See Also
Methods
Awake()
Implementation of MonoBehaviour.Awake which registers some handlers with the peer connection to listen to its OnInitialized and OnShutdown events.
Declaration
protected void Awake()
OnDestroy()
Implementation of MonoBehaviour.OnDestroy which unregisters all listeners from the peer connection.
Declaration
protected void OnDestroy()
Play()
Manually start playback of the remote video feed by registering some listeners to the peer connection and starting to enqueue video frames as they become ready.
Because the WebRTC implementation uses a push model, calling Play() does not necessarily start producing frames immediately. Instead, this starts listening for incoming frames from the remote peer. When a track is actually added by the remote peer and received locally, the VideoStreamStarted event is fired, and soon after frames will start being available for rendering in the internal frame queue. Note that this event may be fired before Play() is called, in which case frames are produced immediately.
If AutoPlayOnAdded is true
then this is called automatically
as soon as the peer connection is initialized.
Declaration
public void Play()
Remarks
This is only valid while the peer connection is initialized, that is after the OnInitialized event was fired.
See Also
Stop()
Stop playback of the remote video feed and unregister the handler listening to remote video frames.
Note that this is independent of whether or not a remote track is actually present. In particular this does not fire the VideoStreamStopped, which corresponds to a track being made available to the local peer by the remote peer.
Declaration
public void Stop()
See Also
Update()
Implementation of MonoBehaviour.Update to execute from the current Unity main thread any background work enqueued from free-threaded callbacks.
Declaration
protected void Update()