javascript - How can I do gapless audio looping with mobile browser? -


it seems i'm unable achieve gapless looping mobile. i've done far:

https://github.com/hivenfour/seamlessloop

  • creates gap.

http://www.schillmania.com/projects/soundmanager2/demo/api/

  • creates gap.

https://github.com/regosen/gapless-5

  • creates gap.
  • downloads same audio twice.

https://github.com/floatinghotpot/cordova-plugin-nativeaudio

  • creates gap.

html5 audio

  • creates gap.

cordova's media plugin

  • creates gap.

webaudio

all above tested mp3 , ogg.

edit:

soundjs's cordova plugin broken , doesn't work;

https://github.com/createjs/soundjs/issues/170

with html5 if using html5, use loop attribute.

<audio controls loop>   <source src="horse.ogg" type="audio/ogg">   <source src="horse.mp3" type="audio/mpeg"> browser not support audio element. </audio> 

it doesn't create gap, check audio file, of audio file has gap @ end.

you can test here, add loop attribute , run page.

with javascript

here alternative using javascript

myaudio = new audio('somesound.ogg');  myaudio.addeventlistener('ended', function() {     this.currenttime = 0;     this.play(); }, false); myaudio.play(); 

here javascript create little gap, can overcome playing loop not when audio finished when audio finish. here code.

here want.

myaudio = new audio('http://unska.com/audio/pinknoise.ogg');  myaudio.ontimeupdate= function(i) {   if((this.currenttime / this.duration)>0.9){     this.currenttime = 0;     this.play();   } }; myaudio.play(); 

here demo.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -