Class MediaPlayer
MediaPlayer provieds the essential components to play the media contents.
Inheritance
Implements
Inherited Members
Namespace: Tizen.Theme.Common
Assembly: Tizen.Theme.Common.dll
Syntax
public class MediaPlayer : Element, INotifyPropertyChanged, IDynamicResourceHandler, IElement, INameScope, IElementController, IStyleSelectable
Constructors
MediaPlayer()
Initializes a new instance of the MediaPlayer class.
Declaration
public MediaPlayer()
Fields
AspectModeProperty
Identifies the AspectMode bindable property.
Declaration
public static readonly BindableProperty AspectModeProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
AutoPlayProperty
Identifies the AutoPlay bindable property.
Declaration
public static readonly BindableProperty AutoPlayProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
AutoStopProperty
Identifies the AutoStop bindable property.
Declaration
public static readonly BindableProperty AutoStopProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
BufferingProgressProperty
Identifies the BufferingProgress bindable property.
Declaration
public static readonly BindableProperty BufferingProgressProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
DurationProperty
Identifies the Duration bindable property.
Declaration
public static readonly BindableProperty DurationProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
IsBufferingProperty
Identifies the IsBuffering bindable property.
Declaration
public static readonly BindableProperty IsBufferingProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
IsLoopingProperty
Identifies the IsLooping bindable property.
Declaration
public static readonly BindableProperty IsLoopingProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
IsMutedProperty
Identifies the IsMuted bindable property.
Declaration
public static readonly BindableProperty IsMutedProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
PositionProperty
Identifies the Position bindable property.
Declaration
public static readonly BindableProperty PositionProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
PositionUpdateIntervalProperty
Identifies the PositionUpdateInterval bindable property.
Declaration
public static readonly BindableProperty PositionUpdateIntervalProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
SourceProperty
Identifies the Source bindable property.
Declaration
public static readonly BindableProperty SourceProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
StateProperty
Identifies the State bindable property.
Declaration
public static readonly BindableProperty StateProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
UsesEmbeddingControlsProperty
Identifies the UsesEmbeddingControls bindable property.
Declaration
public static readonly BindableProperty UsesEmbeddingControlsProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
VideoOutputProperty
Identifies the VideoOutput bindable property.
Declaration
public static readonly BindableProperty VideoOutputProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
VolumeProperty
Identifies the Volume bindable property.
Declaration
public static readonly BindableProperty VolumeProperty
Field Value
Type | Description |
---|---|
Xamarin.Forms.BindableProperty |
Properties
AspectMode
Gets or sets the scaling mode for the media content.
Declaration
public DisplayAspectMode AspectMode { get; set; }
Property Value
Type | Description |
---|---|
DisplayAspectMode |
AutoPlay
Gets or sets a value whether the media content plays automatically.
Declaration
public bool AutoPlay { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
AutoStop
Gets or sets a value whether the media content stops automatically.
Declaration
public bool AutoStop { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
BufferingProgress
Gets the value indicating the buffering percentage.
Declaration
public double BufferingProgress { get; }
Property Value
Type | Description |
---|---|
System.Double |
Duration
Gets the duration of a media content.
Declaration
public int Duration { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsBuffering
Gets a value indicating the buffering status.
Declaration
public bool IsBuffering { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsLooping
Gets or sets the value whether the volume is looping or not.
Declaration
public bool IsLooping { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsMuted
Gets or sets the value whether the volume is muted.
Declaration
public bool IsMuted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Position
Gets the value of the current position of the media content.
Declaration
public int Position { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
PositionUpdateInterval
Gets or sets the desired interval time for updating position.
Declaration
public int PositionUpdateInterval { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Source
Gets or sets the source of the media content.
Declaration
[TypeConverter(typeof(MediaSourceConverter))]
public MediaSource Source { get; set; }
Property Value
Type | Description |
---|---|
MediaSource |
Remarks
The "http://developer.samsung.com/privilege/drmplay" privilege is required in case of DRMMediaSource.
State
Gets the current playback state.
Declaration
public PlaybackState State { get; }
Property Value
Type | Description |
---|---|
PlaybackState |
UsesEmbeddingControls
Gets or sets whether to use the embedding controls.
Declaration
public bool UsesEmbeddingControls { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
VideoOutput
Gets or sets the video output.
Declaration
public IVideoOutput VideoOutput { get; set; }
Property Value
Type | Description |
---|---|
IVideoOutput |
Volume
Gets or sets the current volume of a media content.
Declaration
public double Volume { get; set; }
Property Value
Type | Description |
---|---|
System.Double |
Methods
CreateMediaPlayerImpl()
Declaration
protected virtual IPlatformMediaPlayer CreateMediaPlayerImpl()
Returns
Type | Description |
---|---|
IPlatformMediaPlayer |
GetAlbumArts()
Retrieves the album art of the stream, or null if there is no album art data.
Declaration
public Task<Stream> GetAlbumArts()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.IO.Stream> | Returns a Task that gets the album art of the stream |
GetMetadata()
Gets the metadata of the media content.
Declaration
public Task<IDictionary<string, string>> GetMetadata()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Collections.Generic.IDictionary<System.String, System.String>> | Returns a Task that has the metadata of the media content. |
Pause()
Pauses the player.
Declaration
public void Pause()
Seek(Int32)
Attemps to seek the playback position.
Declaration
public Task<int> Seek(int ms)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | ms | The milliseconds to seek |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | Returns a Task that seeks the play position. |
Start()
Starts or resumes playback.
Declaration
public Task<bool> Start()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | Returns a Task that prepares the player and play the media content. |
Remarks
The "http://developer.samsung.com/privilege/drmplay" privilege is required if you want to start DRM-pretected content playback.
Stop()
Stops playing the media content.
Declaration
public void Stop()
Events
BufferingCompleted
Occurs when the buffering for the media content is completed.
Declaration
public event EventHandler BufferingCompleted
Event Type
Type | Description |
---|---|
System.EventHandler |
BufferingStarted
Occurs when the buffering for the media content is started.
Declaration
public event EventHandler BufferingStarted
Event Type
Type | Description |
---|---|
System.EventHandler |
PlaybackCompleted
Occurs when the playback is completed.
Declaration
public event EventHandler PlaybackCompleted
Event Type
Type | Description |
---|---|
System.EventHandler |
PlaybackPaused
Occurs when the playback is paused.
Declaration
public event EventHandler PlaybackPaused
Event Type
Type | Description |
---|---|
System.EventHandler |
PlaybackStarted
Occurs when the playback is started.
Declaration
public event EventHandler PlaybackStarted
Event Type
Type | Description |
---|---|
System.EventHandler |
PlaybackStopped
Occurs when the playback is stopped.
Declaration
public event EventHandler PlaybackStopped
Event Type
Type | Description |
---|---|
System.EventHandler |