HarmonyOS鸿蒙Next中flutter打开web页面再跳转到视频播放页面会报错

HarmonyOS鸿蒙Next中flutter打开web页面再跳转到视频播放页面会报错 【问题描述】:目前使用webview_flutter 4.13.0_ohos和video_player-v2.10.0_ohos

测试发现如果打开web页面再跳转到视频播放页面会报错:

MissingPluginException(No implementation found for method listen on channel flutter.io/videoPlayer/videoEvents1)

不打开web页面不会触发这个问题,如果之前打开过web页面即使关闭了 再去打开视频播放也还是会有上述错误

【问题现象】:Launching lib/main.dart on 2MH0224525000393 in debug mode…

start hap build…

✓ Built build/ohos/hap/entry-default-signed.hap.

installing hap. bundleName: com.jrb.gymbo

waiting for a debug connection: http://127.0.0.1:51453/sueK1Ic2U58=/

Connecting to VM Service at ws://127.0.0.1:56614/ws

Connected to the VM Service.

════════ Exception caught by services library ══════════════════════════════════

The following MissingPluginException was thrown while activating platform stream on channel flutter.io/videoPlayer/videoEvents1:

MissingPluginException(No implementation found for method listen on channel flutter.io/videoPlayer/videoEvents1)

When the exception was thrown, this was the stack:

#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:332:7)

platform_channel.dart:332

<asynchronous suspension>

#1 EventChannel.receiveBroadcastStream.<anonymous closure> (package:flutter/src/services/platform_channel.dart:676:9)

platform_channel.dart:676

<asynchronous suspension>

【版本信息】:flutter3.27.4


更多关于HarmonyOS鸿蒙Next中flutter打开web页面再跳转到视频播放页面会报错的实战教程也可以访问 https://www.itying.com/category-92-b0.html

11 回复

开发者你好,问题已修复,请您升级video_player版本验证
https://gitcode.com/openharmony-tpc/flutter_packages/tree/br_video_player-v2.10.0_ohos

更多关于HarmonyOS鸿蒙Next中flutter打开web页面再跳转到视频播放页面会报错的实战系列教程也可以访问 https://www.itying.com/category-92-b0.html


本地flutter版本3.27.4,使用webview_flutter 4.13.0_ohos和video_player-v2.10.0_ohos 本地依赖时未复现报错问题;

开发者你好: 1、需要确认下你这边的两个插件是使用的线上依赖还是下载到本地依赖;

2、使用本地依赖场景是否会有问题。

使用的是线上依赖,和使用本地依赖有区别吗

开发者你好,目前问题正在进一步分析中,请耐心等待。

是不是没按文档正确配置插件啊

在HarmonyOS Next中,Flutter通过PlatformView嵌入WebView后跳转视频页面报错,通常因WebView与视频播放器共用图形渲染通道冲突,或Flutter与Ark UI层生命周期管理不一致。需在跳转前显式销毁WebView(如调用webViewController?.clearCache()dispose()),并确保视频播放使用原生Video组件而非Flutter插件。

这个问题是Flutter在HarmonyOS Next上的典型插件通道冲突。webview_flutter 使用平台视图时可能独占引擎资源或上下文,导致后续 video_player 初始化时无法正确注册其 MethodChannel,从而抛出 MissingPluginException。当前版本(webview_flutter 4.13.0_ohosvideo_player 2.10.0_ohos)存在兼容缺陷,平台通道在引擎切换后未恢复。可暂时规避:避免在相同页面或引擎实例中先后使用两者,或重启引擎重置通道。最终需等待插件更新适配。

回到顶部