Class Player
Definition
- Namespace:
- Tizen.Multimedia
- Assembly:
- Tizen.Multimedia.MediaPlayer.dll
Provides the ability to control media playback.
C#Copypublic 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
Declaration
C#Copypublic 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
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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.
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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.
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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.
Declaration
C#Copypublic 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.
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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
Declaration
C#Copypublic 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
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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.
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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
Declaration
C#Copyprotected 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.
Declaration
C#Copyprotected 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
Declaration
C#Copypublic 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
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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 |
|
Declaration
C#Copypublic 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
Declaration
C#Copypublic 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
Declaration
C#Copypublic 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 |
|
Declaration
C#Copypublic 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
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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. |
Declaration
C#Copypublic 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
BufferingProgressChanged
Occurs when there is a change in the buffering status of streaming.
Declaration
C#Copypublic 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.
Declaration
C#Copypublic event EventHandler<PlayerErrorOccurredEventArgs> ErrorOccurred
Event Type
| Type | Description |
|---|---|
| System.EventHandler<TEventArgs><PlayerErrorOccurredEventArgs> |
Remarks
The event handler will be executed on an internal thread.
Declaration
C#Copypublic 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.
Declaration
C#Copypublic 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.
Declaration
C#Copypublic event EventHandler<SubtitleUpdatedEventArgs> SubtitleUpdated
Event Type
| Type | Description |
|---|---|
| System.EventHandler<TEventArgs><SubtitleUpdatedEventArgs> |
Remarks
The event handler will be executed on an internal thread.
Declaration
C#Copypublic 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
Declaration
C#Copypublic event EventHandler<VideoStreamChangedEventArgs> VideoStreamChanged
Event Type
| Type | Description |
|---|---|
| System.EventHandler<TEventArgs><VideoStreamChangedEventArgs> |
Remarks
The event handler will be executed on an internal thread.