html5的audio标签只在火狐下支持wav格式的音频播放,无法兼容IE和google ,
使用audioplayer.js 基本上能支持大部分浏览器播放wav音频文件,经测试IE、火狐、google浏览器都可以播放wav格式的音频
当audio标签不支持或者audio不能播放相应格式的文件时,播放器将使用迷你模式,使用embed元素来播放音频,支持的功能将较少,并且各浏览器支持功能不一致
使用方法:
1、html中加入audio标签
<audio controls="controls" id="wavAudio"> <source src="https://osvaldas.info/examples/audio-player-responsive-and-touch-friendly/audio.wav" type="audio/wav" /> </audio>
2、引用jquery和audioplayer.js
<script src="~/Content/assets/js/jquery-1.11.1.min.js"></script> <script src="~/Content/audioplayer.js"></script>
3、播放器代码
常用自定义选项
classPrefix 插件插入html的class前缀
strPlay 播放按钮显示的文字
strPause 暂停按钮显示的文字
strVolume 音量按钮显示的文字
$(function () { $('audio').audioPlayer({ classPrefix: 'audioplayer', strPlay: '播放', strPause: '暂停', strVolume: '音量' }); });
audioplayer网站:https://osvaldas.info/audio-player-responsive-and-touch-friendly
最终效果
如对本文有疑问, 点击进行留言回复!!
清除新版Google Chrome浏览器中表单控件(input,button...)默认的黑色边框
荐 20200714——git/mac配置/项目运行步骤/一些报错
antd 菜单组件 使用时报错:Cannot read property ‘isRootMenu‘ of undefined
CSS|div的style=“background-image: url(img/a.bmp)图片显示不出来
硬件仪表盘账号建立指导(一) --WHQL认证测试结果提交账号(一)
cookie的规范Cookie的不可跨域名性或Cookie与域名的关系
网友评论