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

Loop function does not play the audio, only sets loop variable #87

Open
parolaraul opened this issue Sep 13, 2023 · 3 comments
Open

Loop function does not play the audio, only sets loop variable #87

parolaraul opened this issue Sep 13, 2023 · 3 comments

Comments

@parolaraul
Copy link

Confusing documentation / Wrong behavior

I added this library to my project and I found out that my audio file was not being played. I thought it was due to the file location and the "assetPath" variable, buy I realized it was caused by a "bug" in the .loop() method I was calling. I was expecting for the audio to reproduce with the loop call, but this was not the actual behavior. Its confusing and it does not correspond with the documentation:


/**

  • This method will loop the audio file for playback.
  • @param assetId - identifier of the asset
  • @returns void
    */
    NativeAudio.loop({
    assetId: 'fire',
    });

I would suggest calling the play() method in the AudioAsset.java file after setting the loop variable or fixing the documentation.

STR:

  • Preload an audio file with an assetId (NativeAudio.preload())
  • Call the loop function with the same assetId.

Expected behavior:
The audio file will be reproduced in loop mode.

Actual behavior:
Nothing happens after loop is invoked.

@orhan-swe
Copy link

Yeah, it was a bit confusing for me too.
A good solution would be for loop function to check if the audio file is already being played and if not start playing it.

@rondybrandao
Copy link

rondybrandao commented Dec 28, 2023

Have you found a solution for this bug?, I need this method. Apparently it works well on an HTML page, but on Android nothing happens, nor does it show an error.

@orhan-swe
Copy link

@rondybrandao
First you call preload(), then you call play(), now music should start playing, and then you call loop(), so now it will also loop.

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

3 participants