html5 plaer
来源:互联网 发布:百度云会员淘宝暗语 编辑:程序博客网 时间:2024/06/08 04:50
<!DOCTYPE html><html> <head> <title>HTML5 Audio Player </title> <!-- Uncomment the following meta tag if you have issues rendering this page on an intranet site. --> <!-- <meta http-equiv="X-UA-Compatible" content="IE=9"/> --> <script type="text/javascript"> // Global variable to track current file name. var currentFile = ""; function playAudio() { // Check for audio element support. if (window.HTMLAudioElement) { try { var oAudio = document.getElementById('myaudio'); var btn = document.getElementById('play'); var audioURL = document.getElementById('audiofile'); //Skip loading if current file hasn't changed. if (audioURL.value !== currentFile) { oAudio.src = audioURL.value; currentFile = audioURL.value; } // Tests the paused attribute and set state. if (oAudio.paused) { oAudio.play(); btn.textContent = "Pause"; } else { oAudio.pause(); btn.textContent = "Play"; } } catch (e) { // Fail silently but show in F12 developer tools console if(window.console && console.error("Error:" + e)); } } } // Rewinds the audio file by 30 seconds. function rewindAudio() { // Check for audio element support. if (window.HTMLAudioElement) { try { var oAudio = document.getElementById('myaudio'); oAudio.currentTime -= 30.0; } catch (e) { // Fail silently but show in F12 developer tools console if(window.console && console.error("Error:" + e)); } } } // Fast forwards the audio file by 30 seconds. function forwardAudio() { // Check for audio element support. if (window.HTMLAudioElement) { try { var oAudio = document.getElementById('myaudio'); oAudio.currentTime += 30.0; } catch (e) { // Fail silently but show in F12 developer tools console if(window.console && console.error("Error:" + e)); } } } // Restart the audio file to the beginning. function restartAudio() { // Check for audio element support. if (window.HTMLAudioElement) { try { var oAudio = document.getElementById('myaudio'); oAudio.currentTime = 0; } catch (e) { // Fail silently but show in F12 developer tools console if(window.console && console.error("Error:" + e)); } } } </script> </head> <body> <p> <input type="text" id="audiofile" size="80" value="pinyin/a1.mp3" /> </p> <audio id="myaudio" controls> HTML5 audio not supported </audio> <button id="play" onclick="playAudio();"> Play </button> <button onclick="rewindAudio();"> Rewind </button> <button onclick="forwardAudio();"> Fast forward </button> <button onclick="restartAudio();"> Restart </button> </body></html>
0 0
- html5 plaer
- ubuntu 安装flash plaer
- HTML5
- Html5
- HTML5
- HTML5
- HTML5
- HTML5
- html5
- html5
- HTML5
- html5
- HTML5
- HTML5
- HTML5
- Html5
- HTML5
- Html5
- 控制直流电机设计常用方法
- linux下调试python
- poj 3254
- computearea
- 利用开发人员命令提示输出"Hello world"
- html5 plaer
- 题目1551:切蛋糕
- 马方表示飞机在越南消失应由越南主导搜救
- 25. 微软面试题:栈的push、pop序列(栈)
- C++笔记
- 我们需要专职的QA吗?
- eclipse下tomcat的缓存问题
- oracle小知识汇编持续更新中
- SDN解决方案总结:OpenFlow、虚拟机、OpenStack和VXLAN/NVGRE