uniapp gets the first frame of the video (OSS cannot get the first frame after cdn acceleration)

The methods provided by the current blog are all based on oss storing videos and then splicing paths later.
Basically, you need to splice this string of characters after your url:

'?x-oss-process=video/snapshot,t_0,f_jpg'

Here is Ali's introduction
insert image description here
insert image description here



But if you have a CDN-accelerated address, this method is useless. After pondering for a long time, I found that the simplest and crudest way is to directly use uni’s video component and then bind some properties to hide all buttons. By default, uni will get the first frame
. The code example is as follows:
# 关键参数:
# item.videos是我视频的地址
# show-center-play-btn:是否展示中间播放按钮
# controls:是否显示默认播放控件
<video :src="item.videos" :show-center-play-btn="false" :controls="false" mobilenet-hint-type=0 object-fit="fill" class="all_img"></video>

The effect is as follows (only one picture, even the first frame, can’t be clicked. The effect is achieved):

insert image description here


If you don't have CDN to accelerate, you can go directly to OSS. The effect is the same (helpful point like)

Guess you like

Origin blog.csdn.net/qq_44718932/article/details/130051282