奇怪 ,那個朗讀,chrome不行,但IE、edge都是好的。
怀疑是那个阅读的函数与chrome有兼容问题。
怀疑是那个阅读的函数与chrome有兼容问题。
function speakSelectedWord(){
//alert("!");
//alert(this.nodeName);
//alert(this.innerHTML);
//alert(window.getSelection().toString());
var seletcText=SE.subWindows[SE.subWindows.length-1].getSelection().toString();
//alert(seletcText);
if(seletcText.length<1){
var targetNode=this.parentNode.parentNode.parentNode;
seletcText=(targetNode.innerText||targetNode.textContent).split("收合关闭简体朗读").join("").split("收合關閉簡體朗讀").join("").substr(0,200);
}
//SE.subWindows[SE.subWindows.length-1].alert(seletcText);
//return;
//alert(new Audio("https://shilao.app.cntv.cn/tts?appkey=default&token=default&format=mp3&voice=xiaoyun&volume=100&speech_rate=0&chunk=true&text="+encodeURI(seletcText)).play());
//new Audio("https://shilao.app.cntv.cn/tts?appkey=default&token=default&format=mp3&voice=xiaoyun&volume=100&speech_rate=0&chunk=true&text="+encodeURI(seletcText)).play();
try{
SE.subWindows[SE.subWindows.length-1].document.documentElement.removeChild(thevoice);
}catch(e){
//SE.subWindows[SE.subWindows.length-1].alert(e.description);
}
thevoice=SE.subWindows[SE.subWindows.length-1].document.createElement("audio");
thevoice.setAttribute("volume",1);
thevoice.setAttribute("src","https://shilao.app.cntv.cn/tts?appkey=default&token=default&format=mp3&voice=xiaoyun&volume=100&speech_rate=0&chunk=true&text="+encodeURI(seletcText));
SE.subWindows[SE.subWindows.length-1].document.documentElement.appendChild(thevoice);
thevoice.play();
//SE.subWindows[SE.subWindows.length-1].alert(thevoice.play());
//window.open(thevoice.src);
}
最后编辑: