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

[iOS] Problem listening FinishedLoading & FinishedPlaying #162

Open
HugoEdd opened this issue Nov 3, 2023 · 5 comments
Open

[iOS] Problem listening FinishedLoading & FinishedPlaying #162

HugoEdd opened this issue Nov 3, 2023 · 5 comments

Comments

@HugoEdd
Copy link

HugoEdd commented Nov 3, 2023

I have a warning message on IOS devices, I created a general function. I do not how to avoid that warning. This is my function
let onFinishedPlaying = null;

export const playButtonSound = (sound: SoundNames, format: SoundFormat) => {
onFinishedPlaying = SoundPlayer.addEventListener(
'FinishedPlaying',
({ success }) => {
console.log('finished playing', success);
},
);

// Llamar a la función playSoundFile
SoundPlayer.playSoundFile(sound, format);
console.log('Reproduciendo');

// Eliminar las suscripciones después de su uso
onFinishedPlaying.remove();
console.log('removiendo');
};

Of this way I call it into other screens

playButtonSound(SoundNames.CartLimit, MP3);

warning message: Sending FinishedPlaying with no listeners registered.

@kendistiller
Copy link

@HugoEdd It looks like you're removing the handler before it had finished playing the sound, so you're getting an expected warning of no listeners upon that event. I believe remove() would be for cleanup of used listeners. If you just want to eliminate the warning, probably just use SoundPlayer.addEventListener('FinishedPlaying', ({ success }) => {})

@MuhammadAdeelBaig
Copy link

MuhammadAdeelBaig commented Jan 3, 2024

not working

remove is not there in latest release

@JoaoNeto99
Copy link

JoaoNeto99 commented Jan 5, 2024

I had this problem because the audio path was wrong. When I fixed it, the listener worked fine.

@sahiljnv
Copy link

sahiljnv commented May 2, 2024

same problem
not working in ios ......

@kendistiller
Copy link

same problem

not working in ios ......

Please provide your code as the latest works fine for me.

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

5 participants