1import { 2 memo, 3 __memo_context_type, 4 __memo_id_type, 5 State, 6 StateDecoratedVariable, 7 MutableState, 8 stateOf, 9 observableProxy 10} from '@ohos.arkui.stateManagement' // should be insert by ui-plugins 11 12import { 13 Margin, 14 PlaybackSpeed, 15 Row, 16 RowOptions, 17 RowAttribute, 18 Text, 19 TextAttribute, 20 Column, 21 Component, 22 Button, 23 ButtonAttribute, 24 ClickEvent, 25 UserView, 26 NavDestination, 27 NavPathStack, 28 NavDestinationContext, 29 Callback, 30 $r, 31 VoidCallback, 32 ImageFit, 33 SeekMode, 34 PlaybackInfo, 35 FullscreenInfo, 36 PreparedInfo, 37 PixelMap, 38 Video, 39 VideoOptions, 40 VideoAttribute, 41 VideoController, 42 PlaybackSpeed 43} from '@ohos.arkui.component' // TextAttribute should be insert by ui-plugins 44 45import hilog from '@ohos.hilog' 46 47 48@Component 49export struct VideoTest { 50 private btnWidth: string = '40%'; 51 private btnHeight: number = 40; 52 private btnMargin: Margin = {top: 5, left: 10} as Margin; 53 private fontSize: number = 30; 54 controller: VideoController = new VideoController() 55 build() { 56 NavDestination() { 57 Column(undefined) { 58 Video({ 59 src: $r('app.media.trailer'), 60 previewUri: $r('app.media.startIcon'), 61 controller: this.controller, 62 } as VideoOptions) 63 .width('90%') 64 .height(400) 65 66 Row(undefined) { 67 Button('start') 68 .margin(this.btnMargin) 69 .width(this.btnWidth) 70 .height(this.btnHeight) 71 .fontSize(this.fontSize) 72 .onClick((e: ClickEvent) => { 73 this.controller.start(); 74 }) 75 Button('pause') 76 .margin(this.btnMargin) 77 .width(this.btnWidth) 78 .height(this.btnHeight) 79 .fontSize(this.fontSize) 80 .onClick((e: ClickEvent) => { 81 this.controller.pause(); 82 }) 83 } 84 85 Row(undefined) { 86 Button('stop') 87 .margin(this.btnMargin) 88 .width(this.btnWidth) 89 .height(this.btnHeight) 90 .fontSize(this.fontSize) 91 .onClick((e: ClickEvent) => { 92 this.controller.stop(); 93 }) 94 } 95 } 96 .width('100%') 97 } 98 .title('Video组件基础功能测试用例') 99 } 100} 101 102@Component 103struct Child { 104 @State stateVar: string = 'Child'; 105 build() { 106 Text(this.stateVar).fontSize(50) 107 } 108} 109