Class Player
Definition
- Namespace:
- Tizen.Multimedia
- Assembly:
- Tizen.Multimedia.MediaPlayer.dll
Provides the ability to control media playback.
public class Player : IDisposable
- Inheritance
-
objectPlayer
- 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 SourcePlayer()
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 SourceAudioEffect
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. |
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. |
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.
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. |
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. |
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.
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. |
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. |
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. |
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. |
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.
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.
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. |
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 |
|
Methods
View SourceApplyAudioStreamPolicy(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. |
| System.InvalidOperationException | The player is not in the valid state. |
| System.ArgumentNullException |
|
| System.NotSupportedException | The required feature is not supported. |
See Also
View SourceCaptureVideoAsync()
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
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. |
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. |
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.
GetDownloadProgress()
Gets the streaming download progress.
Declaration
public DownloadProgress GetDownloadProgress()
Returns
| Type | Description |
|---|---|
| DownloadProgress | The DownloadProgress containing current download progress. |
Remarks
Exceptions
| Type | Condition |
|---|---|
| System.InvalidOperationException | The player is not streaming. |
| System.ObjectDisposedException | The player has already been disposed of. |
GetPlayPosition()
Gets the play position in milliseconds.
Declaration
public int GetPlayPosition()
Returns
| Type | Description |
|---|---|
| int |
Remarks
Exceptions
| Type | Condition |
|---|---|
| System.ObjectDisposedException | The player has already been disposed of. |
| System.InvalidOperationException | The player is not in the valid state. |
See Also
View SourceOnPreparing()
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.
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
View SourcePause()
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
View SourcePrepareAsync()
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. |
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. |
| System.ArgumentOutOfRangeException |
|
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
View SourceSetSource(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. |
See Also
View SourceSetSubtitle(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 |
|
| System.IO.FileNotFoundException | The specified path does not exist. |
| System.ArgumentNullException |
|
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
Exceptions
| Type | Condition |
|---|---|
| System.ObjectDisposedException | The player has already been disposed of. |
| System.InvalidOperationException | The player is not in the valid state. |
See Also
View SourceStart()
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
View SourceStop()
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
View SourceUnprepare()
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 SourceBufferingProgressChanged
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.
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.
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.
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.
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.
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
View SourceVideoStreamChanged
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.