koraysels edited a comment on issue #229: How can we loop ?
URL: 
https://github.com/apache/cordova-plugin-media/issues/229#issuecomment-574088925
 
 
   > Couple of details for anyone trying to get looping to work:
   > 
   > **On iOS**
   > It works great IF you use a local resource media file or download the file 
and reference it as a cdvfile:// before playing. It will not work for an 
internet url. That will cause this plugin to use AVPlayer which doesn't support 
looping out of the box (you can kind of rig it in javascript, but I wouldn't 
trust it's stability).
   > 
   > To get a local file to loop forever (until stop is called or the app is 
closed) set {numberOfLoops: -1} on play()
   > 
   > **On Android**
   > numberOfLoops does nothing.
   > 
   > I tried many javascript ideas to get around this. You can definitely rig 
it, but you will get the occasional skip and it's not very reliable. It tried 
fading one out while fading in the next with setVolume(), this works but you 
can tell what's going on (not seamless) and I don't think it would be a solid 
solution.
   > 
   > I tried rewriting the native part of this plugin to reuse 2 MediaPlayers 
and specify the next via setNextMediaPlayer(). This worked, but chopped off the 
very end of the audio file before looping, not seamless.
   > 
   > After a lot of trial and error I would definitely suggest exoplayer2 for 
android gapless looping. I hesitated to add it, but it only ads 2mb to your apk 
and is very feature rich to use it again elsewhere. It's able to loop files 
without downloading them first and it can also read metadata in mp3s if it is 
set to get them to loop correctly (which is often a problem in with looping 
mp3s). Only downside, exoplayer doesn't work for iOS but this plugin, a local 
file, and play({numberOfLoops:-1}) does.
   > 
   > Creating audio files that don't have audible pops is another thing you'll 
have to consider.
   > 
   > Happy loopin'!
   
   I have been using the Audio WEB API untill now.. It has bugs when going into 
the background etc.. It has been very performant to loop and also for 
polyphonic audio. But I need to get rid of the bugs it us causing. SO i 
switched to Capacitor instead of cordova and now I need to find a way to 
reference the assets directly but I can't seem to get the correct path.. 
   
   
   
   [UPDATE] Okay I figured out how to load the files .. but man... the looping 
this terrible... Also when I try to play multiple sounds at once..  It is a 
disaster ... (I am making a music sample app with a sequencer) -> when I use 
web audio API it works flawllesly.. only the sond is gone there when th eapp is 
sent to background.. which is a totally different problem but still .. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to