[]小游戏环境下 声音的缓存机制导致更换声音文件失败

在wxmini中关于声音的管理

__proto.load = function (url) {
            url = URL.formatURL(url);
            this.url = url;
            this.readyUrl = url;
            if (MiniSound._audioCache[this.readyUrl]) {
                this.event(/*laya.events.Event.COMPLETE*/"complete");
                return;
            }
            console.log(url);
            if (MiniAdpter.autoCacheFile && MiniFileMgr.getFileInfo(url)) {
                console.log('from cacheFile');
                this.onDownLoadCallBack(url, 0);
            } else {
                if (!MiniAdpter.autoCacheFile) {
                    this.onDownLoadCallBack(url, 0);
                } else {
                    console.log('dow file');
                    MiniFileMgr.downOtherFiles(url, Handler.create(this, this.onDownLoadCallBack, [url]), url);
                }
            }
        }
 
 

MiniFileMgr.getFileInfo = function (fileUrl) {
            var fileNativePath = fileUrl.split("?")[0];
            var fileObj = MiniFileMgr.filesListObj[fileNativePath];
            if (fileObj == null)
                return null;
            else
                return fileObj;
            return null;
        }
 
getFileInfo 忽略?之后的版本号,导致版号失效
 
已邀请:

Laya_XSN

赞同来自:

确实有问题,谢谢反馈问题,临时方案,你先解决下,等下个版本修复:
/**
* @private
* 加载声音。
* @param url 地址。
*/
public function load(url:String):void {
if (!MiniFileMgr.isLocalNativeFile(url)) {
url = URL.formatURL(url);
}else
{
if (url.indexOf("http://";) != -1 || url.indexOf("https://";) != -1)
{
if(MiniFileMgr.loadPath != "")
{
url = url.split(MiniFileMgr.loadPath)[1];//去掉http头
}else
{
var tempStr:String = URL.rootPath != "" ? URL.rootPath : URL.basePath;
if(tempStr != "")
url = url.split(tempStr)[1];//去掉http头
}
}
}
this.url = url;
this.readyUrl = url;
if (_audioCache[this.readyUrl]) {
event(Event.COMPLETE);
return;
}
var fileObj:Object = MiniFileMgr.getFileInfo(url);
if(MiniAdpter.autoCacheFile&& fileObj && fileObj.readyUrl == url)
{
onDownLoadCallBack(url,0);
}else
{
if(!MiniAdpter.autoCacheFile)
{
onDownLoadCallBack(url,0);
}else
{
MiniFileMgr.downOtherFiles(url,Handler.create(this,onDownLoadCallBack,[url]),url);
}
}
}

要回复问题请先

商务合作
商务合作