Search Results for

    Show / Hide Table of Contents

    Class Media<TAudioTrack, TVideoTrack>

    A collection of audio/video tracks.

    Inheritance
    System.Object
    Serializable
    Dynamic
    MediaBase<TAudioTrack, TVideoTrack>
    Media<TAudioTrack, TVideoTrack>
    LocalMediaBase<TLocalMedia, TAudioTrack, TVideoTrack>
    RemoteMedia
    Implements
    IMedia<TAudioTrack, TVideoTrack>
    Inherited Members
    MediaBase<TAudioTrack, TVideoTrack>.Id
    MediaBase<TAudioTrack, TVideoTrack>.AudioTrack
    MediaBase<TAudioTrack, TVideoTrack>.AudioTracks
    MediaBase<TAudioTrack, TVideoTrack>.VideoTrack
    MediaBase<TAudioTrack, TVideoTrack>.VideoTracks
    MediaBase<TAudioTrack, TVideoTrack>.OnAudioLevel
    MediaBase<TAudioTrack, TVideoTrack>.AudioLevelInterval
    MediaBase<TAudioTrack, TVideoTrack>.OnVideoSize
    MediaBase<TAudioTrack, TVideoTrack>.OnVideoSizeChange
    MediaBase<TAudioTrack, TVideoTrack>.OnAudioDestroyed
    MediaBase<TAudioTrack, TVideoTrack>.OnVideoDestroyed
    MediaBase<TAudioTrack, TVideoTrack>.AudioGain
    MediaBase<TAudioTrack, TVideoTrack>.AudioVolume
    MediaBase<TAudioTrack, TVideoTrack>.AudioMuted
    MediaBase<TAudioTrack, TVideoTrack>.VideoMuted
    MediaBase<TAudioTrack, TVideoTrack>.VideoSize
    MediaBase<TAudioTrack, TVideoTrack>.GrabVideoFrame()
    MediaBase<TAudioTrack, TVideoTrack>.Destroy()
    Dynamic.DynamicProperties
    Dynamic.GetDynamicValue(String)
    Dynamic.SetDynamicValue(String, Object)
    Dynamic.UnsetDynamicValue(String)
    Serializable.IsDirty
    Namespace: FM.LiveSwitch
    Assembly: FM.LiveSwitch.dll
    Syntax
    public abstract class Media<TAudioTrack, TVideoTrack> : MediaBase<TAudioTrack, TVideoTrack>, IMedia<TAudioTrack, TVideoTrack> where TAudioTrack : AudioTrack where TVideoTrack : VideoTrack
    Type Parameters
    Name Description
    TAudioTrack
    TVideoTrack

    Constructors

    Media()

    Initializes a new instance of the Media<TAudioTrack, TVideoTrack> class.

    Declaration
    public Media()

    Properties

    AudioLevelInterval

    Gets or sets the interval in milliseconds between OnAudioLevel events. Defaults to 200.

    Declaration
    public override int AudioLevelInterval { get; set; }
    Property Value
    Type Description
    System.Int32
    Overrides
    FM.LiveSwitch.MediaBase<TAudioTrack, TVideoTrack>.AudioLevelInterval

    AudioTracks

    Gets all audio tracks from this media.

    Declaration
    public override TAudioTrack[] AudioTracks { get; }
    Property Value
    Type Description
    TAudioTrack[]
    Overrides
    FM.LiveSwitch.MediaBase<TAudioTrack, TVideoTrack>.AudioTracks

    IsRecordingAudio

    Gets or sets whether audio is being recorded locally.

    Declaration
    public bool IsRecordingAudio { get; protected set; }
    Property Value
    Type Description
    System.Boolean

    IsRecordingVideo

    Gets or sets whether video is being recorded locally.

    Declaration
    public bool IsRecordingVideo { get; protected set; }
    Property Value
    Type Description
    System.Boolean

    VideoSize

    Gets the size of the video track.
    If there are multiple video tracks in a custom media stack, this property is bound to the first video track.
    If you need to adjust a UI’s layout, use this property to check video dimensions. You can also use OnVideoSize to ensure that the code is responsive.

    Declaration
    public override Size VideoSize { get; }
    Property Value
    Type Description
    Size
    Overrides
    FM.LiveSwitch.MediaBase<TAudioTrack, TVideoTrack>.VideoSize

    VideoTracks

    Gets all video tracks from this media.

    Declaration
    public override TVideoTrack[] VideoTracks { get; }
    Property Value
    Type Description
    TVideoTrack[]
    Overrides
    FM.LiveSwitch.MediaBase<TAudioTrack, TVideoTrack>.VideoTracks

    Methods

    AddAudioTrack(TAudioTrack)

    Adds an audio track.

    Declaration
    protected virtual void AddAudioTrack(TAudioTrack audioTrack)
    Parameters
    Type Name Description
    TAudioTrack audioTrack

    The audio track.

    AddVideoTrack(TVideoTrack)

    Adds a video track.

    Declaration
    protected virtual void AddVideoTrack(TVideoTrack videoTrack)
    Parameters
    Type Name Description
    TVideoTrack videoTrack

    The video track.

    ArrayFromAudioTracks(List<TAudioTrack>)

    Creates an array of tracks from a list of audio tracks.

    Declaration
    protected abstract TAudioTrack[] ArrayFromAudioTracks(List<TAudioTrack> tracks)
    Parameters
    Type Name Description
    List<TAudioTrack> tracks

    The list of tracks.

    Returns
    Type Description
    TAudioTrack[]

    ArrayFromVideoTracks(List<TVideoTrack>)

    Creates an array of tracks from a list of video tracks.

    Declaration
    protected abstract TVideoTrack[] ArrayFromVideoTracks(List<TVideoTrack> tracks)
    Parameters
    Type Name Description
    List<TVideoTrack> tracks

    The list of tracks.

    Returns
    Type Description
    TVideoTrack[]

    CreateAudioTrackCollection()

    Creates an audio track collection.

    Declaration
    protected abstract List<TAudioTrack> CreateAudioTrackCollection()
    Returns
    Type Description
    List<TAudioTrack>

    CreateVideoTrackCollection()

    Creates a video track collection.

    Declaration
    protected abstract List<TVideoTrack> CreateVideoTrackCollection()
    Returns
    Type Description
    List<TVideoTrack>

    Destroy()

    Destroys all non-persistent internal objects encapsulated by the Media class.
    This method iterates over all audio and video tracks and calls each track's Destroy method for non-persistent tracks.

    Declaration
    public override void Destroy()
    Overrides
    FM.LiveSwitch.MediaBase<TAudioTrack, TVideoTrack>.Destroy()

    GrabVideoFrame()

    Gets the next frame from the video track once it is rendered.
    If there are multiple video tracks in a custom media stack, this method calls into the first video track.
    This method could be used for asynchronous video processing or analysis.

    Declaration
    public override Future<VideoBuffer> GrabVideoFrame()
    Returns
    Type Description
    Future<VideoBuffer>

    A future video buffer.

    Overrides
    FM.LiveSwitch.MediaBase<TAudioTrack, TVideoTrack>.GrabVideoFrame()

    RemoveAudioTrack(TAudioTrack)

    Removes an audio track.

    Declaration
    protected virtual bool RemoveAudioTrack(TAudioTrack audioTrack)
    Parameters
    Type Name Description
    TAudioTrack audioTrack

    The audio track.

    Returns
    Type Description
    System.Boolean

    RemoveVideoTrack(TVideoTrack)

    Removes a video track.

    Declaration
    protected virtual bool RemoveVideoTrack(TVideoTrack videoTrack)
    Parameters
    Type Name Description
    TVideoTrack videoTrack

    The video track.

    Returns
    Type Description
    System.Boolean

    Events

    OnAudioDestroyed

    Raised when the audio track is destroyed.
    If there are multiple audio tracks in a custom media stack, only the first audio track triggers this event.

    Declaration
    public override event Action0 OnAudioDestroyed
    Event Type
    Type Description
    Action0
    Overrides
    FM.LiveSwitch.MediaBase<TAudioTrack, TVideoTrack>.OnAudioDestroyed

    OnAudioLevel

    Raised periodically when the audio's level is calculated.
    When the media is in the Started state, the function runs multiple times per second. The frequency depends on the audio sampling rate.
    Use this method to determine which audio streams are active.
    If there are multiple audio tracks in a custom media stack, only the first audio track triggers this event.

    Declaration
    public override event Action1<double> OnAudioLevel
    Event Type
    Type Description
    Action1<System.Double>
    Overrides
    FM.LiveSwitch.MediaBase<TAudioTrack, TVideoTrack>.OnAudioLevel

    OnVideoDestroyed

    Raised when the video track is destroyed.
    If there are multiple video tracks in a custom media stack, only the first video track triggers this event.

    Declaration
    public override event Action0 OnVideoDestroyed
    Event Type
    Type Description
    Action0
    Overrides
    FM.LiveSwitch.MediaBase<TAudioTrack, TVideoTrack>.OnVideoDestroyed

    OnVideoSize

    Raised whenever the video's frame size is known, once per frame.
    If there are multiple video tracks in a custom media stack, only the first video track triggers this event.

    Declaration
    public override event Action1<Size> OnVideoSize
    Event Type
    Type Description
    Action1<Size>
    Overrides
    FM.LiveSwitch.MediaBase<TAudioTrack, TVideoTrack>.OnVideoSize

    OnVideoSizeChange

    Raised whenever the video's frame size changes.
    If there are multiple video tracks in a custom media stack, only the first video track triggers this event.

    Declaration
    public override event Action1<Size> OnVideoSizeChange
    Event Type
    Type Description
    Action1<Size>
    Overrides
    FM.LiveSwitch.MediaBase<TAudioTrack, TVideoTrack>.OnVideoSizeChange

    Implements

    IMedia<TIAudioTrack, TIVideoTrack>
    In This Article
    Back to top Copyright © LiveSwitch Inc. All Rights Reserved. Doc build for LiveSwitch v1.15.0