1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import emitter from "@ohos.events.emitter" 17 18@Entry 19@Component 20struct SubWindowPage { 21 SUB_WINDOW_INNER_EVENT_ID: number = 1001 22 videoController: VideoController = new VideoController() 23 24 build() { 25 Column() { 26 Video({ 27 src: $rawfile('video.mp4'), 28 currentProgressRate: PlaybackSpeed.Speed_Forward_1_00_X, 29 controller: this.videoController 30 }) 31 .width(400) 32 .height(250) 33 .margin(5) 34 .loop(false) 35 .muted(false) 36 .controls(true) 37 .autoPlay(true) 38 .onTouch((event: TouchEvent) => { 39 let eventData = { 40 data: { 41 "x": event.touches[0].x, 42 "y": event.touches[0].y, 43 } } 44 let innerEvent = { 45 eventId: this.SUB_WINDOW_INNER_EVENT_ID, 46 priority: emitter.EventPriority.HIGH 47 } 48 emitter.emit(innerEvent, eventData) 49 }) 50 } 51 .width('100%').height('100%') 52 } 53}