2014-12-10 3 views
0

일부 이벤트에서 오디오 재생을 담당하는 팩토리에 AngualrJS 앱이 있습니다. 해당 공장에서 만든 오디오가 3 가지입니다. 내 이슈는 IE10에서 다른 컨트롤러에서 호출 한 하나의 오디오 (메시지 전송)가 3을 재생하고 다른 2는 (동일한 공장에서 호출하는) 단계별로 실행할 때 디버거에서만 재생된다는 것입니다. 처음 플레이하면 디버거없이 예상대로 작동합니다. Chrome에 이 (가) 있으며 파이어 폭스는 훌륭하게 작동합니다.IE10에서 오디오 객체가 재생되지 않습니다.

sounds[soundName].play(); 

마임 타입이 audio/mpeg입니다 :

var sounds = { 
    messageSent: new Audio('/assets/audios/message-sent.mp3'), 
    privateMessageRecived: new Audio('/assets/audios/private_message.mp3'), 
    notificationRecieved: new Audio('/assets/audios/notification-recived.mp3') 
}; 

는 그런 다음 오디오를 재생합니다.

function start() { 
     pusherEvents.onAll(function(channelName, eventName, data) { 
      if (!isEmbedInactive() || isMuted()) { 
       return; 
      } 

      switch (eventName) { 
       case 'message': 
        if (!isMe(data.sender_id)) { 
         SpotsManager.getSpot({ id: data.spot_id }) 
          .then(function(spot) { 
           if (spot.type === 'intimate') { 
            sounds.privateMessageRecived.play(); 
           } 
          }); 
        } 
        break; 
       case 'user_mentioned': 
        if (!isMe(data.mentioner.id)) { 
         sounds.notificationRecieved.play(); 
        } 
        break; 
       case 'message_liked': 
        var isMine = isMe(data.sender_id); 
        if (isMine) { 
         sounds.notificationRecieved.play(); 
        } 
        break; 
       case 'invitation_accepted': 
        if (!isMe(data.invitee.id)) { 
         sounds.notificationRecieved.play(); 
        } 
        break; 
       case 'intimate_user_invited': 
        sounds.notificationRecieved.play(); 
        break; 
      } 
     }); 
    } 

답변

0

나는 비슷한 문제가 있었고 audio 태그가 자동 닫혀 있었기 때문입니다.

<audio></audio> 시도하지 <audio/>

당신이 오디오를 발생하는 이벤트를 확인하는 것이 좋습니다 다른 정보 후 IE10 버그에게

갱신

것 같다. IE10에서 이벤트가 제대로 작동하지 않을 수도 있습니다

+0

IE10에서만 발생하는 이벤트는 디버그가 작동하지 않는 경우 – giladtamam

+0

소리가 들리면 작동합니까? – faby

+0

감사합니다. 내 문제를 해결했습니다! isEmbedInactive가 true였습니다. – giladtamam

관련 문제