说明:
该组件从api version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
接口
video(value: {src?: string, currentprogressrate?: number | string, previewuri?: string, controller?: videocontroller})
示例代码:
// @ts-nocheck@entry@componentstruct videoexample { @state src: resource = $rawfile('video1.mp4') @state currentprogressrate: number = 1 @state muted: boolean = false @state autoplay: boolean = false @state controls: boolean = true @state startstaus: boolean = true myvideocontroller: videocontroller = new videocontroller() build() { column({ space: 10 }) { video({ src: this.src, previewuri: '../../../../resources/rawfile/video1.mp4', currentprogressrate: this.currentprogressrate, controller: this.myvideocontroller }) .muted(this.muted) .autoplay(this.autoplay) .controls(this.controls) .objectfit(imagefit.contain) .loop(true) .width(320) .height(200) .onstart(() => { console.info('onstart') }) .onpause(() => { console.info('onpause') }) .onfinish(() => { console.info('onfinish') }) .onerror(() => { console.info('onerror') }) .onfullscreenchange((e) => { console.info('onfullscreenchange:' + e.fullscreen) }) .onprepared((e) => { console.info('onprepared:' + e.duration) }) .onseeking((e) => { console.info('onseeking' + e.time) }) .onseeked((e) => { console.info('onseeked' + e.time) }) .onupdate((e) => { console.info('onupdate' + e.time) }) row() { flex({ wrap: flexwrap.wrap, justifycontent: flexalign.spacearound, alignitems:itemalign.start }) { button(src) .onclick(() => { if (this.src == $rawfile('video1.mp4')) { this.src = $rawfile('video2.mp4') } else { this.src = $rawfile('video1.mp4') } }) .margin({bottom:10}) button(controls) .onclick(() => { this.controls = !this.controls }) button(play) .onclick(() => { this.myvideocontroller.start() }) button(pause) .onclick(() => { this.myvideocontroller.pause() }) button(stop) .onclick(() => { this.myvideocontroller.stop() }) .margin({bottom:10}) button(requestfullscreen) .onclick(() => { this.myvideocontroller.requestfullscreen(true) }) button(exitfullscreen) .onclick(() => { this.myvideocontroller.exitfullscreen() }) button(setcurrenttime) .onclick(() => { this.myvideocontroller.setcurrenttime(9) }) }.padding(15) } }.width('100%') }}
低功耗PC时钟发生器
贸泽开售Analog Devices用于卫星通信的 ADMV4540 K波段正交解调器
5G消息对金融行业的发展有什么影响?
美超微发布首个全新H12代A+服务器系列
探讨红外技术“芯”动态,畅谈传感技术“芯”未来
HarmonyOS应用开发例子-ets-video组件案例
三极管工作原理 3极管的三种工作状态判断方法
日本工业机器人业绩未达标的原因在于受贸易战影响
格力收购珠海银隆终止 董明珠造车梦碎!
基于TCP/IP通信服务的网络门禁系统的安装及方法
电科院公布公章鉴定结果:未造成不利影响
韩国业界正努力朝向存储器中心的运算迈进
PI3EQX1002BZLEX 中文规格及特征介绍
慧硕电子实现三个月主体结构封顶
阿里巴巴达摩院研发数学规划求解器,在国际评测排名第一
RT-DETR用114FPS实现54.8AP远超YOLOv8
买耳机送手机?三星s8开箱,良心配件!
Molex 发布 MXMag™ 千兆级单端口RJ45连接器
柔性屏幕的优点与未来挑战
深度解读车路协同是什么?