react-h5-audio-player
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -185,7 +185,7 @@ "use strict"; | ||
_defineProperty(_assertThisInitialized(_this), "updateDisplayTime", function () { | ||
_defineProperty(_assertThisInitialized(_this), "updateDisplayTime", function (dragLeft) { | ||
var currentTime = _this.audio.currentTime; | ||
var duration = _this.audio.duration; | ||
var barWidth = _this.bar.offsetWidth - 20; | ||
var left = barWidth * currentTime / duration || 0; | ||
var left = dragLeft || barWidth * currentTime / duration || 0; | ||
@@ -269,3 +269,3 @@ _this.setState({ | ||
_this.updateDisplayTime(); | ||
_this.updateDisplayTime(dragLeft); | ||
} | ||
@@ -403,3 +403,3 @@ }); | ||
_this2.updateDisplayTime(); | ||
_this2.updateDisplayTime(dragLeft); | ||
@@ -418,4 +418,6 @@ _this2.props.onDragMove && _this2.props.onDragMove(e); | ||
_this2.updateDisplayTime(); | ||
audio.currentTime = audio.duration * dragLeft / (_this2.bar.offsetWidth - 20) || 0; | ||
_this2.updateDisplayTime(dragLeft); | ||
_this2.props.onDragMove && _this2.props.onDragMove(e); | ||
@@ -422,0 +424,0 @@ }); |
{ | ||
"name": "react-h5-audio-player", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "A React audio player with UI. Mobile compatible.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -286,3 +286,3 @@ import React, { Component } from 'react' | ||
audio.currentTime = (audio.duration * dragLeft) / (this.bar.offsetWidth - 20) || 0 | ||
this.updateDisplayTime() | ||
this.updateDisplayTime(dragLeft) | ||
this.props.onDragMove && this.props.onDragMove(e) | ||
@@ -298,3 +298,4 @@ } | ||
} | ||
this.updateDisplayTime() | ||
audio.currentTime = (audio.duration * dragLeft) / (this.bar.offsetWidth - 20) || 0 | ||
this.updateDisplayTime(dragLeft) | ||
this.props.onDragMove && this.props.onDragMove(e) | ||
@@ -334,7 +335,7 @@ }) | ||
updateDisplayTime = () => { | ||
updateDisplayTime = (dragLeft) => { | ||
const currentTime = this.audio.currentTime | ||
const duration = this.audio.duration | ||
const barWidth = this.bar.offsetWidth - 20 | ||
const left = (barWidth * currentTime) / duration || 0 | ||
const left = dragLeft || (barWidth * currentTime) / duration || 0 | ||
this.setState({ | ||
@@ -401,3 +402,3 @@ currentTime, | ||
audio.currentTime = (audio.duration * dragLeft) / (bar.offsetWidth - 20) || 0 | ||
this.updateDisplayTime() | ||
this.updateDisplayTime(dragLeft) | ||
} | ||
@@ -404,0 +405,0 @@ } |
45901
1143