magicbaby810 / HotfixFlutter

使用Tinker或Sophix实现Flutter热更新,兼容flutterboost
400 stars 51 forks source link

在使用video_player库的时候报错 #4

Closed aluo44 closed 4 years ago

aluo44 commented 4 years ago

按照你的教程实现了热更新,但是在引入视频库之后就会报错,无法播放视频 测试手机: 华为P10 测试视频库: flutter_ijkplayer , fijkplayer, video_player 测试时间: 2020-07-30 flutter doctor -v如下: `[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.5 19F96, locale zh-Hans-CN) • Flutter version 1.12.13+hotfix.9 at /Users/cp/flutter • Framework revision f139b11009 (4 months ago), 2020-03-30 13:57:30 -0700 • Engine revision af51afceb8 • Dart version 2.7.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0) • Android SDK at /Users/cp/androidSDK • Android NDK location not configured (optional; useful for native profiling support) • Platform android-30, build-tools 30.0.0 • ANDROID_HOME = /Users/cp/androidSDK • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593) • All Android licenses accepted.`

报错信息: `2020-07-30 11:12:08.452 6331-6892/com.sk.hotfixflutter E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null)

0 VideoPlayerApi.initialize (package:video_player_platform_interface/messages.dart:220:7)

<asynchronous suspension>
#1      MethodChannelVideoPlayer.init (package:video_player_platform_interface/method_channel_video_player.dart:20:17)
#2      _videoPlayerPlatform (package:video_player/video_player.dart:23:5)
#3      _videoPlayerPlatform (package:video_player/video_player.dart:20:27)
#4      VideoPlayerController.initialize (package:video_player/video_player.dart:265:24)
#5      _VideoPageState.initState (package:test1/video.dart:21:9)
#6      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4355:58)
#7      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
#8      Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
#9      Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
#10     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
#11     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
#12     Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
#13     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
#14     Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
#15     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
#16     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
#17     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
#18     Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
#19     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
#20     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
#21     Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
#22     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
#23     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
#24     Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
#25     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
#26     Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
#27     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
#28     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11)
#29     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
#30     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
#31     Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
#32     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
#33     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
#34     Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
#35     SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:5445:14)
#36     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
#37     Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
#38     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4243:16)
#39     Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5)
#40     ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:4206:5)
#41     StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4381:11)
#42     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4201:5)
#43     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3194:14)
#44     Element.updateChild (package:flutter/src/widgets/framework.dart:2988:12)
#45     ComponentElemen`
magicbaby810 commented 4 years ago

这个跟hotfix没关系吧,老铁 你先看下methodchannel是怎么使用的,再看下method_channel_video_player.dart这个类怎么使用的。 上面报错提示的很清楚了,我帮你定位下问题

class MethodChannelVideoPlayer extends VideoPlayerPlatform {
  @override
  Future<void> init() {
    return _channel.invokeMethod<void>('init');
  }
ETListener commented 4 years ago

这个跟hotfix没关系吧,老铁 你先看下methodchannel是怎么使用的,再看下method_channel_video_player.dart这个类怎么使用的。 上面报错提示的很清楚了,我帮你定位下问题

class MethodChannelVideoPlayer extends VideoPlayerPlatform {
  @override
  Future<void> init() {
    return _channel.invokeMethod<void>('init');
  }

你好,我这边遇到与上面类似的问题,不过没有引入hotfix; 这个methodchannel是由video_player中 VideoPlayerController 调用 initialize 时出现的问题,想问一下题主如今是否解决,以及你这边是否有其他思路。谢谢