MediaPlayer.SetDataSource Method

Definition

Overloads

SetDataSource(AssetFileDescriptor)
SetDataSource(MediaDataSource)
SetDataSource(FileDescriptor)

Sets the data source (FileDescriptor) to use.

SetDataSource(String)

Sets the data source (file-path or http/rtsp URL) to use.

SetDataSource(Context, Uri)

Sets the data source as a content Uri.

SetDataSource(Context, Uri, IDictionary<String,String>)
SetDataSource(FileDescriptor, Int64, Int64)

Sets the data source (FileDescriptor) to use.

SetDataSource(Context, Uri, IDictionary<String,String>, IList<HttpCookie>)

SetDataSource(AssetFileDescriptor)

[Android.Runtime.Register("setDataSource", "(Landroid/content/res/AssetFileDescriptor;)V", "GetSetDataSource_Landroid_content_res_AssetFileDescriptor_Handler", ApiSince=24)]
public virtual void SetDataSource (Android.Content.Res.AssetFileDescriptor afd);
abstract member SetDataSource : Android.Content.Res.AssetFileDescriptor -> unit
override this.SetDataSource : Android.Content.Res.AssetFileDescriptor -> unit

Parameters

Attributes

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

SetDataSource(MediaDataSource)

[Android.Runtime.Register("setDataSource", "(Landroid/media/MediaDataSource;)V", "GetSetDataSource_Landroid_media_MediaDataSource_Handler", ApiSince=23)]
public virtual void SetDataSource (Android.Media.MediaDataSource dataSource);
abstract member SetDataSource : Android.Media.MediaDataSource -> unit
override this.SetDataSource : Android.Media.MediaDataSource -> unit

Parameters

dataSource
MediaDataSource
Attributes

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

SetDataSource(FileDescriptor)

Sets the data source (FileDescriptor) to use.

[Android.Runtime.Register("setDataSource", "(Ljava/io/FileDescriptor;)V", "GetSetDataSource_Ljava_io_FileDescriptor_Handler")]
public virtual void SetDataSource (Java.IO.FileDescriptor fd);
abstract member SetDataSource : Java.IO.FileDescriptor -> unit
override this.SetDataSource : Java.IO.FileDescriptor -> unit

Parameters

fd
FileDescriptor

the FileDescriptor for the file you want to play

Attributes

Exceptions

if it is called in an invalid state

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

SetDataSource(String)

Sets the data source (file-path or http/rtsp URL) to use.

[Android.Runtime.Register("setDataSource", "(Ljava/lang/String;)V", "GetSetDataSource_Ljava_lang_String_Handler")]
public virtual void SetDataSource (string path);
abstract member SetDataSource : string -> unit
override this.SetDataSource : string -> unit

Parameters

path
String

the path of the file, or the http/rtsp URL of the stream you want to play

Attributes

Exceptions

if it is called in an invalid state

When path refers to a local file, the file may actually be opened by a process other than the calling application. This implies that the pathname should be an absolute path (as any other process runs with unspecified current working directory), and that the pathname should reference a world-readable file. As an alternative, the application could first open the file for reading, and then use the file descriptor form SetDataSource(FileDescriptor).

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

SetDataSource(Context, Uri)

Sets the data source as a content Uri.

[Android.Runtime.Register("setDataSource", "(Landroid/content/Context;Landroid/net/Uri;)V", "GetSetDataSource_Landroid_content_Context_Landroid_net_Uri_Handler")]
public virtual void SetDataSource (Android.Content.Context context, Android.Net.Uri uri);
abstract member SetDataSource : Android.Content.Context * Android.Net.Uri -> unit
override this.SetDataSource : Android.Content.Context * Android.Net.Uri -> unit

Parameters

context
Context

the Context to use when resolving the Uri

uri
Uri

the Content URI of the data you want to play

Attributes

Exceptions

if it is called in an invalid state

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

SetDataSource(Context, Uri, IDictionary<String,String>)

[Android.Runtime.Register("setDataSource", "(Landroid/content/Context;Landroid/net/Uri;Ljava/util/Map;)V", "GetSetDataSource_Landroid_content_Context_Landroid_net_Uri_Ljava_util_Map_Handler", ApiSince=14)]
public virtual void SetDataSource (Android.Content.Context context, Android.Net.Uri uri, System.Collections.Generic.IDictionary<string,string> headers);
abstract member SetDataSource : Android.Content.Context * Android.Net.Uri * System.Collections.Generic.IDictionary<string, string> -> unit
override this.SetDataSource : Android.Content.Context * Android.Net.Uri * System.Collections.Generic.IDictionary<string, string> -> unit

Parameters

context
Context
uri
Uri
Attributes

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

SetDataSource(FileDescriptor, Int64, Int64)

Sets the data source (FileDescriptor) to use.

[Android.Runtime.Register("setDataSource", "(Ljava/io/FileDescriptor;JJ)V", "GetSetDataSource_Ljava_io_FileDescriptor_JJHandler")]
public virtual void SetDataSource (Java.IO.FileDescriptor fd, long offset, long length);
abstract member SetDataSource : Java.IO.FileDescriptor * int64 * int64 -> unit
override this.SetDataSource : Java.IO.FileDescriptor * int64 * int64 -> unit

Parameters

fd
FileDescriptor

the FileDescriptor for the file you want to play

offset
Int64

the offset into the file where the data to be played starts, in bytes

length
Int64

the length in bytes of the data to be played

Attributes

Exceptions

if it is called in an invalid state

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

SetDataSource(Context, Uri, IDictionary<String,String>, IList<HttpCookie>)

[Android.Runtime.Register("setDataSource", "(Landroid/content/Context;Landroid/net/Uri;Ljava/util/Map;Ljava/util/List;)V", "GetSetDataSource_Landroid_content_Context_Landroid_net_Uri_Ljava_util_Map_Ljava_util_List_Handler", ApiSince=26)]
public virtual void SetDataSource (Android.Content.Context context, Android.Net.Uri uri, System.Collections.Generic.IDictionary<string,string> headers, System.Collections.Generic.IList<Java.Net.HttpCookie> cookies);
abstract member SetDataSource : Android.Content.Context * Android.Net.Uri * System.Collections.Generic.IDictionary<string, string> * System.Collections.Generic.IList<Java.Net.HttpCookie> -> unit
override this.SetDataSource : Android.Content.Context * Android.Net.Uri * System.Collections.Generic.IDictionary<string, string> * System.Collections.Generic.IList<Java.Net.HttpCookie> -> unit

Parameters

context
Context
uri
Uri
cookies
IList<HttpCookie>
Attributes

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to