-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
About event handler #357
Comments
Currently you have to assign callback to .onended property/event. This callback will be called in c++ when playback stops with one argument - stopTime. This approach allows us to achieve frame accurate play/pause.
Here you have full example https://github.com/software-mansion-labs/react-native-audio-api/blob/main/apps/common-app/src/examples/AudioFile/AudioFile.tsx |
Yes i followed this example. Copied as well. But itsnt fire trigger playback completed. Just i have seen console messages onended, when click to stop button, after play started. |
which version are you using? |
|
Could you prepare some repro? In my build this example works just how it has to. |
Same problem here (using 0.5.2). Here is the relevant part of my code: const sourceNode = audioContext.createBufferSource();
sourceNode.buffer = audioBuffersMap.get(index)!;
const callback = (stopTime?: number) => {
setOffset((_prev) => stopTime || 0);
};
console.log(callback);
sourceNode.onended = callback;
if (sourceNode.onended === undefined) {
console.log("Callback not set");
} else {
console.log(sourceNode.onended);
} When I run this with
|
Getter for |
Thanks for the feedback. |
Is there a method or an event to calculate how many times the audio played? |
Unfortunately not, so you have to calculate it by yourself. If you send me same snippet of code I will help |
I want to handle event when playback completed. But I don't understand how onended props running
The text was updated successfully, but these errors were encountered: