ngWebAudio icon indicating copy to clipboard operation
ngWebAudio copied to clipboard

takes 38s to start the audio

Open cullsin opened this issue 8 years ago • 6 comments

Hello,

Can you please suggest me why it takes 38second to start the audio ?

You can check this demo http://mla.mugam.in ( Watch it in Mobile )

Raja K

cullsin avatar Apr 08 '16 16:04 cullsin

If you open the page with Chrome dev tools, network tab, you can see the audio is 4.5mb, which took about 25s for my browser to load. Try to reduce the size of the file for better results (compression or chunking it)

nehz avatar Apr 08 '16 16:04 nehz

Hello,

Thanks. I made a split and looks good. I am getting a voice gap. How do I buffer or queue the next set of files ?

Raja K

cullsin avatar Apr 09 '16 03:04 cullsin

Use the audio.buffer() method to buffer while previous parts are playing

nehz avatar Apr 09 '16 03:04 nehz

Hi,

Please suggest me where do I call "buffer" as I am changing the file of my mp3.

Controller below

function HomeCtrl($q, $scope, $http, $state, Playlist, WebAudio) {

     var self = this;
     var audio = {};
     $scope.home = {};
 $scope.home.limit = 1;
 $scope.home.chunk = 0;
 $scope.home.offset = 0;
    var all = $q.all([Playlist.home($scope.home)]);
            all.then(successV);
     function successV(data) {
                    audio = $scope.sound = WebAudio(data[0].source, {buffer: true});
                    $scope.home.offset = data[0].offset;
                    $scope.home.chunk = data[0].chunk;
                    var result = $scope.sound.play();
                    $scope.sound.onEnd = function() {
                            $scope.home.chunk += 1;
                            var all = $q.all([Playlist.home($scope.home)]);
                            all.then(successV);
                    }

     }

}

cullsin avatar Apr 09 '16 03:04 cullsin

You'll need to create audio object for all the parts, then using audio.onBuffered, buffer() each audio object in sequence. The audio.onEnd would work similar to above, but instead of creating a new audio object for the next part, it would fetch it from an array of audio objects and play it.

nehz avatar Apr 10 '16 02:04 nehz

Hi,

Can you please suggest me the sample write ups ?

Raja K

cullsin avatar Apr 14 '16 05:04 cullsin