问题
//Assuming cricket.wav file has audio information of 5 secs.
var file1 = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'cricket.wav');
//Assuming mahamed.wav file has audio information of 25 secs.
var file2 = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'test.wav');
//How do i merge both file1 and file2 and create a file which should have audio information of 30 secs.?
var file = file1 + file2; // This is giving me an error.
I need file which will play file1 then followed by file2.
回答1:
You have a few choices. Learn Objective C and drop Titanium since it can't do what you are asking or upload your files to a server somewhere combine them and then download the single combined file. The other is what Muhammad is saying where you create your own custom timers and use the duration
and looping
values to make it play out correctly. Personally I would go with the server method.
来源:https://stackoverflow.com/questions/6345982/titanium-how-to-add-2-merge-two-ti-media-sound-objects