We are building a exercise app using ionic framework, which need to play multiple audio files in sequence with specific interval between each audio file. We got this working
Basic technically steps:
If you are using node.js it's pretty easy
This article describes basic mp3 file concatenation on node.js
Note, this is very hackish way, you might hit many restrictions (application speed, battery consumption, local storage limit, etc) and you still will not have single file, but single format.
And use custom format like
var CustomFile = function(array_of_base64_files){
var prepared_files = [];
for (var i = 0; i < array_of_base64_files.length; i++) {
var file = array_of_base64_files[i];
prepared_files.push({
created: Date.now(),
order: i,
base64: file
});
};
this.export = function(){
return prepared_files;
}
};
CustomFile
from pouchdbwindow.URL.createObjectURL(formBlob);
so that HTML5 Audio can play itYou could create a cordova plugin that manage the files concat in the javascript layer but really join them in the native layer.
Other interesting question about audio merging (only in Android):
Android concat 2 audio (wav or mp3) files
How to merge two mp3 files into one (combine/join)
Concatenate two audio files and play resulting file