Titanium How to add 2 merge two Ti.Media.sound objects?

最后都变了- 提交于 2020-01-25 10:52:10

问题


//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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!