一段没有音频的视频,怎么判断它有没有音频?
1
a570295535 2017-08-01 09:48:19 +08:00
我的耳朵是出气的。。。
|
2
Tonni 2017-08-01 09:55:33 +08:00 2
方案: https://stackoverflow.com/a/23399773/4480674
缺点:浏览器兼容性不够好 |
4
metalbug OP <!DOCTYPE html>
<head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="https://code.jquery.com/jquery-1.11.3.js"></script> </head> <body> <video autoplay loop id="myVideo"> <source src="http://www.leoog.com/wp-content/uploads/2017/07/leoog_13934734.mp4" type="video/mp4"> </video> <video autoplay loop id="myVideo"> <source src="http://www.runoob.com/try/demo_source/mov_bbb.mp4" type="video/mp4"> </video> <script type="text/javascript"> document.getElementById("myVideo").addEventListener("loadeddata", function() { if (typeof this.webkitAudioDecodedByteCount || this.mozHasAudio || this.audioTracks !== "undefined") { if (this.webkitAudioDecodedByteCount > 0 || this.mozHasAudio || this.audioTracks && this.audioTracks.length) this.after("有声"); else this.after("没声"); } }); </script> </body> </html> @Tonni 这段 JS 可以,但是多个视频怎么写?新手求大神赐教。 |
5
metalbug OP 搞好了可以关贴了。
|