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

AudioState.COMPLETE is never used in primitive code #628

Open
Vexcited opened this issue May 11, 2024 · 0 comments
Open

AudioState.COMPLETE is never used in primitive code #628

Vexcited opened this issue May 11, 2024 · 0 comments

Comments

@Vexcited
Copy link

Describe the bug

Hi ! I wrote this code earlier and found out it was never triggering :

const [audio, controls] = createAudio(track, () => state.playing, () => state.volume);

createEffect(() => {
  console.log(audio.state); // just for debug :')

  if (audio.state === AudioState.COMPLETE) { // this is never triggered !!
    const trackID = findSuitableTrack();
    console.info(`Playing track ${trackID} next.`);

    setState(prev => ({
      history: [...prev.history, prev.currentTrackID],
      currentTrackID: trackID
    }));
  }
});

When I looked through the enum, I thought that AudioState.COMPLETE would be perfect for my situation.
Even though, it doesn't work, so I went through the primitive code to see what is happening under the hood.

In the whole file (https://github.com/solidjs-community/solid-primitives/blob/main/packages/audio/src/index.ts), AudioState.COMPLETE is NEVER used, it's just defined in the enum.

In the minimal reproduction link, you can see the state ends up to "paused" instead of "complete".

image

My question is: will there be any implementation concerning that in a near future ?
Thanks you !

Minimal Reproduction Link

https://stackblitz.com/edit/github-p2hm8v?file=src%2FApp.tsx

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

1 participant