Skip to content

Commit 2808a8f

Browse files
authored
Prevent getCurrentTime() from returning 0 at the end of the audio track playback (#2452)
* Fix AudioEngineImpl::getCurrentTime() returning 0 at the end of the sound track playback * Ensure streaming audio source current time works as well
1 parent 258ceca commit 2808a8f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/audio/AudioEngineImpl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,11 @@ float AudioEngineImpl::getCurrentTime(AUDIO_ID audioID)
830830
AXLOGE("{}, audio id:{},error code:{:#x}", __FUNCTION__, audioID, error);
831831
}
832832
}
833+
834+
if (ret == 0.0f && player->isFinished())
835+
{
836+
ret = player->_audioCache->_duration;
837+
}
833838
}
834839

835840
return ret;

0 commit comments

Comments
 (0)