首先在rawfile文件夹里面放一个mp4文件

自定义Video组件

在videoSrc里面加上播放源的位置
// xxx.ets
@Component
export struct VideoCreateComponent {
@State videoSrc: Resource = $rawfile('1.mp4')
@State previewUri: Resource = $r('app.media.background')
@State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X
@State isAutoPlay: boolean = false
@State showControls: boolean = true
controller: VideoController = new VideoController()
build() {
Column() {
Video({
src: this.videoSrc,
previewUri: this.previewUri,
currentProgressRate: this.curRate,
controller: this.controller
})
.width('100%')
.height(600)
.autoPlay(this.isAutoPlay)

最低0.47元/天 解锁文章
1325

被折叠的 条评论
为什么被折叠?



