Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/120.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 网络语音崩溃Safari iOS_Javascript_Ios_Safari_Webspeech Api - Fatal编程技术网

Javascript 网络语音崩溃Safari iOS

Javascript 网络语音崩溃Safari iOS,javascript,ios,safari,webspeech-api,Javascript,Ios,Safari,Webspeech Api,我在MobileSafari中使用语音合成,发现它非常不稳定,特别是在说话过程中操纵DOM时。我创建了一个简单的测试用例,使iOS 7.1.1上的Safari(或Webview)在iPad上崩溃(但在OS X Safari上运行良好)。有人知道为什么下面的HTML页面会杀死mobile Safari吗 <!DOCTYPE html> <html> <head> <title>Speech Bug</title> <

我在MobileSafari中使用语音合成,发现它非常不稳定,特别是在说话过程中操纵DOM时。我创建了一个简单的测试用例,使iOS 7.1.1上的Safari(或Webview)在iPad上崩溃(但在OS X Safari上运行良好)。有人知道为什么下面的HTML页面会杀死mobile Safari吗

<!DOCTYPE html>

<html>
<head>
    <title>Speech Bug</title>
    <script>
    function testFunc()
    {
        var elem = document.getElementById("textout");
        var wordCount = 0, utterance = new SpeechSynthesisUtterance("You'll notice that Safari on iOS will crash after clicking this button several times.");

        utterance.onstart = function(event) {
            elem.innerHTML = "";
        }
        utterance.onboundary = function (event) {
            elem.innerHTML += ++wordCount + "\n";
            elem.scrollTop = wordCount * 22;
        }

        window.speechSynthesis.speak(utterance);
    }
    </script>
</head>
<body>
    <div id="textout" style="white-space: pre; font-size: 14pt; height: 100px; width: 50px; overflow: auto"></div>
    <button onclick="testFunc()">Click to Fail</button>
</body>
</html>

言语缺陷
函数testFunc()
{
var elem=document.getElementById(“textout”);
var wordCount=0,outrance=newspeechsynthesisutterrance(“您会注意到,iOS上的Safari在多次单击此按钮后将崩溃。”);
outstance.onstart=函数(事件){
elem.innerHTML=“”;
}
outrance.onboundary=函数(事件){
elem.innerHTML+++字数+“\n”;
elem.scrollTop=wordCount*22;
}
窗口。演讲合成。讲话(话语);
}
点击失败

在我的iPad上使用它只需点击一次。尽管它对小提琴@Ron的ChromeThanks很有效。从iOS 8.1.3开始,此示例似乎不再使iOS Safari崩溃。