中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
微信扫码分享
刚好今天做到这一块的内容,代码还是比较简单 ```kotlin @Entry @Component struct VideoCreateComponent { @State videoSrc: Resource = `$rawfile('video1.mp4')` @State previewUri: Resource = `$r('app.media.icon')` @State isAutoPlay: boolean = false @State showControls: boolean = true controller: VideoController = new VideoController() build() { Column() { Video({ src: `this.videoSrc`, previewUri: `this.previewUri`, controller: `this.controller` }) .width('100%') .height(600) .autoPlay(`this.isAutoPlay`) .controls(`this.showControls`) Row() { Button('start').onClick(() => { `this.controller.start()` }).margin(2) Button('pause').onClick(() => { `this.controller.pause()` }).margin(2) Button('stop').onClick(() => { `this.controller.stop()` }).margin(2) } } } }