From a4e8348d1753c439c0acba2ca9a4ca7107219cfd Mon Sep 17 00:00:00 2001 From: VisualSJ Date: Fri, 4 Aug 2017 17:45:02 +0800 Subject: [PATCH] #6197 Fixed a bug about url is missing --- cocos2d/core/load-pipeline/audio-downloader.js | 6 +++++- cocos2d/core/load-pipeline/md5-pipe.js | 3 ++- cocos2d/core/videoplayer/CCSGVideoPlayer.js | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cocos2d/core/load-pipeline/audio-downloader.js b/cocos2d/core/load-pipeline/audio-downloader.js index b8d12615a3..6543650e65 100644 --- a/cocos2d/core/load-pipeline/audio-downloader.js +++ b/cocos2d/core/load-pipeline/audio-downloader.js @@ -34,7 +34,11 @@ var context = __audioSupport.context; function loadDomAudio (item, callback) { var dom = document.createElement('audio'); - dom.src = item.url; + var url = item.url; + if (cc.loader.md5Pipe) { + url = cc.loader.md5Pipe.transformURL(url); + } + dom.src = url; var clearEvent = function () { clearTimeout(timer); dom.removeEventListener("canplaythrough", success, false); diff --git a/cocos2d/core/load-pipeline/md5-pipe.js b/cocos2d/core/load-pipeline/md5-pipe.js index d745af53d1..ecf48766a9 100644 --- a/cocos2d/core/load-pipeline/md5-pipe.js +++ b/cocos2d/core/load-pipeline/md5-pipe.js @@ -44,7 +44,8 @@ MD5Pipe.prototype.handle = function(item) { }; MD5Pipe.prototype.transformURL = function (url) { - var key = url; + var split = url.split('?'); + var key = split[0]; if (key.startsWith(this.libraryBase)) { key = key.slice(this.libraryBase.length); } else if(key.startsWith(this.rawAssetsBase)) { diff --git a/cocos2d/core/videoplayer/CCSGVideoPlayer.js b/cocos2d/core/videoplayer/CCSGVideoPlayer.js index 45e4b17a4c..d770e74b87 100644 --- a/cocos2d/core/videoplayer/CCSGVideoPlayer.js +++ b/cocos2d/core/videoplayer/CCSGVideoPlayer.js @@ -302,6 +302,9 @@ _ccsg.VideoPlayer.EventType = { }; proto.updateURL = function (path) { + if (cc.loader.md5Pipe) { + path = cc.loader.md5Pipe.transformURL(path); + } var source, video, extname; var node = this._node;