我正在尝试使用SoundManager2作为iPhone Web App的一部分,在使用jQuery提交表单后播放声音.播放的特定声音取决于结果,因此生成的页面设置一个变量,用于标识要播放的声音文件.
这一切都在桌面上顺利运行,但在iPhone上运行时,它会失败.
iPhone上的调试控制台显示它正在尝试...
1124: SMSound.play(): "ValidSound" is loading - attempting to play...
1124: SMSound.play(): "ValidSound" is starting to play
1124: setPosition(0): delaying, sound not ready
1124: HTML5::loadstart: ValidSound
1124: HTML5::suspend: ValidSound
Run Code Online (Sandbox Code Playgroud)
......但每次播放都没有声音.
有关可能导致此失败的原因的任何想法?我已经包含了主页面的代码,以及使用jQuery返回的"响应"页面的示例:
主要
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" src="sm/script/soundmanager2.js"></script>
<script>
soundManager.setup({
url: 'sm/swf/',
useHTML5Audio: true,
onready: function() {
soundManager.createSound({
id: 'ValidSound',
useHTML5Audio: true,
preferFlash: false,
url: 'http://www.example.com/example sound.mp3'
});
}
});
</script>
</head>
<body onload="window.top.scrollTo(0,1);">
<div class="scannerform">
<form id="scanner" name="scanner" method="post" action="ok.php">
<input type="text" name="scan" …Run Code Online (Sandbox Code Playgroud)