ngWebAudio
ngWebAudio copied to clipboard
takes 38s to start the audio
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
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)
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
Use the audio.buffer() method to buffer while previous parts are playing
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);
}
}
}
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.
Hi,
Can you please suggest me the sample write ups ?
Raja K