黑松山资源网 Design By www.paidiu.com
这个不算啥新奇吧?但还是记录一下。
这个问题应该这么看。
1、首先网站要支持.MOV格式文件
就是说,网站要能识别.MOV格式文件。
<mimeMap fileExtension=".mov" mimeType="video/quicktime" />
如何识别?设置MIME类型。以IIS为例。除了可以在IIS界面上直接设置,还可以在项目的web.config里设置。给个完整的例子
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <directoryBrowse enabled="true" /> <defaultDocument> <files> <remove value="default.aspx" /> <remove value="iisstart.htm" /> <remove value="index.html" /> <remove value="index.htm" /> <remove value="Default.asp" /> <remove value="Default.htm" /> </files> </defaultDocument> <staticContent> <remove fileExtension=".mp4" /> <remove fileExtension=".wasm" /> <remove fileExtension=".woff" /> <remove fileExtension=".woff2" /> <remove fileExtension=".mov" /> <mimeMap fileExtension=".mp4" mimeType="video/mpeg" /> <mimeMap fileExtension=".wasm" mimeType="application/wasm" /> <mimeMap fileExtension=".woff" mimeType="application/font-woff" /> <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" /> <mimeMap fileExtension=".mov" mimeType="video/quicktime" /> </staticContent> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="*" /> </customHeaders> </httpProtocol> <caching> <profiles> <add extension=".png" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" /> <add extension=".jpg" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" /> <add extension=".css" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" /> <add extension=".js" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" /> </profiles> </caching> </system.webServer> </configuration>
2、HTML
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <style> body,center{ padding:0; margin:0; } </style> </head> <body> <center> <video id="video" width="640" height="480" muted controls autoplay="autoplay" preload="auto" > <source src="月半湾.mov" /> 您的浏览器不支持 HTML5 video 标签。 </video> </center> </body> </html>
本例会自动播放。自动播放的关键是“muted”属性(静音),否则无论是声明autoplay=“autoplay”,还是用脚本video.play()都不起作用。这个应该是故意设计成这样的。否则,打开就自动播放,万一是爱情动作片怎么办?如果静音就少了许多顾虑。
总结
以上所述是小编给大家介绍的html5自动播放mov格式视频的实例代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
黑松山资源网 Design By www.paidiu.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
黑松山资源网 Design By www.paidiu.com
暂无评论...
更新日志
2024年09月20日
2024年09月20日
- 黑神话悟空上品鼠弩手精魄获取方法一览|上品鼠弩手精魄收集攻略
- 中国音乐地图听见世界非物质文化遗产《非遗HQCD》wav
- 中国民乐合奏作品集《华夏之音HQ》头版限量编号[WAV+CUE]
- [电影原声带]黎允文《天将雄师》[FLAC+CUE]
- 曝NS继任机型已进入量产阶段:已花了30亿日元
- 不是Switch2?曝《马里奥惊奇》NS捆绑包即将公开
- 暖心任天堂!网友Switch维修返还时贴纸被完好保留
- 《国语老歌 经典对唱情歌 2CD》[WAV/分轨][1.1GB]
- 《刀郎 翻唱精选华语专辑 披着羊皮的狼 》[WAV+CUE][430MB]
- 《真的田震 中国乐坛红极一时的歌者 精品集》[WAV+CUE][300MB]
- 群星.1995-新滚石九大天王之情歌大全【滚石】【WAV+CUE】
- 群星.1993-滚石九大天王十二出好戏·纵夏欢唱【滚石】【WAV+CUE】
- 群星.1993-滚石九大天王十二出好戏·贺岁齐唱【滚石】【WAV+CUE】
- 黑神话悟空上品虫校尉精魄获取方法一览|上品虫校尉精魄收集攻略
- 《指环王:夏尔的传说》推迟至2025年初发行