pc
<Video
id="video"
controls
showPlay
class="videoStyle"
width="100%"
height="550"
:autoplay="isAutoplay"
@pause="onPause(index)"
@timeupdate="handleTimeUpdate"
:currentTime="preVideoTime"
@seeked="handleSeek"
@play="handlePlay(jumpNum)"
></Video>
uni-app
<video
ref="videoRef"
:id="video"
:src="videoUrl"
controls
class="videoStyle"
width="100%"
height="240px"
:autoplay="isAutoplay"
:initial-time="preVideoTime"
:show-center-play-btn="false"
@play="handlePlay"
@pause="onPause"
@ended="onEnd"
@timeupdate="onTimeUpdate"
></video>
1.指定视频初始播放位置 initial-time 和 currentTime
uni-app | html(pc) | |
属性名 | initial-time | currentTime |
类型 | Number | Number |
说明 | 指定视频初始播放位置,单位为(s)。 | 指定视频初始播放位置,单位为(s)。 |
2. 暂停播放和播放完成@pause和@ended
uni-app | html(pc) | |
@pause | 当暂停播放时触发 pause 事件 | 通过元素的 ended 属性判断是播放结束还是暂停 (为true 是播放结束,false是暂停) |
@ended | 当播放到末尾时触发 ended 事件 |