语音在线播放实践-亲测可用

1、配置tomcat安装目录conf下的server.xml文件

1、在host节点里添加 context节点具体配置如下

<Host name="localhost"  appBase="webapps"
        unpackWARs="true" autoDeploy="true">
    <!-- SingleSignOn valve, share authentication between web applications
         Documentation at: /docs/config/valve.html -->
    <!--
    <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
    -->
    <!-- Access log processes all example.
         Documentation at: /docs/config/valve.html
         Note: The pattern used is equivalent to using pattern="common" -->
    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
           prefix="localhost_access_log" suffix=".txt"
           pattern="%h %l %u %t &quot;%r&quot; %s %b" />
		   
	<Context path="/ai"  docBase="D:/test" debug="0" reloadable="true"/>
  </Host>   

2、docBase=“D:/test"设置的是录音存放位置,可自行更改; path=”/ai"为访问前缀,可自行更改。

3、启动tomcat后访问 http://localhost:8080/ai/1.wav 以下是运行效果图
在这里插入图片描述

附: h5部分代码

	 audioSrc: null, // 录音地址
	      
	<audio class="aud_css" id="callAudio" controls="controls">
      <source :src="audioSrc">你的浏览器不支持播放该媒体文件,请注意升级!
    </audio>

   _this.audioSrc = res.data.data.audioSrc;
    if (document.getElementById("callAudio") != null) {
        document.getElementById("callAudio").load();
      }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值