Search Results for

    Show / Hide Table of Contents

    Class LocalMediaBase<TLocalMedia, TAudioTrack, TVideoTrack>

    A collection of local audio/video track base methods.

    Inheritance
    System.Object
    Serializable
    Dynamic
    MediaBase<TAudioTrack, TVideoTrack>
    Media<TAudioTrack, TVideoTrack>
    LocalMediaBase<TLocalMedia, TAudioTrack, TVideoTrack>
    LocalMedia
    Implements
    IMedia<TAudioTrack, TVideoTrack>
    Inherited Members
    Media<TAudioTrack, TVideoTrack>.AudioLevelInterval
    Media<TAudioTrack, TVideoTrack>.AudioTracks
    Media<TAudioTrack, TVideoTrack>.VideoTracks
    Media<TAudioTrack, TVideoTrack>.OnAudioLevel
    Media<TAudioTrack, TVideoTrack>.OnVideoSize
    Media<TAudioTrack, TVideoTrack>.OnVideoSizeChange
    Media<TAudioTrack, TVideoTrack>.OnAudioDestroyed
    Media<TAudioTrack, TVideoTrack>.OnVideoDestroyed
    Media<TAudioTrack, TVideoTrack>.AddAudioTrack(TAudioTrack)
    Media<TAudioTrack, TVideoTrack>.RemoveAudioTrack(TAudioTrack)
    Media<TAudioTrack, TVideoTrack>.AddVideoTrack(TVideoTrack)
    Media<TAudioTrack, TVideoTrack>.RemoveVideoTrack(TVideoTrack)
    Media<TAudioTrack, TVideoTrack>.IsRecordingAudio
    Media<TAudioTrack, TVideoTrack>.IsRecordingVideo
    Media<TAudioTrack, TVideoTrack>.VideoSize
    Media<TAudioTrack, TVideoTrack>.GrabVideoFrame()
    Media<TAudioTrack, TVideoTrack>.Destroy()
    Media<TAudioTrack, TVideoTrack>.CreateAudioTrackCollection()
    Media<TAudioTrack, TVideoTrack>.CreateVideoTrackCollection()
    Media<TAudioTrack, TVideoTrack>.ArrayFromAudioTracks(List<TAudioTrack>)
    Media<TAudioTrack, TVideoTrack>.ArrayFromVideoTracks(List<TVideoTrack>)
    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 LocalMediaBase<TLocalMedia, TAudioTrack, TVideoTrack> : Media<TAudioTrack, TVideoTrack>, IMedia<TAudioTrack, TVideoTrack> where TLocalMedia : LocalMediaBase<TLocalMedia, TAudioTrack, TVideoTrack> where TAudioTrack : AudioTrack where TVideoTrack : VideoTrack
    Type Parameters
    Name Description
    TLocalMedia
    TAudioTrack
    TVideoTrack

    Constructors

    LocalMediaBase()

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

    Declaration
    public LocalMediaBase()

    Properties

    AudioEncoding

    Gets the local audio encoding configuration. If there are multiple audio tracks in a custom media stack, this method calls into the first audio track.

    Declaration
    public AudioEncodingConfig AudioEncoding { get; }
    Property Value
    Type Description
    AudioEncodingConfig

    AudioEncodings

    Gets or sets the local audio encoding configurations. Audio encodings cannot be empty, so if you set an encoding with a null value or an empty array, this method creates an empty array with one AudioEncodingConfig in it.
    If a new audio encodings array has the same number of encodings as the current one, the new audio encodings are applied to the local media’s audio track. Otherwise, an exception is thrown because the number of audio encodings cannot be changed once they are set.

    Declaration
    public AudioEncodingConfig[] AudioEncodings { get; set; }
    Property Value
    Type Description
    AudioEncodingConfig[]

    AudioSimulcastDisabled

    Gets or sets whether audio simulcast is disabled.

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

    AudioSimulcastEncodingCount

    Gets or sets the maximum number of simulcast encodings that this media produces for the audio stream.
    The number of encodings cannot be changed once they are set.
    This property must be set before the media starts.

    Declaration
    public int AudioSimulcastEncodingCount { get; set; }
    Property Value
    Type Description
    System.Int32

    AudioSimulcastPreferredBitrate

    Gets or sets the preferred audio simulcast bitrate, in kbps. The bitrate must be a positive integer.

    Declaration
    public int AudioSimulcastPreferredBitrate { get; set; }
    Property Value
    Type Description
    System.Int32

    DefaultVideoBitsPerPixel

    Gets or sets the default bits-per-pixel for video.

    Declaration
    public static double DefaultVideoBitsPerPixel { get; set; }
    Property Value
    Type Description
    System.Double

    State

    Gets the current state of this media. The possible states are defined in the enumeration LocalMediaState. Use this property to check if, for example, the media instance is starting, has started, is stopping, or has stopped.

    Declaration
    public LocalMediaState State { get; }
    Property Value
    Type Description
    LocalMediaState

    VideoEncoding

    Gets the local video encoding configuration.
    If there are multiple video tracks in a custom media stack, this method calls into the first video track. Returns the local VideoEncodingConfig.

    Declaration
    public VideoEncodingConfig VideoEncoding { get; }
    Property Value
    Type Description
    VideoEncodingConfig

    VideoEncodings

    Gets or sets the local video encoding configurations. Video encodings cannot be empty, so if you set the value of this method to null or an empty array, an exception is thrown.
    The number of video encodings cannot be changed once set. If the number of new video encodings is different from the existing number of video encodings, an error is thrown. If a new video encoding array has the same number of encodings as the current one, the encodings are applied to the media’s VP8, VP9, H.264, and H.265 controllers, converters, encoders, and packetizers.
    For controllers which inherit from FrameRatePipe, that means setting controller.OutputSynchronizationSource to the encoding.SynchronizationSource. If the encoding.FrameRate is greater than zero, this sets the controller.MaxFrameRate and controller.TargetFrameRate to the encoding.FrameRate.
    For converters which are the ImageScalePipe type, that means setting converter.MaxScale and converter.TargetScale to encoding.Scale, as long as encoding.Scale is greater than zero.
    For encoders, if the encoder's output format is not a fixed bitrate and encoding.Bitrate is greater than zero, that means setting the encoder.MaxBitrate and encoder.TargetBitrate to encoding.Bitrate.
    For packetizers, that means setting packetizer.Deactivated to encoding.Deactivated.

    Declaration
    public VideoEncodingConfig[] VideoEncodings { get; set; }
    Property Value
    Type Description
    VideoEncodingConfig[]

    VideoSimulcastBitsPerPixel

    Gets or sets the video simulcast bits per pixel (bpp). The bits per pixel value must be greater than or equal to zero.
    If the video source has declared a target width, height, and frame rate, and VideoSimulcastBitsPerPixel has a set value, then the encoding bitrates are calculated with setVideoSimulcastBitsPerPixel’s value instead of the preferred bitrate.

    Declaration
    public double VideoSimulcastBitsPerPixel { get; set; }
    Property Value
    Type Description
    System.Double

    VideoSimulcastDegradationPreference

    Gets or sets the video’s simulcast degradation preference.
    The following degradation preferences can be set:
    Automatic: Prefers to automate degradation based on video type. A Screen video type prefers to degrade FrameRate. A Camera video type prefers to degrade Resolution. An unknown video type prefers a Balanced approach.
    Balanced: Prefers to degrade both FrameRate and Resolution together in smaller increments.
    FrameRate: Prefers to degrade FrameRate instead of Resolution.
    Resolution: Prefers to degrade Resolution instead of FrameRate.

    Declaration
    public VideoDegradationPreference VideoSimulcastDegradationPreference { get; set; }
    Property Value
    Type Description
    VideoDegradationPreference

    VideoSimulcastDisabled

    Gets or sets whether video simulcast is disabled. If true, video simulcast is disabled. If false, video simulcast is enabled.

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

    VideoSimulcastEncodingCount

    Gets or sets the maximum number of simulcast encodings that this LocalMedia produces for the video stream. The default value is 2. For LiveSwitch Media Server, the maximum is 4 encodings. This property must be set before the LocalMedia starts.

    Declaration
    public int VideoSimulcastEncodingCount { get; set; }
    Property Value
    Type Description
    System.Int32

    VideoSimulcastPreferredBitrate

    Gets or sets the preferred bitrate of a video simulcast in Kbps. The bitrate must be a positive integer.

    Declaration
    public int VideoSimulcastPreferredBitrate { get; set; }
    Property Value
    Type Description
    System.Int32

    Methods

    AbortStart(Promise<TLocalMedia>, Exception)

    Aborts the start.

    Declaration
    protected void AbortStart(Promise<TLocalMedia> promise, Exception exception)
    Parameters
    Type Name Description
    Promise<TLocalMedia> promise

    The promise.

    Exception exception

    The exception.

    DoGetAudioEncodings()

    Gets the local audio encodings.

    Declaration
    protected abstract AudioEncodingConfig[] DoGetAudioEncodings()
    Returns
    Type Description
    AudioEncodingConfig[]

    The local audio encodings.

    DoGetVideoEncodings()

    Gets the local video encodings.

    Declaration
    protected abstract VideoEncodingConfig[] DoGetVideoEncodings()
    Returns
    Type Description
    VideoEncodingConfig[]

    The local video encodings.

    DoSetAudioEncodings(AudioEncodingConfig[])

    Sets the local audio encodings.

    Declaration
    protected abstract void DoSetAudioEncodings(AudioEncodingConfig[] encodings)
    Parameters
    Type Name Description
    AudioEncodingConfig[] encodings

    The local audio encodings.

    DoSetVideoEncodings(VideoEncodingConfig[])

    Sets the local video encodings.

    Declaration
    protected abstract void DoSetVideoEncodings(VideoEncodingConfig[] encodings)
    Parameters
    Type Name Description
    VideoEncodingConfig[] encodings

    The local video encodings.

    DoStart()

    Starts the local media.

    Declaration
    protected abstract Future<TLocalMedia> DoStart()
    Returns
    Type Description
    Future<TLocalMedia>

    DoStop()

    Stops the local media.

    Declaration
    protected abstract Future<TLocalMedia> DoStop()
    Returns
    Type Description
    Future<TLocalMedia>

    LockAudioEncodings()

    Locks the audio encodings in prior to initialization.

    Declaration
    protected void LockAudioEncodings()

    LockVideoEncodings()

    Locks the video encodings in prior to initialization.

    Declaration
    protected void LockVideoEncodings()

    LockVideoEncodings(VideoType)

    Locks the video encodings in prior to initialization.

    Declaration
    protected void LockVideoEncodings(VideoType sourceType)
    Parameters
    Type Name Description
    VideoType sourceType

    LockVideoEncodings(VideoType, Int32, Int32, Double)

    Locks the video encodings in prior to initialization.

    Declaration
    protected void LockVideoEncodings(VideoType sourceType, int sourceWidth, int sourceHeight, double sourceFrameRate)
    Parameters
    Type Name Description
    VideoType sourceType
    System.Int32 sourceWidth
    System.Int32 sourceHeight
    System.Double sourceFrameRate

    Start()

    Starts media track sources. This method does not take any parameters and executes asynchronously. Call this method when LocalMedia's state is New or Stopped. If you call this method when LocalMedia's state is not New or Stopped, then the Future returned by this method is rejected.

    Declaration
    public Future<TLocalMedia> Start()
    Returns
    Type Description
    Future<TLocalMedia>

    Stop()

    Stops media track sources. This method does not take any parameters and executes asynchronously. Call this method when LocalMedia has started. If you call this method when LocalMedia has not started, then the Future returned by this method is rejected.

    Declaration
    public Future<TLocalMedia> Stop()
    Returns
    Type Description
    Future<TLocalMedia>

    Implements

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