hyochan / react-native-audio-recorder-player

react-native native module for audio recorder and player.
MIT License
719 stars 215 forks source link

Method mmss returns incorrect values #633

Open Alex-Vasilev opened 1 month ago

Alex-Vasilev commented 1 month ago

Please fill the template to help you out. Also, please try the Example project compare before submiting the issue when you have certain issue with your project setup.

Version of react-native-audio-recorder-player 3.6.10

Version of React Native 0.75.2

Platforms you faced the error (IOS or Android or both?) IOS (Android - ?)

Expected behavior eg 00:01, 00:02, 00:03 ....

Actual behavior 00:12, 35:24, 23:46...

Steps to reproduce the behabior use of the method

camilossantos2809 commented 1 week ago

I'm having the same problem. Using the code available in the docs to start playing and using the mmss function reproduces the behavior:

onStartPlay = async () => {
  console.log('onStartPlay');
  const msg = await this.audioRecorderPlayer.startPlayer();
  console.log(msg);
  this.audioRecorderPlayer.addPlayBackListener((e) => {
    this.setState({
      currentPositionSec: e.currentPosition,
      currentDurationSec: e.duration,
      playTime: this.audioRecorderPlayer.mmss(Math.floor(e.currentPosition)),
      duration: this.audioRecorderPlayer.mmss(Math.floor(e.duration)),
    });
    return;
  });
};