src/index.js
function onTimeChange() {
		if (currentTime !== media.currentTime || duration !== media.duration) {
			currentTime = media.currentTime;
			duration = media.duration || 0;

			const currentTimePercentage = currentTime / duration;
			const currentTimeCode = timeToTimecode(currentTime);
			const remainingTimeCode = timeToTimecode(duration - Math.floor(currentTime));

			if (currentTimeCode !== self.currentTimeText.nodeValue) {
				self.currentTimeText.nodeValue = currentTimeCode;

				$(self.currentTime, { title: `${timeToAural(currentTime, lang.minutes || 'minutes', lang.seconds || 'seconds')}` });
			}

			if (remainingTimeCode !== self.remainingTimeText.nodeValue) {
				self.remainingTimeText.nodeValue = remainingTimeCode;

				$(self.remainingTime, { title: `${timeToAural(duration - currentTime, lang.minutes || 'minutes', lang.seconds || 'seconds')}` });
			}

			$(self.time, { 'aria-valuenow': currentTime, 'aria-valuemin': 0, 'aria-valuemax': duration });

			const dirIsInline = /^(ltr|rtl)$/i.test(timeDir);
			const axisProp = dirIsInline ? 'width' : 'height';

			self.timeMeter.style[axisProp] = `${currentTimePercentage * 100}%`;

			// dispatch new "timechange" event
			dispatchCustomEvent(media, 'timechange');
		}
	}
function onTimeChange() {
		if (currentTime !== media.currentTime || duration !== media.duration) {
			currentTime = media.currentTime;
			duration = media.duration || 0;

			const currentTimePercentage = currentTime / duration;
			const currentTimeCode = timeToTimecode(currentTime);
			const remainingTimeCode = timeToTimecode(duration - Math.floor(currentTime));

			if (currentTimeCode !== self.currentTimeText.nodeValue) {
				self.currentTimeText.nodeValue = currentTimeCode;

				$(self.currentTime, { title: `${timeToAural(currentTime, lang.minutes || 'minutes', lang.seconds || 'seconds')}` });
			}

			if (remainingTimeCode !== self.remainingTimeText.nodeValue) {
				self.remainingTimeText.nodeValue = remainingTimeCode;

				$(self.remainingTime, { title: `${timeToAural(duration - currentTime, lang.minutes || 'minutes', lang.seconds || 'seconds')}` });
			}

			$(self.time, { 'aria-valuenow': currentTime, 'aria-valuemin': 0, 'aria-valuemax': duration });

			const dirIsInline = /^(ltr|rtl)$/i.test(timeDir);
			const axisProp = dirIsInline ? 'width' : 'height';

			self.timeMeter.style[axisProp] = `${currentTimePercentage * 100}%`;

			// dispatch new "timechange" event
			dispatchCustomEvent(media, 'timechange');
		}
	}
function onTimeChange ( ) { if ( currentTime !== media . currentTime || duration !== media . duration ) { currentTime = media . currentTime ; duration = media . duration || 0 ; const currentTimePercentage = currentTime / duration ; const currentTimeCode = timeToTimecode ( currentTime ) ; const remainingTimeCode = timeToTimecode ( duration - Math . floor ( currentTime ) ) ; if ( currentTimeCode !== self . currentTimeText . nodeValue ) { self . currentTimeText . nodeValue = currentTimeCode ; $ ( self . currentTime , { title : ` ${ timeToAural ( currentTime , lang . minutes || 'minutes' , lang . seconds || 'seconds' ) } ` } ) ; } if ( remainingTimeCode !== self . remainingTimeText . nodeValue ) { self . remainingTimeText . nodeValue = remainingTimeCode ; $ ( self . remainingTime , { title : ` ${ timeToAural ( duration - currentTime , lang . minutes || 'minutes' , lang . seconds || 'seconds' ) } ` } ) ; } $ ( self . time , { 'aria-valuenow' : currentTime , 'aria-valuemin' : 0 , 'aria-valuemax' : duration } ) ; const dirIsInline = / ^(ltr|rtl)$ / i . test ( timeDir ) ; const axisProp = dirIsInline ? 'width' : 'height' ; self . timeMeter . style [ axisProp ] = ` ${ currentTimePercentage * 100 } ` ; // dispatch new "timechange" event dispatchCustomEvent ( media , 'timechange' ) ; } }
when the time changes
when the time changes