我实现了一个 YouTube 播放器 flutter 包,但在尝试播放视频时,它不断返回平台异常,并在框架上显示圆形进度指示器。
这是错误 VERBOSE-2:dart_vm_initializer.cc(41)] 未处理的异常:PlatformException(unregistered_view_type,UIKitView 小部件正在尝试创建具有未注册类型的 PlatformView:< com.pichillilorenzo/flutter_inappwebview >,如果您是 PlatformView 的作者,请确保调用
registerViewFactory
。
请参阅:https://docs.flutter.dev/development/platform-integration/platform-views#on-the-platform-side-1了解更多详细信息。
如果您不是 PlatformView 的作者,请务必调用 GeneratedPluginRegistrant.register
., null)
#0 StandardMethodCodec.decodeEnvelope (包:flutter/src/services/message_codecs.dart:652:7)
#1 MethodChannel._invokeMethod (包:flutter/src/services/platform_channel.dart:310:18)
#2 PlatformViewsService.initUiKitView (包:flutter/src/services/platform_views.dart:242:5)
#3 _UiKitViewState._createNewUiKitView (包:flutter/src/widgets/platform_view.dart:649:44)
在网上搜索有人说将以下 io.flutter.embedded_views_preview NSAllowsArbitraryLoads 添加到 info.plist 有效,但我尝试了,但不起作用。旁注,我正在 iPhone 模拟器上测试
软件包 Youtube Player Flutter 仅支持 Android 和 ios https://pub.dev/packages/youtube_player_flutter
如果您也想使用网络,则应该使用 Youtube Player IFrame https://pub.dev/packages/youtube_player_iframe