0

我正在使用以下代码播放声音。声音在模拟器上正常工作,但在设备上不起作用。两台设备都运行相同的 iOS 版本。

有没有办法调试这个错误?我怎样才能解决这个问题 ?

var soundLabel = Ti.UI.createView({
backgroundColor:'red',
width:125,
height:40,
top:75,
right:340
});




 soundLabel.addEventListener('click',function(e){
   var sound = Titanium.Media.createSound();
  sound.setUrl("/Sound/"+alphabet+".wav");  
    alert("HERE");
    sound.play();
 });
4

1 回答 1

1

尝试在您的行上方添加以下行sound.play();

Titanium.Media.audioSessionMode = Ti.Media.AUDIO_SESSION_MODE_PLAYBACK;

请查看Ti.Media.Sound.play() no sound on iPhone speaker,仅适用于耳机。我想你可能也有同样的问题。

于 2013-07-31T03:57:34.213 回答