diff --git "a/dsoftbus/OhOeCommunication/\345\210\206\345\270\203\345\274\217\350\275\257\346\200\273\347\272\277\351\200\232\344\277\241Demo.md" b/dsoftbus/OhOeCommunication/README.md.md similarity index 100% rename from "dsoftbus/OhOeCommunication/\345\210\206\345\270\203\345\274\217\350\275\257\346\200\273\347\272\277\351\200\232\344\277\241Demo.md" rename to dsoftbus/OhOeCommunication/README.md.md diff --git a/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/Application/AbilityStage.ts b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..1c9fcaafa50d6605b274c4a54a4b6225bc9bc1d0 --- /dev/null +++ b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/MainAbility/MainAbility.ts b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..f870382553ec44243fad1ac3a9b36fb22acb9d33 --- /dev/null +++ b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; diff --git a/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/common/model/constant.ets b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/common/model/constant.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c23b04b4e4208fd5d9e12e6a3c85224926684d8 --- /dev/null +++ b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/common/model/constant.ets @@ -0,0 +1,9 @@ +export const INTERVAL_DISTANCE = 5 + +export const INTERVAL_NUM = INTERVAL_DISTANCE + 1 + +export const IMAGE_OF_ROW = 5 + +export const AI_ANALYSIS_RESULT = 'AI分析结果' + +export const SITUATION_PERCEPTION_REALTIME = '实时事态感知' \ No newline at end of file diff --git a/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/common/model/imagesData.ets b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/common/model/imagesData.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb498b0658e42bebcf92ed6756c7fd3c2050e314 --- /dev/null +++ b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/common/model/imagesData.ets @@ -0,0 +1,47 @@ +import fileio from '@ohos.fileio' +import hilog from '@ohos.hilog'; + + +export default class ImageData { + getAIImageData(callback) { + //刚进入页面获取文件夹内容 + let dirPath = '/data/storage/el2/base/haps/entry/files/ai_analysis/' + let imageFiles = [] + hilog.info(0, "SoftBusClient", "[INFO] Start to get images form: %s", dirPath) + this.readImages(dirPath, imageFiles) + + hilog.info(0, "SoftBusClient", "[INFO] New imageFiles length: %d", imageFiles.length) + // return imageFiles + callback(imageFiles) + } + + getSituationImageData(callback) { + //刚进入页面获取文件夹内容 + let dirPath = '/data/storage/el2/base/haps/entry/files/situation_awareness/' + let imageFiles = [] + hilog.info(0, "SoftBusClient", "[INFO] Start to get images form: %s", dirPath) + this.readImages(dirPath, imageFiles) + + hilog.info(0, "SoftBusClient", "[INFO] New imageFiles length: %d", imageFiles.length) + // return imageFiles + callback(imageFiles) + } + + readImages(dirPath, imageFiles) { + let dir = fileio.opendirSync(dirPath); // dir 管理目录 + hilog.debug(0, "SoftBusClient", "[INFO] Read dir: %s", JSON.stringify(dir)) + this.inquireFiles(dirPath, dir, imageFiles); + } + + inquireFiles(dirPath, dir, imageFiles) { + let dirent = dir.readSync(); // 读取下一个目录项 + if (dirent && dirent.isFile()) { + let formatImageFile = "file://" + dirPath + dirent.name + hilog.debug(0, "SoftBusClient", "[INFO] Get images file: %s", formatImageFile) + imageFiles.push(formatImageFile) + this.inquireFiles(dirPath, dir, imageFiles); // 循环获取下一个目录 + } else { + dir.closeSync(); // 关闭目录,释放dir中的文件描述 + } + } +} diff --git a/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/common/model/screenInfo.ets b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/common/model/screenInfo.ets new file mode 100644 index 0000000000000000000000000000000000000000..59476af70e881b6285ea3c54943b0051095b1d7d --- /dev/null +++ b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/common/model/screenInfo.ets @@ -0,0 +1,28 @@ +import display from '@ohos.display' +import hilog from '@ohos.hilog'; +import { INTERVAL_NUM, INTERVAL_DISTANCE, IMAGE_OF_ROW } from '../../common/model/constant' + +export default class ScreenInfo { + //获取屏幕信息,获取屏幕尺寸 + getScreenInfo(callback) { + hilog.debug(0, "SoftBusClient", `[INFO] Start to obtain all the display`) + let displayClass = null + display.getAllDisplay((err, data) => { + if (err.code) { + hilog.error(0, "SoftBusClient", `[ERROR] Failed to obtain all the display objects: ${JSON.stringify(err)}`) + return; + } + + hilog.debug(0, "SoftBusClient", `[INFO] data = ${JSON.stringify(data)}`) + displayClass = data[0]; + hilog.debug(0, "SoftBusClient", `[INFO] displayClass = ${JSON.stringify(displayClass)}`) + let displayWidth = displayClass.width + hilog.info(0, "SoftBusClient", `[INFO] displayWidth = ${displayWidth}`) + let displayHeight = displayClass.height + hilog.info(0, "SoftBusClient", `[INFO] displayHeight = ${displayHeight}`) + let screenWidth = displayWidth > displayHeight ? displayHeight : displayWidth + callback((screenWidth - INTERVAL_DISTANCE * INTERVAL_NUM) / IMAGE_OF_ROW) + }) + } +} + diff --git a/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/pages/AIImages.ets b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/pages/AIImages.ets new file mode 100644 index 0000000000000000000000000000000000000000..4423d1c422ffe1fb3744afdbac90d80d19abe282 --- /dev/null +++ b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/pages/AIImages.ets @@ -0,0 +1,121 @@ +import hilog from '@ohos.hilog'; +import router from '@ohos.router'; +import ImageData from '../common/model/imagesData' +import ScreenInfo from '../common/model/screenInfo' +import { INTERVAL_DISTANCE, AI_ANALYSIS_RESULT } from '../common/model/constant' + + +@Entry +@Component +export default struct AIImages { + @State imageBgColor: ResourceStr = $r('app.color.transparent') + @State imageIsClick: boolean = false + @State imageIndex: number = 0 + @State photoData: Array = [] + private swiperController: SwiperController = new SwiperController() + private imageData: ImageData = new ImageData() + private screenInfo: ScreenInfo = new ScreenInfo() + + build() { + Stack() { + if (this.imageIsClick) { + Column() { + Swiper(this.swiperController) { + ForEach(this.photoData, (item: string) => { + Image(item).width('100%').height('100%') + .objectFit(ImageFit.Contain).padding(8) + .onClick(() => { + this.imageIsClick = false + }) + }, item => item) + } + .cachedCount(1) + .indicator(false) //是否开启导航点指示器,默认开启true + .index(this.imageIndex) + .loop(false) // 默认开启循环播放 + .duration(100) + .vertical(false) // 默认横向切换 + .itemSpace(0) + .curve(Curve.FastOutSlowIn) // 动画曲线 + .onChange((index: number) => { + console.info(index.toString()) + this.imageIndex = index + console.info(`ypt---Swiper index = ${index}`) + }) + } + .width('100%') + .height('100%') + .zIndex(6) + .backgroundColor(Color.White) + } + Grid() { + ForEach(this.photoData, item => { + GridItem() { + Image(item) + .objectFit(ImageFit.Cover) + .width('100%') + .height('12%') + .onClick(() => { + this.imageIsClick = true + this.imageIndex = this.photoData.indexOf(item) + console.info(`ypt---index = ${this.photoData.indexOf(item)}`) + }) + } + }) + } + .width('100%') + .height('90%') + .margin({ top: '10%' }) + .columnsTemplate('1fr 1fr 1fr 1fr') + .columnsGap(5) + .rowsGap(5) + .onScrollIndex((first: number) => { + console.info(first.toString()) + }) + .width('100%') + .height('90%') + + Row() { + Image($r('app.media.back')) + .width(32) + .height(32) + .borderRadius(32) + .objectFit(ImageFit.Cover) + .margin({ left: 8 }) + .backgroundColor(this.imageBgColor) + .onClick(() => { + this.imageBgColor = $r('app.color.transparent_grey') + router.back() + }) + } + .width('100%') + .height('8%') + .zIndex(3) + .offset({ y: '-45%' }) + .justifyContent(FlexAlign.Start) + } + } + + aboutToAppear() { + let self + self = this + //判断从哪来的 + let router_params = router.getParams() + if (router_params["from"] == AI_ANALYSIS_RESULT) { + //首次进入获取图片 + self.imageData.getAIImageData(callback => { + self.photoData = callback + self.photoData.reserve() + }) + } else { + self.imageData.getSituationImageData(callback => { + self.photoData = callback + self.photoData.reserve() + }) + } + } + + aboutToDisappear() { + router.clear() + } +} \ No newline at end of file diff --git a/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/pages/index.ets b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..6ee49669876d6e5365b88f34427a1d69b66b3a32 --- /dev/null +++ b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/pages/index.ets @@ -0,0 +1,335 @@ +import router from '@ohos.router'; +import prompt from '@ohos.prompt'; +import hilog from '@ohos.hilog'; +import softbus_client_run from 'libsoftbus_client_run.so' +import { AI_ANALYSIS_RESULT, SITUATION_PERCEPTION_REALTIME } from '../common/model/constant' + +var thisOld + +@Entry +@Component +struct Index { + @State sessionServerInitState: string = "null" + @State sessionConnectState: string = "null" + @State sendDataState: string = '' + @State pictureFile: string = '' + @State hasNewAIImage: boolean = false + @State hasNewSAImage: boolean = false + @State isLoading: boolean = false + @State deviceInfoArray: Array = [] + @State deviceIndex: number = undefined + + callbackPictureSave(fileName) { + hilog.info(0, "SoftBusClient", "[INFO] Image file received: %s", fileName) + if (fileName.search("ai_analysis") != -1) { + thisOld.hasNewAIImage = true + } else { + if (fileName.search("situation_awareness") != -1) { + thisOld.hasNewSAImage = true + } + } + } + + build() { + Stack() { + Column() { + Row() { + if (thisOld.hasNewAIImage) { + Text($r('app.string.hasNewImage')) + .fontSize(16) + .fontColor($r('app.color.white')) + .onClick(() => { + thisOld.hasNewAIImage = false + router.push({ + url: 'pages/AIImages', + params: { "from": AI_ANALYSIS_RESULT } + }) + }) + } + if (thisOld.hasNewSAImage) { + Text($r('app.string.hasNewSAImage')) + .fontSize(16) + .fontColor($r('app.color.white')) + .onClick(() => { + thisOld.hasNewSAImage = false + router.push({ + url: 'pages/AIImages', + params: { "from": SITUATION_PERCEPTION_REALTIME } + }) + }) + } + } + .justifyContent(FlexAlign.Center) + .width('100%') + .height('8%') + .padding(10) + .backgroundColor($r('app.color.transparent_grey')) + + Row() { + Button({ type: ButtonType.Circle, stateEffect: true }) { + if (this.isLoading) { + LoadingProgress() + .color(Color.White) + .width(70) + .height(70) + } else { + Image($r('app.media.refresh')) + .width(48) + .height(48) + .objectFit(ImageFit.Fill) + } + } + .width(64).height(64) + .backgroundColor($r('app.color.transparent')) + .onClick(() => { + this.isLoading = true + this.deviceInfoArray.length = 0 + this.deviceIndex = undefined + this.sessionConnectState = softbus_client_run.sessionConnect() + this.isLoading = false + this.parseDeviceInfo(this.sessionConnectState) + }) + } + .width('90%') + .height('8%') + .justifyContent(FlexAlign.Start) + + Column() { + Text('终端:' + this.deviceInfoArray.length.toString()) + .fontColor($r('app.color.white')) + .fontSize(16) + List() { + ForEach(this.deviceInfoArray, (items) => { + ListItem() { + Row() { + Column() { + Image($r('app.media.phone')) + .width(42) + .height(42) + .objectFit(ImageFit.Cover) + .onClick(() => { + this.deviceIndex = this.deviceInfoArray.indexOf(items) + }) + Text(items[0]).maxLines(2).fontColor($r('app.color.white')) + .fontSize(16) + .textAlign(TextAlign.Center) + .margin({ left: 12 }) + } + + if (this.deviceIndex == this.deviceInfoArray.indexOf(items)) { + Text(items[1]) + .fontColor($r('app.color.white')) + .fontSize(20) + .textAlign(TextAlign.Start) + .margin({ left: 12 }) + } + } + .width('100%') + .margin(8) + } + }) + }.padding(2).height('82%') + } + .alignItems(HorizontalAlign.Start) + .margin({ top: 20 }) + .width('72%') + .height('48%') + + Row() { + Column() { + Text('无人机控制:') + .fontSize(24) + .margin(5) + .fontColor($r('app.color.white')) + Button($r('app.string.UAV_take_off'), { type: ButtonType.Normal }) + .borderRadius(8) + .fontSize(24) + .height('18%') + .width('60%') + .backgroundColor($r('app.color.button_color')) + .margin(5) + .onClick(() => { + let sendResult = softbus_client_run.sendData("UAV", "takeoff", 7) + if (sendResult == 0) { + this.sendDataState = "Send Successful" + } else { + this.sendDataState = "Send Failed" + } + prompt.showToast({ + message: this.sendDataState, + bottom: '20px' + }) + }) + Button($r('app.string.UAV_hover'), { type: ButtonType.Normal }) + .borderRadius(8) + .fontSize(24) + .height('18%') + .width('60%') + .backgroundColor($r('app.color.button_color')) + .margin(5) + .onClick(() => { + let sendResult = softbus_client_run.sendData("UAV", "hover", 5) + if (sendResult == 0) { + this.sendDataState = "Send Successful" + } else { + this.sendDataState = "Send Failed" + } + prompt.showToast({ + message: this.sendDataState, + bottom: '20px' + }) + }) + Button($r('app.string.UAV_land'), { type: ButtonType.Normal }) + .borderRadius(8) + .fontSize(24) + .height('18%') + .width('60%') + .backgroundColor($r('app.color.button_color')) + .margin(5) + .onClick(() => { + let sendResult = softbus_client_run.sendData("UAV", "land", 4) + if (sendResult == 0) { + this.sendDataState = "Send Successful" + } else { + this.sendDataState = "Send Failed" + } + prompt.showToast({ + message: this.sendDataState, + bottom: '20px' + }) + }) + } + .justifyContent(FlexAlign.SpaceEvenly) + .width('50%') + .height('100%') + + Column() { + Text('机器狗控制:') + .fontSize(24) + .margin(5) + .fontColor($r('app.color.white')) + Button($r('app.string.Robot_dog_up'), { type: ButtonType.Normal }) + .borderRadius(8) + .fontSize(24) + .height('18%') + .width('30%') + .backgroundColor($r('app.color.button_color')) + .margin(5) + .onClick(() => { + let sendResult = softbus_client_run.sendData("Robot_dog", "forward", 7) + if (sendResult == 0) { + this.sendDataState = "Send Successful" + } else { + this.sendDataState = "Send Failed" + } + prompt.showToast({ + message: this.sendDataState, + bottom: '20px' + }) + }) + Row() { + Button($r('app.string.Robot_dog_left'), { type: ButtonType.Normal }) + .borderRadius(8) + .fontSize(24) + .height('60%') + .width('30%') + .backgroundColor($r('app.color.button_color')) + .margin(5) + .onClick(() => { + let sendResult = softbus_client_run.sendData("Robot_dog", "left", 4) + if (sendResult == 0) { + this.sendDataState = "Send Successful" + } else { + this.sendDataState = "Send Failed" + } + prompt.showToast({ + message: this.sendDataState, + bottom: '20px' + }) + }) + Button($r('app.string.Robot_dog_right'), { type: ButtonType.Normal }) + .borderRadius(8) + .fontSize(24) + .height('60%') + .width('30%') + .backgroundColor($r('app.color.button_color')) + .margin(5) + .onClick(() => { + let sendResult = softbus_client_run.sendData("Robot_dog", "right", 5) + if (sendResult == 0) { + this.sendDataState = "Send Successful" + } else { + this.sendDataState = "Send Failed" + } + prompt.showToast({ + message: this.sendDataState, + bottom: '20px' + }) + }) + } + .justifyContent(FlexAlign.SpaceEvenly) + .width('100%') + .height('30%') + Button($r('app.string.Robot_dog_down'), { type: ButtonType.Normal }) + .borderRadius(8) + .fontSize(24) + .height('18%') + .width('30%') + .backgroundColor($r('app.color.button_color')) + .margin(5) + .onClick(() => { + let sendResult = softbus_client_run.sendData("Robot_dog", "backward", 8) + if (sendResult == 0) { + this.sendDataState = "Send Successful" + } else { + this.sendDataState = "Send Failed" + } + prompt.showToast({ + message: this.sendDataState, + bottom: '20px' + }) + }) + } + .justifyContent(FlexAlign.SpaceEvenly) + .width('50%') + .height('100%') + } + .height('34%') + .width('100%') + .justifyContent(FlexAlign.SpaceEvenly) + .padding({ bottom: 8 }) + .backgroundColor('#07309E') + } + .width('100%') + .height('100%') + .backgroundImage($r('app.media.background')) + .backgroundImageSize({ width: '100%', height: '75%' }) + } + } + + aboutToAppear() { + //进入页面初始化 + thisOld = this + this.sessionServerInitState = softbus_client_run.sessionServerInit(this.callbackPictureSave) + prompt.showToast({ + message: this.sessionServerInitState, + bottom: '20px' + }) + } + + aboutToDisappear() { + //关闭 + softbus_client_run.sessionDisconnect() + } + + parseDeviceInfo(deviceInfo: string) { + let deviceInfoArrayTemp = deviceInfo.split(';') + deviceInfoArrayTemp.pop() + deviceInfoArrayTemp.forEach(element => { + let startIndex = element.indexOf(': ') + let endIndex = element.indexOf('\nipAddress') + let deviceName = element.substring(startIndex + 1, endIndex) + this.deviceInfoArray.push([deviceName, element]) + }); + } +} \ No newline at end of file diff --git a/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/pages/videoPlay.ets b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/pages/videoPlay.ets new file mode 100644 index 0000000000000000000000000000000000000000..65fc09e1693abbf3f6ede9d692c4c285048ad526 --- /dev/null +++ b/dsoftbus/OhOeCommunication/softbus_client_sample/entry/src/main/ets/pages/videoPlay.ets @@ -0,0 +1,102 @@ +import router from '@ohos.router'; +import hilog from '@ohos.hilog'; + + +@Entry +@Component +export default struct VideoPlay { + @State imageBgColor: ResourceStr = $r('app.color.transparent') + @State muted: boolean = false + @State autoPlay: boolean = true + @State controls: boolean = true //控制栏 + myVideoController: VideoController = new VideoController() + @State pause: boolean = false + + build() { + //操作 + Column() { + Row() { + Image($r('app.media.back')) + .width(32) + .height(32) + .borderRadius(32) + .objectFit(ImageFit.Cover) + .margin({ left: 8 }) + .backgroundColor(this.imageBgColor) + .onClick(() => { + this.imageBgColor = $r('app.color.transparent_grey') + router.back() + }) + } + .width('100%') + .height('6%') + .backgroundColor($r('app.color.transparent_grey')) + .justifyContent(FlexAlign.Start) + + Video({ + src: $rawfile('fire_detection.mp4'), // 视频播放源的路径 + controller: this.myVideoController // 控制器 + }) + .muted(this.muted) // 是否静音 + .autoPlay(this.autoPlay) // 是否自动播放 + .controls(this.controls) // 控制视频播放的控制栏是否显示 + .objectFit(ImageFit.Contain) // 视频显示模式 + .loop(false) // 是否单个视频循环播放 + .width('100%') + .aspectRatio(1.33) + .onClick(() => { + //点击视频调出控制栏 + this.controls = !this.controls + }) + .onStart(() => { + // 播放时触发该事件 + hilog.info(0, "SoftBusClient", "[INFO] the video start play") + }) + .onPause(() => { + // 暂停时触发该事件 + hilog.info(0, "SoftBusClient", "[INFO] [INFO] the video pause play") + }) + .onFinish(() => { + // 播放结束时触发该事件 + }) + + Row() { + Button({ type: ButtonType.Circle }) { + Image(this.pause ? $r('app.media.play_circle') : $r('app.media.pause_circle')) + } + .height('60%') + .backgroundColor($r('app.color.transparent_grey')) + .onClick(() => { + this.pause = !this.pause + this.pause ? this.myVideoController.pause() : this.myVideoController.start() + }) + + Button({ type: ButtonType.Circle }) { + Image($r('app.media.full_screen')).rotate({ + angle: -45 + }) + } + .height('60%') + .backgroundColor($r('app.color.transparent_grey')) + .onClick(() => { + this.myVideoController.requestFullscreen(true) + }) + } + .justifyContent(FlexAlign.SpaceBetween) + .width('100%') + .height('8%') + .backgroundColor($r('app.color.transparent_grey')) + } + .width('100%') + .height('100%') + } + + aboutToAppear() { + //进入之后就全屏播放 + this.myVideoController.start() + } + + aboutToDisappear() { + router.clear(); + } +} \ No newline at end of file