Fix wrong seek bar width on media player (#15060)

This commit is contained in:
fuyu 2020-10-30 21:09:20 +09:00 committed by GitHub
parent d56e14a9cb
commit 8d7fbe7dd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -246,7 +246,7 @@ class Audio extends React.PureComponent {
handleTimeUpdate = () => { handleTimeUpdate = () => {
this.setState({ this.setState({
currentTime: this.audio.currentTime, currentTime: this.audio.currentTime,
duration: Math.floor(this.audio.duration), duration: this.audio.duration,
}); });
} }
@ -454,7 +454,7 @@ class Audio extends React.PureComponent {
<span className='video-player__time'> <span className='video-player__time'>
<span className='video-player__time-current'>{formatTime(Math.floor(currentTime))}</span> <span className='video-player__time-current'>{formatTime(Math.floor(currentTime))}</span>
<span className='video-player__time-sep'>/</span> <span className='video-player__time-sep'>/</span>
<span className='video-player__time-total'>{formatTime(this.state.duration || Math.floor(this.props.duration))}</span> <span className='video-player__time-total'>{formatTime(Math.floor(this.state.duration || this.props.duration))}</span>
</span> </span>
</div> </div>

View File

@ -198,7 +198,7 @@ class Video extends React.PureComponent {
handleTimeUpdate = () => { handleTimeUpdate = () => {
this.setState({ this.setState({
currentTime: this.video.currentTime, currentTime: this.video.currentTime,
duration: Math.floor(this.video.duration), duration:this.video.duration,
}); });
} }
@ -551,7 +551,7 @@ class Video extends React.PureComponent {
<span className='video-player__time'> <span className='video-player__time'>
<span className='video-player__time-current'>{formatTime(Math.floor(currentTime))}</span> <span className='video-player__time-current'>{formatTime(Math.floor(currentTime))}</span>
<span className='video-player__time-sep'>/</span> <span className='video-player__time-sep'>/</span>
<span className='video-player__time-total'>{formatTime(duration)}</span> <span className='video-player__time-total'>{formatTime(Math.floor(duration))}</span>
</span> </span>
)} )}