video标签设置视频封面
时间: 2023-08-29 19:11:02 浏览: 327
视频标签可以通过添加poster属性来设置视频封面。例如,在video标签中加入poster属性,将其值设置为图片链接,即可将该图片作为视频的封面。具体代码如下:
```html
<video src="video_url" poster="封面图片链接" controls="{{false}}" initial-time='0.01' muted autoplay object-fit="cover"></video>
```
其中,video_url是视频的链接地址,封面图片链接是视频封面的图片地址。通过这样设置,视频在加载前会展示封面图片,提高用户体验。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [微信小程序:video标签默认显示视频的第一帧作为封面](https://blog.csdn.net/mouday/article/details/118517724)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [video视频标签一些设置,包括封面、播放结束后的封面、视频占满屏幕的方式、视频播放暂停、展示控制栏、...](https://blog.csdn.net/qq_46617584/article/details/129185121)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文