mirror of https://github.com/axmolengine/axmol.git
audio search path (android)
This commit is contained in:
parent
ba83b6f740
commit
ada1d1dfe8
|
@ -2626,6 +2626,26 @@ _p.setDisabledSpriteFrame = function(frame) {
|
||||||
cc.MenuItemToggle.prototype.selectedItem = cc.MenuItemToggle.prototype.getSelectedItem;
|
cc.MenuItemToggle.prototype.selectedItem = cc.MenuItemToggle.prototype.getSelectedItem;
|
||||||
|
|
||||||
|
|
||||||
|
// playMusic searchPaths
|
||||||
|
if (cc.sys.os === cc.sys.OS_ANDROID && cc.audioEngine) {
|
||||||
|
cc.audioEngine._playMusic = cc.audioEngine.playMusic;
|
||||||
|
cc.audioEngine.playMusic = function () {
|
||||||
|
var args = arguments;
|
||||||
|
var searchPaths = jsb.fileUtils.getSearchPaths();
|
||||||
|
var path = args[0];
|
||||||
|
searchPaths.some(function (item) {
|
||||||
|
var temp = item + '/' + path;
|
||||||
|
var exists = jsb.fileUtils.isFileExist(temp);
|
||||||
|
if (exists) {
|
||||||
|
path = temp;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
args[0] = path;
|
||||||
|
cc.audioEngine._playMusic.apply(cc.audioEngine, args);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// LabelTTF API wrappers
|
// LabelTTF API wrappers
|
||||||
//
|
//
|
||||||
|
|
|
@ -232,9 +232,6 @@ var soundId = null;
|
||||||
var playMusic = function () {
|
var playMusic = function () {
|
||||||
cc.log("play background music");
|
cc.log("play background music");
|
||||||
var musicFile = MUSIC_FILE;
|
var musicFile = MUSIC_FILE;
|
||||||
if (cc.sys.os == cc.sys.OS_ANDROID) {
|
|
||||||
musicFile = "res/"+musicFile;
|
|
||||||
}
|
|
||||||
audioEngine.playMusic(musicFile, false);
|
audioEngine.playMusic(musicFile, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue