MediaPlayer.SeekTo Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
SeekTo(Int32) |
Seeks to specified time position. |
SeekTo(Int64, MediaPlayerSeekMode) |
Moves the media to specified time position by considering the given mode. |
SeekTo(Int32)
Seeks to specified time position.
[Android.Runtime.Register("seekTo", "(I)V", "GetSeekTo_IHandler")]
public virtual void SeekTo (int msec);
[<Android.Runtime.Register("seekTo", "(I)V", "GetSeekTo_IHandler")>]
abstract member SeekTo : int -> unit
override this.SeekTo : int -> unit
Parameters
- msec
- Int32
the offset in milliseconds from the start to seek to
- Attributes
Exceptions
if the internal player engine has not been initialized
Remarks
Seeks to specified time position. Same as #seekTo(long, int)
with mode = SEEK_PREVIOUS_SYNC
.
Java documentation for android.media.MediaPlayer.seekTo(int)
.
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
SeekTo(Int64, MediaPlayerSeekMode)
Moves the media to specified time position by considering the given mode.
[Android.Runtime.Register("seekTo", "(JI)V", "GetSeekTo_JIHandler", ApiSince=26)]
public virtual void SeekTo (long msec, Android.Media.MediaPlayerSeekMode mode);
[<Android.Runtime.Register("seekTo", "(JI)V", "GetSeekTo_JIHandler", ApiSince=26)>]
abstract member SeekTo : int64 * Android.Media.MediaPlayerSeekMode -> unit
override this.SeekTo : int64 * Android.Media.MediaPlayerSeekMode -> unit
Parameters
- msec
- Int64
the offset in milliseconds from the start to seek to. When seeking to the given time position, there is no guarantee that the data source has a frame located at the position. When this happens, a frame nearby will be rendered. If msec is negative, time position zero will be used. If msec is larger than duration, duration will be used.
- mode
- MediaPlayerSeekMode
the mode indicating where exactly to seek to.
Use #SEEK_PREVIOUS_SYNC
if one wants to seek to a sync frame
that has a timestamp earlier than or the same as msec. Use
#SEEK_NEXT_SYNC
if one wants to seek to a sync frame
that has a timestamp later than or the same as msec. Use
#SEEK_CLOSEST_SYNC
if one wants to seek to a sync frame
that has a timestamp closest to or the same as msec. Use
#SEEK_CLOSEST
if one wants to seek to a frame that may
or may not be a sync frame but is closest to or the same as msec.
#SEEK_CLOSEST
often has larger performance overhead compared
to the other options if there is no sync frame located at msec.
- Attributes
Remarks
Moves the media to specified time position by considering the given mode.
When seekTo is finished, the user will be notified via OnSeekComplete supplied by the user. There is at most one active seekTo processed at any time. If there is a to-be-completed seekTo, new seekTo requests will be queued in such a way that only the last request is kept. When current seekTo is completed, the queued request will be processed if that request is different from just-finished seekTo operation, i.e., the requested position or mode is different.
Java documentation for android.media.MediaPlayer.seekTo(long, int)
.
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.