进入应用时,一直停留在启动页,无法进入应用。
- 05-06 17:51:34.771 14900 14958 I C03F00/com.hx.example/ArkCompiler: [gc] SmartGC: app cold start just finished
- 05-06 17:51:32.867 14900 14900 I C01332/com.hx.example/UIAbility: [js_ui_ability.cpp:1568]JsUIAbility call js, name: onCreate
- 05-06 17:51:32.875 14900 14900 I C01332/com.hx.example/UIAbility: [js_ui_ability.cpp:1568]JsUIAbility call js, name: onWindowStageCreate
- 05-06 17:51:32.878 14900 14900 I C01332/com.hx.example/UIAbility: [js_ui_ability.cpp:1568]JsUIAbility call js, name: onForeground
- 05-06 17:51:36.143 14900 14900 I C01332/com.hx.example/UIAbility: [js_ui_ability.cpp:1568]JsUIAbility call js, name: onBackPressed
- 05-06 17:51:36.151 14900 14900 I C01332/com.hx.example/UIAbility: [js_ui_ability.cpp:1568]JsUIAbility call js, name: onBackground
- 05-06 17:51:36.881 14900 14900 I C01332/com.hx.example/UIAbility: [js_ui_ability.cpp:1568]JsUIAbility call js, name: onNewWant
- 05-06 17:51:36.882 14900 14900 I C01332/com.hx.example/UIAbility: [js_ui_ability.cpp:1568]JsUIAbility call js, name: onForeground
- 05-06 17:51:45.977 14900 14900 I C01332/com.hx.example/UIAbility: [js_ui_ability.cpp:1568]JsUIAbility call js, name: onBackground
- 05-06 17:51:49.731 14900 14900 I C01332/com.hx.example/UIAbility: [js_ui_ability.cpp:1568]JsUIAbility call js, name: onNewWant
- 05-06 17:51:49.738 14900 14900 I C01332/com.hx.example/UIAbility: [js_ui_ability.cpp:1568]JsUIAbility call js, name: onForeground
- 07-11 09:32:42.256 64899-64899 com.hx.example I video finish., %{public}s
启动页视频未播放结束就退出应用到后台,视频暂停,后续热启动视频不会继续播放,无法触发页面跳转逻辑,导致无法进入应用。
监听组件可见区域变化事件,在Video组件重新可见时继续播放视频。
- @Entry
- @Component
- export struct VideoPage {
- videoSrc: Resource = $rawfile('TestVideo.mp4'); // 替换为启动页视频
- controller : VideoController = new VideoController();
-
- build() {
- Column() {
- Video({
- src : this.videoSrc,
- controller: this.controller
- })
- .autoPlay(true)
- .loop(false)
- .objectFit(ImageFit.Contain)
- .onFinish(() => {
- // 此处执行页面跳转
- })
- .onVisibleAreaChange([0.0, 1.0], (isExpanding: boolean, currentRatio: number) => {
- // 当Video组件全部可见时,继续播放
- if (isExpanding || currentRatio >= 1.0) {
- console.info('Test Video is fully visible.');
- this.controller.start();
- }
- // 当Video组件不可见时,暂停播放
- if (!isExpanding && currentRatio <= 0.0) {
- console.info('Test Video is completely invisible.');
- this.controller.pause();
- }
- })
- }
- .height('100%')
- .width('100%')
- .justifyContent(FlexAlign.Center)
- }
- }
合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
解决方案
精准高效的一站式服务支持,助力开发者商业成功