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

fix: check that sounds are loaded in seek (returning current position) #1423

Merged

Conversation

rigobauer
Copy link
Contributor

@rigobauer rigobauer commented Nov 10, 2020

If sounds are not loaded and calls .seek() you get this error:

Cannot read property '_id' of undefined

@jzstern
Copy link

jzstern commented Dec 28, 2020

It also appears the play event is being triggered before the song is loaded. What's the recommended way for determining progress and continually updating it?

track.on("play", () => {
    const duration = track.duration()

    setProgressUpdater(setInterval(() => {
        try {
            let elapsed = track.seek()
            let progress = elapsed / duration
            setTimeElapsed(elapsed)
            setProgress(progress.toFixed(4))
        } catch (e) {
            // TODO - fix this
            console.error(e)
        }
    }, 200))
})
})

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

Successfully merging this pull request may close these issues.

3 participants