zoukankan      html  css  js  c++  java
  • js--语音播报

    一、借用百度接口

     function speckText(){
    		 	var str = "请及时预警!";
                 //var request=  new URLRequest();
                   var url = "http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&text=" + encodeURI(str);        // baidu
                  //url = "http://translate.google.cn/translate_tts?ie=UTF-8&tl=zh-CN&total=1&idx=0&textlen=19&prev=input&q=" + encodeURI(str); // google
                
               //request.url = encodeURI(url);
                // request.contentType = "audio/mp3"; // for baidu
                //request.contentType = "audio/mpeg"; // for google
    
              var n = new Audio(url);
    
              n.src = url;
    
              n.play();
              
              // $("...").play();
              // var sound = new Sound(request);
              // sound.play();
       }		
    

      

  • 相关阅读:
    java
    MVC4重复提交数据
    cache
    Nosql
    MVC4重复提交
    PHP Java
    .net performance
    How the Runtime Locates Assemblies
    android
    window.onscroll
  • 原文地址:https://www.cnblogs.com/macT/p/9289974.html
Copyright © 2011-2022 走看看