Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Get info returns Duration that is less then currentTime #134

Open
ahmad6242 opened this issue Oct 10, 2021 · 1 comment
Open

[BUG] Get info returns Duration that is less then currentTime #134

ahmad6242 opened this issue Oct 10, 2021 · 1 comment

Comments

@ahmad6242
Copy link

Describe the bug
I put the getInfo inside SetInterval to get current Time every Second.
it return me current time and duration.
The duration is wrong that is less than the currentTime
image

To Reproduce
Using

           setInterval(() => {
                this.getInfo()
            }, 1000);

async getInfo() { // You need the keyword `async`
        try {
            const info = await SoundPlayer.getInfo()
            this.setState({ audioPlayer: { ...this.state.audioPlayer, duration: (info.duration).toFixed(2), currentTime: (info.currentTime).toFixed(2) } })

        } catch (e) {
            console.log('There is no song playing', e)
        }
    }

Expected behavior
duration shoould be equal or bigger than the current time.

Platform (please complete the following information):
Tested on Android only.

@DeveloperInside
Copy link

I can't see which audio type you use, but I assume that it takes the current time and duration wrong depending on the file type. I'm recording voice using the mic and saving it as an AAC file. When I got the information, the duration was bigger than it should be. But when I play mp3 files, I can get the sound info correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants