frontend treat 85% of duration as finished
This commit is contained in:
@@ -32,6 +32,10 @@ function AudioPlayer(props) {
|
|||||||
const endPlayTime = new Date()
|
const endPlayTime = new Date()
|
||||||
let duration = parseInt((endPlayTime - beginPlayTime) / 1000)
|
let duration = parseInt((endPlayTime - beginPlayTime) / 1000)
|
||||||
const maxDuration = parseInt(player.duration)
|
const maxDuration = parseInt(player.duration)
|
||||||
|
// treat 85% of duration as finished
|
||||||
|
if (duration / maxDuration >= 0.85) {
|
||||||
|
method = 1
|
||||||
|
}
|
||||||
duration = duration < maxDuration ? duration : maxDuration
|
duration = duration < maxDuration ? duration : maxDuration
|
||||||
setBeginPlayTime(endPlayTime)
|
setBeginPlayTime(endPlayTime)
|
||||||
await fetch('/api/v1/record_playback', {
|
await fetch('/api/v1/record_playback', {
|
||||||
@@ -106,9 +110,9 @@ function AudioPlayer(props) {
|
|||||||
});
|
});
|
||||||
// no playing file
|
// no playing file
|
||||||
if (props.playingFile.id === undefined) {
|
if (props.playingFile.id === undefined) {
|
||||||
setPlayingURL("");
|
|
||||||
// 3 music stopped
|
// 3 music stopped
|
||||||
recordPlaybackHistory(lastID, 3)
|
recordPlaybackHistory(lastID, 3)
|
||||||
|
setPlayingURL("");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// crrently playing file, record interupt
|
// crrently playing file, record interupt
|
||||||
|
|||||||
Reference in New Issue
Block a user