wuyongxiang 4 年之前
父节点
当前提交
e0f8ad94d8
共有 3 个文件被更改,包括 42 次插入0 次删除
  1. 42 0
      index.html
  2. 二进制
      static/img/wx/beijing_pic.png
  3. 二进制
      static/img/wx/wode_icon.png

+ 42 - 0
index.html

@@ -0,0 +1,42 @@
+<!doctype html>
+<head>
+    <title>Using multiple file formats in JavaScript</title>
+
+ 
+    <script type= "text/javascript">
+        function checkAudioCompat() {
+            var myAudio = document.createElement('audio');
+            var msg = document.getElementById("display");
+ 
+            msg.innerHTML = "";
+ 
+            if (myAudio.canPlayType) {
+                // CanPlayType returns maybe, probably, or an empty string.
+                var playMsg = myAudio.canPlayType('audio/mpeg');
+                if ( "" != playMsg) {
+                    msg.innerHTML += "mp3 is " + playMsg + " supported<br/>";
+                }
+                playMsg = myAudio.canPlayType('audio/ogg; codecs="vorbis"'); 
+                if ( "" != playMsg){
+                    msg.innerHTML += "ogg is " + playMsg + " supported<br/>";                    
+                }
+ 
+                playMsg = myAudio.canPlayType('audio/mp4; codecs="mp4a.40.5"');
+                if ( "" != playMsg){
+                    msg.innerHTML += "aac is "+playMsg+" supported<br/>";
+                }
+            }
+            else {
+                msg.innerHTML += "no audio support";                
+            }
+        }
+    </script>
+</head>
+<body>
+    <button onclick="checkAudioCompat();">
+        Test for audio format type
+    </button>
+    <div id="display"> </div>
+    <audio src="./1.aac" controls></audio>
+</body>
+</html>

二进制
static/img/wx/beijing_pic.png


二进制
static/img/wx/wode_icon.png