Dela via


MediaPlayer.Timestamp Property

Definition

Get current playback position as a MediaTimestamp.

public virtual Android.Media.MediaTimestamp? Timestamp { [Android.Runtime.Register("getTimestamp", "()Landroid/media/MediaTimestamp;", "GetGetTimestampHandler", ApiSince=23)] get; }
[<get: Android.Runtime.Register("getTimestamp", "()Landroid/media/MediaTimestamp;", "GetGetTimestampHandler", ApiSince=23)>]
member this.Timestamp : Android.Media.MediaTimestamp

Property Value

a MediaTimestamp object if a timestamp is available, or null if no timestamp is available, e.g. because the media player has not been initialized.

Attributes

Remarks

Get current playback position as a MediaTimestamp.

The MediaTimestamp represents how the media time correlates to the system time in a linear fashion using an anchor and a clock rate. During regular playback, the media time moves fairly constantly (though the anchor frame may be rebased to a current system time, the linear correlation stays steady). Therefore, this method does not need to be called often.

To help users get current playback position, this method always anchors the timestamp to the current System#nanoTime system time, so MediaTimestamp#getAnchorMediaTimeUs can be used as current playback position.

Java documentation for android.media.MediaPlayer.getTimestamp().

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