if (wc == 1001 && wf == 1){
soundManager.play(‘sound1’);
      }
if (wc == 1001 && wf== 2){
soundManager.play('sound2');
}
代码如上,但是当条件满足以上2个条件时,sound1和sound2会同时调用,怎么做才可以让sound1播放完毕后,再去调用sound2.急ajax

解决方案 »

  1.   

    if (wc == 1001 && wf == 1){
    soundManager.play(‘sound1’);
          }
    esle if (wc == 1001 && wf== 2){
    soundManager.play('sound2');
    }试试这样写!
      

  2.   

    如果是html5的video或者audio标签有个ended事件及属性判断是否已经播放完毕<video src="文件路径" controls="true" autoplay="true" id="vd"></video>
    <script language="javascript">
        document.getElementById('vd').addEventListener('ended', function () {alert('finish') });
    </script>
      

  3.   


    if(wc == 1001) {
      if(wf == 1) soundManager.play(‘sound1’); 
      else if(wf== 2) soundManager.play('sound2');  
         
    }
      

  4.   

    以上方法我试了下,不是声音不播放了,就是声音还是叠加的,大侠们,我找了下资料
    soundmanager2官方给出的示例如下:
    soundManager.play('sound1',{volume:50,onfinish:playNextSound});
    其中onfinish就是是sound1播放完毕后回调的方法
    但是我没找到onfinish这个方法具体怎么写。麻烦大家帮帮忙
      

  5.   

    var sounds1=soundManager.createSound({
      id: 'sound1', 
      url: '',
      autoPlay:false,
      onfinish:function(){
       if (wc == 1001 && wf== 2){
     soundManager.play('sound2');
    }
      } 
     });
    var sounds2=soundManager.createSound({
      id: 'sound2', 
      url: '',
      autoPlay:false 
     });if (wc == 1001 && wf == 1){
      soundManager.play('sound1');
    }
      

  6.   

    用这个方法,我的声音文件就不执行了
    soundmanager2官方给出的示例如下:
     soundManager.play('sound1',{volume:50,onfinish:playNextSound});
     其中onfinish就是是sound1播放完毕后回调的方法
    但是我没找到onfinish这个方法,麻烦问下,你知道怎么用这个方法吗?
      

  7.   

    soundmanager2类库没用过,自己看下他们的api,如果支持循环播放应该可以继续播放下一个的