查看: 9084|回复: 13

[已经过期] 暂时放弃修改

[复制链接]
梦石
0
星屑
50
在线时间
31 小时
注册时间
2015-10-26
回帖
23
发表于 2015-10-30 12:59:16 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 zhangjiki 于 2015-11-3 11:06 编辑

因为是代码小白,所以只能靠排查法一个一个去试,终于找到了问题所在。
rpg_managers.rar (11.95 KB, 下载次数: 228)
导出为安卓工程后,解压覆盖在js文件夹下。这样再用WeX5打包成APK,BGM就生效了。
(暂时放弃修改,因为所有BGM和BGS都只能播放一遍,无法正常游戏)

点评

..分类为已过期 使用一个恰当的标题或者修正后@我分类回来  发表于 2015-11-28 16:25
请使用一个合适的标题  发表于 2015-11-21 17:29

姬魂

梦石
0
星屑
443
在线时间
400 小时
注册时间
2009-8-30
回帖
568

开拓者

发表于 2015-10-30 13:33:21 | 显示全部楼层
谢谢分享
回复

使用道具 举报

梦石
10
星屑
1516
在线时间
1088 小时
注册时间
2013-9-4
回帖
1254
发表于 2015-10-30 14:09:07 | 显示全部楼层
改了啥?什么原因说一下,睡觉也安心点
回复

使用道具 举报

梦石
0
星屑
50
在线时间
15 小时
注册时间
2015-10-7
回帖
5
发表于 2015-10-30 14:47:19 | 显示全部楼层
hehaaaa哈啊啊啊啊哦

点评

论坛是禁止无意义的回复的  发表于 2015-10-30 16:40
回复

使用道具 举报

梦石
0
星屑
50
在线时间
53 小时
注册时间
2015-6-26
回帖
9
发表于 2015-10-30 15:38:15 | 显示全部楼层
楼主辛苦了
回复

使用道具 举报

梦石
0
星屑
80
在线时间
386 小时
注册时间
2007-7-27
回帖
4075

开拓者

发表于 2015-10-30 20:07:19 | 显示全部楼层
楼主改了这个地方
原来
  1.     if (this.shouldUseHtml5Audio() && folder === 'bgm') {
复制代码
楼主改的
  1. if (this.shouldUseHtml5Audio() && folder === 'audio') {
复制代码

点评

反正‘’里面不能写bgm、bgs、se、me,写哪个哪个文件夹的文件就读取不了。把这半句删掉还是能运行。现在问题是bgm有延迟、不循环需要改其它代码。  发表于 2015-10-30 20:25
可不可以问一下原理是什么....文件夹变了吗?  发表于 2015-10-30 20:16
吸吸
回复

使用道具 举报

梦石
0
星屑
50
在线时间
31 小时
注册时间
2015-10-26
回帖
23
 楼主| 发表于 2015-10-30 20:15:14 | 显示全部楼层
本帖最后由 zhangjiki 于 2015-10-30 20:20 编辑
trentswd 发表于 2015-10-30 20:07
楼主改了这个地方
原来楼主改的


那个audio瞎写的,随便写成什么(只要不写成bgm、bgs、se、me就行)或者把那半句去掉都可以,但是并没有实质解决问题,代码我看不懂。体现出来的问题就是播放有延迟,不能循环播放,熄屏停放。只能靠别人解决了。
其实只要找到bgm自动循环那一段代码改一下就好了,可惜我是看不懂。
回复

使用道具 举报

梦石
0
星屑
80
在线时间
386 小时
注册时间
2007-7-27
回帖
4075

开拓者

发表于 2015-10-30 20:25:48 | 显示全部楼层

  1. AudioManager.createBuffer = function(folder, name) {
  2.     var ext = this.audioFileExt();
  3.     var url = this._path + folder + '/' + encodeURIComponent(name) + ext;
  4.     if (this.shouldUseHtml5Audio() && folder === 'bgm') {
  5.         Html5Audio.setup(url);
  6.         return Html5Audio;
  7.     } else {
  8.         return new WebAudio(url);
  9.     }
  10. };
复制代码
这段是创建缓冲
意思是
如果应该用html5audio且存在bgm文件夹,那么使用html5audio
否则使用webAudio

看样子是楼主的手机支持html5Audio所以进入了html5audio的分支,但是不知道为啥创建失败
改了之后因为找的是audio,但是找的那个目录下面只有"bgm" "se" "me" "bgs"四个文件夹,所以进入了否则分支,使用了webAudio。楼主说的卡应该就是因为使用了webAudio

点评

我刚才试了一下楼下发的链接,在浏览器里玩,锁屏是暂停音乐,我改完以后的情况是,锁屏以后是停止音乐,除非再次触发。我估摸是wex5的问题。  发表于 2015-10-30 20:55
锁屏自动停止应该不是bug,不循环就不知道了  发表于 2015-10-30 20:33
有懂代码的人就太好了,现在的问题是bgm不自动循环,熄屏自动停止,帮看看怎么改呗。  发表于 2015-10-30 20:31
吸吸
回复

使用道具 举报

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
回帖
1464
发表于 2015-10-30 20:29:37 | 显示全部楼层
额,机翻的,或许对楼主有用
[fold]

  1. //-----------------------------------------------------------------------------
  2. // AudioManager
  3. // 音频管理器
  4. // The static class that handles BGM, BGS, ME and SE.
  5. // 这个静态的类 处理 bgm bgs me se

  6. function AudioManager() {
  7.     throw new Error('This is a static class');
  8. }
  9. // 音频管理器 bgm大小
  10. AudioManager._bgmVolume      = 100;
  11. // 音频管理器 bgs大小
  12. AudioManager._bgsVolume      = 100;
  13. // 音频管理器 me大小
  14. AudioManager._meVolume       = 100;
  15. // 音频管理器 se大小
  16. AudioManager._seVolume       = 100;
  17. // 音频管理器 当前的bgm
  18. AudioManager._currentBgm     = null;
  19. // 音频管理器 当前的bgs
  20. AudioManager._currentBgs     = null;
  21. // 音频管理器 bgm缓存
  22. AudioManager._bgmBuffer      = null;
  23. // 音频管理器 bgs缓存
  24. AudioManager._bgsBuffer      = null;
  25. // 音频管理器 me缓存
  26. AudioManager._meBuffer       = null;
  27. // 音频管理器 se缓存
  28. AudioManager._seBuffers      = [];
  29. // 音频管理器 静态缓存
  30. AudioManager._staticBuffers  = [];
  31. // 音频管理器 重播淡入时间
  32. AudioManager._replayFadeTime = 0.5;
  33. // 音频管理器 路径
  34. AudioManager._path           = 'audio/';

  35. // 定义属性 bgmVolume
  36. Object.defineProperty(AudioManager, 'bgmVolume', {
  37.         //获得
  38.     get: function() {
  39.             //返回 bgm大小
  40.         return this._bgmVolume;
  41.     },
  42.     //设置
  43.     set: function(value) {
  44.             //bgm大小设为 value
  45.         this._bgmVolume = value;
  46.         //更新bgm参数(当前的bgm)
  47.         this.updateBgmParameters(this._currentBgm);
  48.     },
  49.     //可设置的 :true
  50.     configurable: true
  51. });
  52. // 定义属性 bgsVolume
  53. Object.defineProperty(AudioManager, 'bgsVolume', {
  54.     //获得
  55.     get: function() () {
  56.         return this._bgsVolume;
  57.     },
  58.     //设置
  59.     set: function() (value) {
  60.         this._bgsVolume = value;
  61.         this.updateBgsParameters(this._currentBgs);
  62.     },
  63.     //可设置的 :true
  64.     configurable: true
  65. });

  66. //定义属性 meVolume
  67. Object.defineProperty(AudioManager, 'meVolume', {
  68.     //获得
  69.     get: function() () {
  70.         return this._meVolume;
  71.     },
  72.     //设置
  73.     set: function() (value) {
  74.         this._meVolume = value;
  75.         this.updateMeParameters(this._currentMe);
  76.     },
  77.     //可设置的 :true
  78.     configurable: true
  79. });

  80. //定义属性 seVolume
  81. Object.defineProperty(AudioManager, 'seVolume', {
  82.     //获得
  83.     get: function() () {
  84.         return this._seVolume;
  85.     },
  86.     //设置
  87.     set: function() (value) {
  88.         this._seVolume = value;
  89.     },
  90.     //可设置的 :true
  91.     configurable: true
  92. });
  93. //播放 bgm (bgm,位置)
  94. AudioManager.playBgm = function(bgm, pos) {
  95.         //如果 是当前的 bgm
  96.     if (this.isCurrentBgm(bgm)) {
  97.             //更新bgm参数
  98.         this.updateBgmParameters(bgm);
  99.     } else {
  100.             //停止bgm
  101.         this.stopBgm();
  102.         //如果 bgm的名字
  103.         if (bgm.name) {
  104.                 //bgm 缓存 设置为  创建缓存('bgm',bgm的名字)
  105.             this._bgmBuffer = this.createBuffer('bgm', bgm.name);
  106.             //更新bgm参数(bgm)
  107.             this.updateBgmParameters(bgm);
  108.             //如果 不是 me缓存
  109.             if (!this._meBuffer) {
  110.                     //bgm缓存 播放(true,位置 或 0 )
  111.                 this._bgmBuffer.play(true, pos || 0);
  112.             }
  113.         }
  114.     }
  115.     //更新当前的bgm(bgm,位置)
  116.     this.updateCurrentBgm(bgm, pos);
  117. };
  118. //重播bgm(bgm)
  119. AudioManager.replayBgm = function(bgm) {
  120.         //如果 是当前的bgm
  121.     if (this.isCurrentBgm(bgm)) {
  122.             //更新bgm参数(bgm)
  123.         this.updateBgmParameters(bgm);
  124.     } else {
  125.             //播放bgm(bgm,bgm的位置)
  126.         this.playBgm(bgm, bgm.pos);
  127.         //如果 bgm缓存
  128.         if (this._bgmBuffer) {
  129.                 //bgm缓存 淡入(重播淡入时间)
  130.             this._bgmBuffer.fadeIn(this._replayFadeTime);
  131.         }
  132.     }
  133. };
  134. //是当前的bgm(bgm)
  135. AudioManager.isCurrentBgm = function(bgm) {
  136.         //返回 当前的bgm 并且 bgm缓存 并且 当前的bgm的名字 全等 bgm的名字
  137.     return (this._currentBgm && this._bgmBuffer &&
  138.             this._currentBgm.name === bgm.name);
  139. };
  140. //更新bgm参数(bgm)
  141. AudioManager.updateBgmParameters = function(bgm) {
  142.         //更新缓存参数(bgm缓存,bgm大小,bgm)
  143.     this.updateBufferParameters(this._bgmBuffer, this._bgmVolume, bgm);
  144. };
  145. //更新当前的bgm(bgm,位置)
  146. AudioManager.updateCurrentBgm = function(bgm, pos) {
  147.         //当前的bgm 设为
  148.     this._currentBgm = {
  149.             //名字 bgm的名字
  150.         name: bgm.name,
  151.         //大小 bgm的大小
  152.         volume: bgm.volume,
  153.         //音高 bgm的音高
  154.         pitch: bgm.pitch,
  155.         //pan bgm的pan
  156.         pan: bgm.pan,
  157.         //位置 位置
  158.         pos: pos
  159.     };
  160. };
  161. //停止bgm
  162. AudioManager.stopBgm = function() {
  163.         //如果 bgm缓存
  164.     if (this._bgmBuffer) {
  165.             //bgm缓存 停止
  166.         this._bgmBuffer.stop();
  167.         //bgm缓存 设为 null
  168.         this._bgmBuffer = null;
  169.         //当前的bgm 设为 null
  170.         this._currentBgm = null;
  171.     }
  172. };
  173. //淡出bgm(持续时间)
  174. AudioManager.fadeOutBgm = function(duration) {
  175.         //如果 bgm缓存 并且 当前的bgm
  176.     if (this._bgmBuffer && this._currentBgm) {
  177.             //bgm缓存 淡出(持续时间)
  178.         this._bgmBuffer.fadeOut(duration);
  179.         //当前的bgm 设为 null
  180.         this._currentBgm = null;
  181.     }
  182. };
  183. //淡入bgm(持续时间)
  184. AudioManager.fadeInBgm = function(duration) {
  185.         //如果 bgm缓存 并且 当前的bgm
  186.     if (this._bgmBuffer && this._currentBgm) {
  187.             //bgm缓存 淡入(持续时间)
  188.         this._bgmBuffer.fadeIn(duration);
  189.     }
  190. };
  191. //播放 bgs (bgs,位置)
  192. AudioManager.playBgs = function(bgs, pos) {
  193.         //如果 是当前的 bgs
  194.     if (this.isCurrentBgs(bgs)) {
  195.             //更新bgs参数
  196.         this.updateBgsParameters(bgs);
  197.     } else {
  198.             //停止bgs
  199.         this.stopBgs();
  200.         //如果 bgs的名字
  201.         if (bgs.name) {
  202.                 //bgs 缓存 设置为  创建缓存('bgs',bgs的名字)
  203.             this._bgsBuffer = this.createBuffer('bgs', bgs.name);
  204.             //更新bgs参数(bgs)
  205.             this.updateBgsParameters(bgs);
  206.             //如果 不是 me缓存
  207.             if (!this._meBuffer) {
  208.                     //bgs缓存 播放(true,位置 或 0 )
  209.                 this._bgsBuffer.play(true, pos || 0);
  210.             }
  211.         }
  212.     }
  213.     //更新当前的bgs(bgs,位置)
  214.     this.updateCurrentBgs(bgs, pos);
  215. };
  216. //重播bgs(bgs)
  217. AudioManager.replayBgs = function(bgs) {
  218.         //如果 是当前的bgs
  219.     if (this.isCurrentBgs(bgs)) {
  220.             //更新bgs参数(bgs)
  221.         this.updateBgsParameters(bgs);
  222.     } else {
  223.             //播放bgs(bgs,bgs的位置)
  224.         this.playBgs(bgs, bgs.pos);
  225.         //如果 bgs缓存
  226.         if (this._bgsBuffer) {
  227.                 //bgs缓存 淡入(重播淡入时间)
  228.             this._bgsBuffer.fadeIn(this._replayFadeTime);
  229.         }
  230.     }
  231. };
  232. //是当前的bgs(bgs)
  233. AudioManager.isCurrentBgs = function(bgs) {
  234.         //返回 当前的bgs 并且 bgs缓存 并且 当前的bgs的名字 全等于 bgs的名字
  235.     return (this._currentBgs && this._bgsBuffer &&
  236.             this._currentBgs.name === bgs.name);
  237. };
  238. //更新bgs参数(bgs)
  239. AudioManager.updateBgsParameters = function(bgs) {
  240.         //更新缓存参数(bgs缓存,bgs大小,bgs)
  241.     this.updateBufferParameters(this._bgsBuffer, this._bgsVolume, bgs);
  242. };
  243. //更新当前的bgs(bgs,位置)
  244. AudioManager.updateCurrentBgs = function(bgs, pos) {
  245.         //当前的bgs 设为
  246.     this._currentBgs = {
  247.             //名字 bgs的名字
  248.         name: bgs.name,
  249.         //大小 bgs的大小
  250.         volume: bgs.volume,
  251.         //音高 bgs的音高
  252.         pitch: bgs.pitch,
  253.         //pan bgs的pan
  254.         pan: bgs.pan,
  255.         //位置 位置
  256.         pos: pos
  257.     };
  258. };
  259. //停止bgs
  260. AudioManager.stopBgs = function() {
  261.         //如果 bgs缓存
  262.     if (this._bgsBuffer) {
  263.             //bgs缓存 停止
  264.         this._bgsBuffer.stop();
  265.         //bgs缓存 设为 null
  266.         this._bgsBuffer = null;
  267.         //当前的bgs 设为 null
  268.         this._currentBgs = null;
  269.     }
  270. };
  271. //淡出bgs(持续时间)
  272. AudioManager.fadeOutBgs = function(duration) {
  273.         //如果 bgs缓存 并且 当前的bgs
  274.     if (this._bgsBuffer && this._currentBgs) {
  275.             //bgs缓存 淡出(持续时间)
  276.         this._bgsBuffer.fadeOut(duration);
  277.         //当前的bgs 设为 null
  278.         this._currentBgs = null;
  279.     }
  280. };
  281. //淡入bgs(持续时间)
  282. AudioManager.fadeInBgs = function(duration) {
  283.         //如果 bgs缓存 并且 当前的bgs
  284.     if (this._bgsBuffer && this._currentBgs) {
  285.             //bgs缓存 淡入(持续时间)
  286.         this._bgsBuffer.fadeIn(duration);
  287.     }
  288. };
  289. //播放me
  290. AudioManager.playMe = function(me) {
  291.     this.stopMe();
  292.     if (me.name) {
  293.         if (this._bgmBuffer && this._currentBgm) {
  294.             this._currentBgm.pos = this._bgmBuffer.seek();
  295.             this._bgmBuffer.stop();
  296.         }
  297.         this._meBuffer = this.createBuffer('me', me.name);
  298.         this.updateMeParameters(me);
  299.         this._meBuffer.play(false);
  300.         this._meBuffer.addStopListener(this.stopMe.bind(this));
  301.     }
  302. };
  303. //更新me参数
  304. AudioManager.updateMeParameters = function(me) {
  305.     this.updateBufferParameters(this._meBuffer, this._meVolume, me);
  306. };
  307. //淡出me
  308. AudioManager.fadeOutMe = function(duration) {
  309.     if (this._meBuffer) {
  310.         this._meBuffer.fadeOut(duration);
  311.     }
  312. };
  313. //停止me
  314. AudioManager.stopMe = function() {
  315.     if (this._meBuffer) {
  316.         this._meBuffer.stop();
  317.         this._meBuffer = null;
  318.         if (this._bgmBuffer && this._currentBgm && !this._bgmBuffer.isPlaying()) {
  319.             this._bgmBuffer.play(true, this._currentBgm.pos);
  320.             this._bgmBuffer.fadeIn(this._replayFadeTime);
  321.         }
  322.     }
  323. };
  324. //播放se
  325. AudioManager.playSe = function(se) {
  326.     if (se.name) {
  327.         this._seBuffers = this._seBuffers.filter(function(audio) {
  328.             return audio.isPlaying();
  329.         });
  330.         var buffer = this.createBuffer('se', se.name);
  331.         this.updateSeParameters(buffer, se);
  332.         buffer.play(false);
  333.         this._seBuffers.push(buffer);
  334.     }
  335. };
  336. //更新se参数
  337. AudioManager.updateSeParameters = function(buffer, se) {
  338.     this.updateBufferParameters(buffer, this._seVolume, se);
  339. };
  340. //停止se
  341. AudioManager.stopSe = function() {
  342.     this._seBuffers.forEach(function(buffer) {
  343.         buffer.stop();
  344.     });
  345.     this._seBuffers = [];
  346. };
  347. //播放静态se(se)
  348. AudioManager.playStaticSe = function(se) {
  349.         //如果 se的名字
  350.     if (se.name) {
  351.             //读取静态se
  352.         this.loadStaticSe(se);
  353.         //循环 ,i = 0 ,如果 i< 静态缓存的长 ,每次i + 1
  354.         for (var i = 0; i < this._staticBuffers.length; i++) {
  355.                 // 缓存的 设置为 静态缓存[i]
  356.             var buffer = this._staticBuffers[i];
  357.             //如果 缓存的 保存se名字 全等于 se的名字
  358.             if (buffer._reservedSeName === se.name) {
  359.                     //缓存的停止
  360.                 buffer.stop();
  361.                 //更新se参数(缓存的,se)
  362.                 this.updateSeParameters(buffer, se);
  363.                 //缓存的播放(false)
  364.                 buffer.play(false);
  365.                 break;
  366.             }
  367.         }
  368.     }
  369. };
  370. //读取静态se(se)
  371. AudioManager.loadStaticSe = function(se) {
  372.         //如果 se 的名字 并且 不是 是静态se
  373.     if (se.name && !this.isStaticSe(se)) {
  374.             //缓存的 设置为 创造缓存("se",se的名字)
  375.         var buffer = this.createBuffer('se', se.name);
  376.         //缓存的 保存se名字 设置为 se的名字
  377.         buffer._reservedSeName = se.name;
  378.         //静态缓存 添加 缓存的
  379.         this._staticBuffers.push(buffer);
  380.         //如果 会用到Html5Audio
  381.         if (this.shouldUseHtml5Audio()) {
  382.                 //Html5Audio 设置静态se(缓存的 地址)
  383.             Html5Audio.setStaticSe(buffer._url);
  384.         }
  385.     }
  386. };
  387. //是静态se(se)
  388. AudioManager.isStaticSe = function(se) {
  389.         //循环 ,i = 0 ,如果 i< 静态缓存的长 ,每次i + 1
  390.     for (var i = 0; i < this._staticBuffers.length; i++) {
  391.             //缓存的 设置为 静态的缓存[i]
  392.         var buffer = this._staticBuffers[i];
  393.         //如果 缓存的 保存se名字 全等于 se的名字
  394.         if (buffer._reservedSeName === se.name) {
  395.                 //返回 true
  396.             return true;
  397.         }
  398.     }
  399.     //返回 false
  400.     return false;
  401. };
  402. //停止所有
  403. AudioManager.stopAll = function() {
  404.     this.stopMe();
  405.     this.stopBgm();
  406.     this.stopBgs();
  407.     this.stopSe();
  408. };
  409. //保存bgm
  410. AudioManager.saveBgm = function() {
  411.         //如果 当前的bgm
  412.     if (this._currentBgm) {
  413.         var bgm = this._currentBgm;
  414.         return {
  415.                 //名字 bgm的名字
  416.             name: bgm.name,
  417.             //大小 bgm的大小
  418.             volume: bgm.volume,
  419.             //音高 bgm的音高
  420.             pitch: bgm.pitch,
  421.             //pan bgm的pan
  422.             pan: bgm.pan,
  423.             //位置 bgm缓存 ? bgm缓存 查找 : 0
  424.             pos: this._bgmBuffer ? this._bgmBuffer.seek() : 0
  425.         };
  426.     } else {
  427.             //返回 制作空音频对象
  428.         return this.makeEmptyAudioObject();
  429.     }
  430. };
  431. //保存bgs
  432. AudioManager.saveBgs = function() {
  433.     if (this._currentBgs) {
  434.         var bgs = this._currentBgs;
  435.         return {
  436.             name: bgs.name,
  437.             volume: bgs.volume,
  438.             pitch: bgs.pitch,
  439.             pan: bgs.pan,
  440.             pos: this._bgsBuffer ? this._bgsBuffer.seek() : 0
  441.         };
  442.     } else {
  443.         return this.makeEmptyAudioObject();
  444.     }
  445. };
  446. //制作空音频对象
  447. AudioManager.makeEmptyAudioObject = function() {
  448.         //名字 :"" ,大小 0 ,音高 0
  449.     return { name: '', volume: 0, pitch: 0 };
  450. };
  451. //创造缓存 (文件夹 ,名字)
  452. AudioManager.createBuffer = function(folder, name) {
  453.         //提取 设置为 音频文件提取
  454.     var ext = this.audioFileExt();
  455.     //地址 设置为 路径 + 文件夹 +"/" + encodeURIComponent(name) + 提取
  456.     var url = this._path + folder + '/' + encodeURIComponent(name) + ext;
  457.     //如果 会用到Html5Audio 并且 文件夹 全等于 bgm
  458.     if (this.shouldUseHtml5Audio() && folder === 'bgm') {
  459.             //Html5Audio安装(地址)
  460.         Html5Audio.setup(url);
  461.         //返回 Html5Audio
  462.         return Html5Audio;
  463.     } else {
  464.             //返回  WebAudio(url)
  465.         return new WebAudio(url);
  466.     }
  467. };
  468. //更新缓存参数(缓存的,大小,音频)
  469. AudioManager.updateBufferParameters = function(buffer, configVolume, audio) {
  470.     if (buffer && audio) {
  471.             //缓存的声音 设置为 大小 * (音频大小 或 0) / 10000
  472.         buffer.volume = configVolume * (audio.volume || 0) / 10000;
  473.         //
  474.         buffer.pitch = (audio.pitch || 0) / 100;
  475.         buffer.pan = (audio.pan || 0) / 100;
  476.     }
  477. };
  478. //音频文件提取
  479. AudioManager.audioFileExt = function() {
  480.         //如果 web音频 可以播放ogg 并且 不是 是移动设备
  481.     if (WebAudio.canPlayOgg() && !Utils.isMobileDevice()) {
  482.         return '.ogg';
  483.     } else {
  484.         return '.m4a';
  485.     }
  486. };
  487. // 会用到Html5Audio
  488. AudioManager.shouldUseHtml5Audio = function() {
  489.     // We use HTML5 Audio to play BGM instead of Web Audio API
  490.     // because decodeAudioData() is very slow on Android Chrome.
  491.     //返回 Utils 是AndroidChrome
  492.     return Utils.isAndroidChrome();
  493. };
  494. //检查错误
  495. AudioManager.checkErrors = function() {
  496.         //检查web音频错误
  497.     this.checkWebAudioError(this._bgmBuffer);
  498.     this.checkWebAudioError(this._bgsBuffer);
  499.     this.checkWebAudioError(this._meBuffer);
  500.     this._seBuffers.forEach(function(buffer) {
  501.         this.checkWebAudioError(buffer);
  502.     }.bind(this));
  503.     this._staticBuffers.forEach(function(buffer) {
  504.         this.checkWebAudioError(buffer);
  505.     }.bind(this));
  506. };
  507. //检查web音频错误
  508. AudioManager.checkWebAudioError = function(webAudio) {
  509.         //如果 webAudio 并且 webAudio是错误
  510.     if (webAudio && webAudio.isError()) {
  511.             //抛出 新错误 (读取 webAudio 失败)
  512.         throw new Error('Failed to load: ' + webAudio.url);
  513.     }
  514. };
复制代码
[/fold]

点评

谢谢,我参考一下,但是也有可能是打包工具的问题。  发表于 2015-10-30 21:11
回复

使用道具 举报

梦石
0
星屑
80
在线时间
386 小时
注册时间
2007-7-27
回帖
4075

开拓者

发表于 2015-10-30 20:32:17 | 显示全部楼层
http://gitmv.sinaapp.com/demo/
楼主直接用手机chrome打开这个有声音吗,我的chrome可以
如果楼主的也可以 可能就是wex的问题了……

点评

可以!!  发表于 2015-10-30 20:51
有声音。 也许是wex5打包的浏览器有问题,但是真不想架本地服务器啊,把电脑弄的好乱,算了,等几天再说吧。  发表于 2015-10-30 20:51
吸吸
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部