Class Player

    Definition

    Namespace:
    Tizen.Multimedia
    Assembly:
    Tizen.Multimedia.MediaPlayer.dll

    Provides the ability to control media playback.

    public class Player : IDisposable
    Inheritance
    object
    Player
    Implements
    System.IDisposable
    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    Constructors

    View Source

    Player()

    Initializes a new instance of the Player class.

    Declaration
    public Player()
    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    Properties

    View Source

    AudioEffect

    Gets the audio effect.

    Declaration
    public AudioEffect AudioEffect { get; }
    Property Value
    Type Description
    AudioEffect
    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    Exceptions
    Type Condition
    System.NotSupportedException

    The required feature is not supported.

    View Source

    AudioLatencyMode

    Gets or sets the audio latency mode.

    Declaration
    public AudioLatencyMode AudioLatencyMode { get; set; }
    Property Value
    Type Description
    AudioLatencyMode

    A AudioLatencyMode that specifies the mode. The default is Mid.

    Remarks

    If the mode is High, audio output interval can be increased, so it can keep more audio data to play. But, state transition like pause or resume can be more slower than default(Mid).

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.ArgumentException

    The value is not valid.

    View Source

    AudioTrackInfo

    Gets the track info for the audio.

    Declaration
    public PlayerTrackInfo AudioTrackInfo { get; }
    Property Value
    Type Description
    PlayerTrackInfo

    A PlayerTrackInfo for audio.

    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    View Source

    Cookie

    Gets or sets the cookie for streaming playback.

    Declaration
    public string Cookie { get; set; }
    Property Value
    Type Description
    string
    Remarks

    To set, the player must be in the Idle state.

    Exceptions
    Type Condition
    System.InvalidOperationException

    The player is not in the valid state.

    System.ObjectDisposedException

    The player has already been disposed of.

    System.ArgumentNullException

    The value to set is null.

    View Source

    Display

    Gets or sets the display.

    Declaration
    public Display Display { get; set; }
    Property Value
    Type Description
    Display

    A Display that specifies the display.

    Remarks

    The player must be in the Idle state.
    The raw video feature(http://tizen.org/feature/multimedia.raw_video) is required if the display is created with MediaView.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.ArgumentException

    The value has already been assigned to another player.

    System.InvalidOperationException

    The player is not in the valid state.

    System.NotSupportedException

    The required feature is not supported.

    View Source

    DisplaySettings

    Gets the display settings.

    Declaration
    public PlayerDisplaySettings DisplaySettings { get; }
    Property Value
    Type Description
    PlayerDisplaySettings

    A PlayerDisplaySettings that specifies the display settings.

    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    View Source

    Handle

    Gets the native handle of the player.

    Declaration
    public IntPtr Handle { get; }
    Property Value
    Type Description
    System.IntPtr

    An IntPtr that contains the native handle of the player.

    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    View Source

    IsLooping

    Gets or sets the looping state.

    Declaration
    public bool IsLooping { get; set; }
    Property Value
    Type Description
    bool

    true if the playback is looping; otherwise, false. The default value is false.

    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    View Source

    Muted

    Gets or sets the mute state.

    Declaration
    public bool Muted { get; set; }
    Property Value
    Type Description
    bool

    true if the player is muted; otherwise, false.

    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    View Source

    State

    Gets the state of the player.

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

    The current state of the player.

    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    View Source

    StreamInfo

    Gets the stream information.

    Declaration
    public StreamInfo StreamInfo { get; }
    Property Value
    Type Description
    StreamInfo

    A StreamInfo for this player.

    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    View Source

    SubtitleTrackInfo

    Gets the track info for the subtitle.

    Declaration
    public PlayerTrackInfo SubtitleTrackInfo { get; }
    Property Value
    Type Description
    PlayerTrackInfo

    A PlayerTrackInfo for the subtitle.

    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    View Source

    UserAgent

    Gets or sets the user agent for streaming playback.

    Declaration
    public string UserAgent { get; set; }
    Property Value
    Type Description
    string
    Remarks

    To set, the player must be in the Idle state.

    Exceptions
    Type Condition
    System.InvalidOperationException

    The player is not in the valid state.

    System.ObjectDisposedException

    The player has already been disposed of.

    System.ArgumentNullException

    The value to set is null.

    View Source

    Volume

    Gets or sets the current volume.

    Declaration
    public float Volume { get; set; }
    Property Value
    Type Description
    float
    Remarks

    Valid volume range is from 0 to 1.0, inclusive.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.ArgumentOutOfRangeException

    value is less than zero.
    -or-
    value is greater than 1.0.

    Methods

    View Source

    ApplyAudioStreamPolicy(AudioStreamPolicy)

    Applies the audio stream policy.

    Declaration
    public void ApplyAudioStreamPolicy(AudioStreamPolicy policy)
    Parameters
    Type Name Description
    AudioStreamPolicy policy

    The AudioStreamPolicy to apply.

    Remarks

    The player must be in the Idle state.

    Player does not support all AudioStreamType.
    Supported types are Media, System, Alarm, Notification, Emergency, VoiceInformation, RingtoneVoip and MediaExternalOnly.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.
    -or-
    policy has already been disposed of.

    System.InvalidOperationException

    The player is not in the valid state.

    System.ArgumentNullException

    policy is null.

    System.NotSupportedException

    The required feature is not supported.
    -or-
    AudioStreamType of policy is not supported on the current platform.

    See Also
    AudioStreamPolicy
    View Source

    CaptureVideoAsync()

    Captures a video frame, asynchronously.

    Declaration
    public Task<CapturedFrame> CaptureVideoAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<TResult><CapturedFrame>

    A task that represents the asynchronous capture operation.

    Remarks

    The player must be in the Playing or Paused state.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.InvalidOperationException

    The player is not in the valid state.

    System.NotSupportedException

    The required feature is not supported.

    View Source

    ClearSubtitle()

    Removes the subtitle path.

    Declaration
    public void ClearSubtitle()
    Remarks

    The player must be in the Idle state.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.InvalidOperationException

    The player is not in the valid state.

    View Source

    Dispose()

    Releases all resources used by the current instance.

    Declaration
    public void Dispose()
    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    View Source

    GetDownloadProgress()

    Gets the streaming download progress.

    Declaration
    public DownloadProgress GetDownloadProgress()
    Returns
    Type Description
    DownloadProgress

    The DownloadProgress containing current download progress.

    Remarks

    The player must be in the Playing or Paused state.

    Exceptions
    Type Condition
    System.InvalidOperationException

    The player is not streaming.
    -or-
    The player is not in the valid state.

    System.ObjectDisposedException

    The player has already been disposed of.

    View Source

    GetPlayPosition()

    Gets the play position in milliseconds.

    Declaration
    public int GetPlayPosition()
    Returns
    Type Description
    int
    Remarks

    The player must be in the Ready, Playing, or Paused state.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.InvalidOperationException

    The player is not in the valid state.

    See Also
    SetPlayPositionAsync(int, bool)
    View Source

    OnPreparing()

    Called when the Tizen.Multimedia.Player.Prepare is invoked.

    Declaration
    protected virtual void OnPreparing()
    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    View Source

    OnUnprepared()

    Called after the Player is unprepared.

    Declaration
    protected virtual void OnUnprepared()
    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    See Also
    Unprepare()
    View Source

    Pause()

    Pauses the player.

    Declaration
    public virtual void Pause()
    Remarks

    The player must be in the Playing state. It has no effect if the player is already in the Paused state.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.InvalidOperationException

    The player is not in the valid state.

    See Also
    Start()
    View Source

    PrepareAsync()

    Prepares the media player for playback, asynchronously.

    Declaration
    public virtual Task PrepareAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task

    A task that represents the asynchronous prepare operation.

    Remarks

    To prepare the player, the player must be in the Idle state, and a source must be set.

    Exceptions
    Type Condition
    System.InvalidOperationException

    No source is set.

    System.ObjectDisposedException

    The player has already been disposed of.

    System.InvalidOperationException

    The player is not in the valid state.

    View Source

    SetPlaybackRate(float)

    Sets the playback rate.

    Declaration
    public void SetPlaybackRate(float rate)
    Parameters
    Type Name Description
    float rate

    The value for the playback rate. Valid range is -5.0 to 5.0, inclusive.

    Remarks

    The player must be in the Ready, Playing, or Paused state.

    The sound will be muted, when the playback rate is under 0.0 or over 2.0.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.InvalidOperationException

    The player is not in the valid state.
    -or-
    Streaming playback.

    System.ArgumentOutOfRangeException

    rate is less than 5.0.
    -or-
    rate is greater than 5.0.
    -or-
    rate is zero.

    View Source

    SetPlayPositionAsync(int, bool)

    Sets the seek position for playback, asynchronously.

    Declaration
    public Task SetPlayPositionAsync(int position, bool accurate)
    Parameters
    Type Name Description
    int position

    The value indicating a desired position in milliseconds.

    bool accurate

    The value indicating whether the operation performs with accuracy.

    Returns
    Type Description
    System.Threading.Tasks.Task
    Remarks

    The player must be in the Ready, Playing, or Paused state.

    If the accurate is true, the play position will be adjusted as the specified position value, but this might be considerably slow. If false, the play position will be a nearest keyframe position.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.InvalidOperationException

    The player is not in the valid state.

    System.ArgumentOutOfRangeException

    The specified position is not valid.

    See Also
    GetPlayPosition()
    View Source

    SetSource(MediaSource)

    Sets a media source for the player.

    Declaration
    public void SetSource(MediaSource source)
    Parameters
    Type Name Description
    MediaSource source

    A MediaSource that specifies the source for playback.

    Remarks

    The player must be in the Idle state.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.InvalidOperationException

    The player is not in the valid state.
    -or-
    It is not able to assign the source to the player.

    See Also
    PrepareAsync()
    View Source

    SetSubtitle(string)

    Sets the subtitle path for playback.

    Declaration
    public void SetSubtitle(string path)
    Parameters
    Type Name Description
    string path
    Remarks

    Only MicroDVD/SubViewer(.sub), SAMI(.smi), and SubRip(*.srt) subtitle formats are supported.

    The mediastorage privilege(http://tizen.org/privilege/mediastorage) must be added if any files are used to play located in the internal storage. The externalstorage privilege(http://tizen.org/privilege/externalstorage) must be added if any files are used to play located in the external storage.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.ArgumentException

    path is an empty string.

    System.IO.FileNotFoundException

    The specified path does not exist.

    System.ArgumentNullException

    path is null.

    View Source

    SetSubtitleOffset(int)

    Sets the offset for the subtitle.

    Declaration
    public void SetSubtitleOffset(int offset)
    Parameters
    Type Name Description
    int offset

    The value indicating a desired offset in milliseconds.

    Remarks

    The player must be in the Playing or Paused state.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.InvalidOperationException

    The player is not in the valid state.
    -or-
    No subtitle is set.

    See Also
    SetSubtitle(string)
    View Source

    Start()

    Starts or resumes playback.

    Declaration
    public virtual void Start()
    Remarks

    The player must be in the Ready or Paused state. It has no effect if the player is already in the Playing state.

    Sound can be mixed with other sounds if you don't control the stream focus using ApplyAudioStreamPolicy(AudioStreamPolicy).

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.InvalidOperationException

    The player is not in the valid state.

    See Also
    PrepareAsync()
    Stop()
    Pause()
    PlaybackCompleted
    ApplyAudioStreamPolicy(AudioStreamPolicy)
    View Source

    Stop()

    Stops playing the media content.

    Declaration
    public virtual void Stop()
    Remarks

    The player must be in the Playing or Paused state. It has no effect if the player is already in the Ready state.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.InvalidOperationException

    The player is not in the valid state.

    See Also
    Start()
    Pause()
    View Source

    Unprepare()

    Unprepares the player.

    Declaration
    public virtual void Unprepare()
    Remarks

    The most recently used source is reset and is no longer associated with the player. Playback is no longer possible. If you want to use the player again, you have to set a source and call PrepareAsync() again.

    The player must be in the Ready, Playing, or Paused state. It has no effect if the player is already in the Idle state.

    Exceptions
    Type Condition
    System.ObjectDisposedException

    The player has already been disposed of.

    System.InvalidOperationException

    The player is not in the valid state.

    Events

    View Source

    BufferingProgressChanged

    Occurs when there is a change in the buffering status of streaming.

    Declaration
    public event EventHandler<BufferingProgressChangedEventArgs> BufferingProgressChanged
    Event Type
    Type Description
    System.EventHandler<TEventArgs><BufferingProgressChangedEventArgs>
    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    View Source

    ErrorOccurred

    Occurs when any error occurs.

    Declaration
    public event EventHandler<PlayerErrorOccurredEventArgs> ErrorOccurred
    Event Type
    Type Description
    System.EventHandler<TEventArgs><PlayerErrorOccurredEventArgs>
    Remarks

    The event handler will be executed on an internal thread.

    View Source

    PlaybackCompleted

    Occurs when the playback of a media is finished.

    Declaration
    public event EventHandler<EventArgs> PlaybackCompleted
    Event Type
    Type Description
    System.EventHandler<TEventArgs><System.EventArgs>
    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    View Source

    PlaybackInterrupted

    Occurs when the playback of a media is interrupted.

    Declaration
    public event EventHandler<PlaybackInterruptedEventArgs> PlaybackInterrupted
    Event Type
    Type Description
    System.EventHandler<TEventArgs><PlaybackInterruptedEventArgs>
    Remarks

    The player provides functions to play a media content. It also provides functions to adjust the configurations of the player such as playback rate, volume, looping etc. Note that only one video player can be played at one time.

    View Source

    SubtitleUpdated

    Occurs when the subtitle is updated.

    Declaration
    public event EventHandler<SubtitleUpdatedEventArgs> SubtitleUpdated
    Event Type
    Type Description
    System.EventHandler<TEventArgs><SubtitleUpdatedEventArgs>
    Remarks

    The event handler will be executed on an internal thread.

    View Source

    VideoFrameDecoded

    Occurs when a video frame is decoded.

    Declaration
    public event EventHandler<VideoFrameDecodedEventArgs> VideoFrameDecoded
    Event Type
    Type Description
    System.EventHandler<TEventArgs><VideoFrameDecodedEventArgs>
    Remarks

    The event handler will be executed on an internal thread.

    The Packet in event args should be disposed after use.

    Exceptions
    Type Condition
    System.NotSupportedException

    The required feature is not supported.

    See Also
    Packet
    View Source

    VideoStreamChanged

    Occurs when the video stream is changed.

    Declaration
    public event EventHandler<VideoStreamChangedEventArgs> VideoStreamChanged
    Event Type
    Type Description
    System.EventHandler<TEventArgs><VideoStreamChangedEventArgs>
    Remarks

    The event handler will be executed on an internal thread.

    Implements

    System.IDisposable
    • View Source
    Back to top Copyright © 2016-2024 Samsung
    Generated by DocFX