| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/currentTime | [Back] [Original] |
Get to know MDN better
This feature is well established and works across many devices and browser versions. Its been available across browsers since July 2015.
The HTMLMediaElement interface's
currentTime property specifies the current playback time
in seconds.
Changing the value of currentTime seeks the media to
the new time.
A double-precision floating-point value indicating the current playback time in seconds.
If the media is not yet playing, the value of currentTime indicates the
time position within the media at which playback will begin once the
play() method is called.
Setting currentTime to a new value seeks the media to the given time, if
the media is available.
For media without a known durationsuch as media being streamed liveit's possible that the browser may not be able to obtain parts of the media that have expired from the media buffer. Also, media whose timeline doesn't begin at 0 seconds cannot be seeked to a time before its timeline's earliest time.
The length of the media in seconds can be determined using the
duration property.
const video = document.createElement("video");
console.log(video.currentTime);
The browser does not apply timer rounding to currentTime, including values supplied by script. Seeking can still adjust the resulting playback position to a position supported by the media.
The value of currentTime is an approximation of the current playback position. The browser updates this value as playback progresses. The HTML specification requires the reported playback position to remain stable while scripts are running.
The update frequency depends on the browser and media playback pipeline. As a result, successive reads can return the same currentTime even when Date.now() has advanced. The number of decimal places in the value does not indicate how often it updates or how accurately it matches the audio or video being presented.
For example, successive readings during playback might produce these values:
video.currentTime;
// Might be:
// 23.404
// 23.404
// 23.452
//
| Specification |
|---|
| HTML # dom-media-currenttime-dev |
HTMLMediaElement: Interface used to define the HTMLMediaElement.currentTime propertyHTMLMediaElement.fastSeek(): Another way to set the timeHTMLMediaElement.duration: The duration of the media in secondsThis page was last modified on Sep 1, 2026 by MDN contributors.
HTMLMediaElementaudioTracksautoplaybufferedcontrollercontrolscontrolsListcrossOrigincurrentSrccurrentTimedefaultMuteddefaultPlaybackRatedisableRemotePlaybackdurationendederrorloadingloopmediaGroupmediaKeysmutednetworkStatepausedplaybackRateplayedpreloadpreservesPitchreadyStateremoteseekableseekingsinkIdsrcsrcObjecttextTracksvideoTracksvolumeBeforeUnloadEventDOMStringMapErrorEventHTMLAnchorElementHTMLAreaElementHTMLAudioElementHTMLBRElementHTMLBaseElementHTMLBodyElementHTMLButtonElementHTMLCanvasElementHTMLDListElementHTMLDataElementHTMLDataListElementHTMLDialogElementHTMLDivElementHTMLDocumentHTMLElementHTMLEmbedElementHTMLFieldSetElementHTMLFormControlsCollectionHTMLFormElementHTMLFrameSetElementHTMLGeolocationElementHTMLHRElementHTMLHeadElementHTMLHeadingElementHTMLHtmlElementHTMLIFrameElementHTMLImageElementHTMLInputElementHTMLLIElementHTMLLabelElementHTMLLegendElementHTMLLinkElementHTMLMapElementHTMLMenuElementHTMLMetaElementHTMLMeterElementHTMLModElementHTMLOListElementHTMLObjectElementHTMLOptGroupElementHTMLOptionElementHTMLOptionsCollectionHTMLOutputElementHTMLParagraphElementHTMLPictureElementHTMLPreElementHTMLProgressElementHTMLQuoteElementHTMLScriptElementHTMLSelectElementHTMLSourceElementHTMLSpanElementHTMLStyleElementHTMLTableCaptionElementHTMLTableCellElementHTMLTableColElementHTMLTableElementHTMLTableRowElementHTMLTableSectionElementHTMLTemplateElementHTMLTextAreaElementHTMLTimeElementHTMLTitleElementHTMLTrackElementHTMLUListElementHTMLUnknownElementHTMLVideoElementHashChangeEventHistoryImageDataLocationMessageChannelMessageEventMessagePortNavigatorPageRevealEventPageSwapEventPageTransitionEventPluginPluginArrayPromiseRejectionEventRadioNodeListTimeRangesUserActivationValidityStateWindowWorkletGlobalScopeYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |