albemala / native_video_player

A Flutter widget to play videos on iOS and Android using a native implementation.
MIT License
14 stars 12 forks source link

please add dispose #8

Open tudosxxx opened 1 year ago

tudosxxx commented 1 year ago

Can you add the dispose method? Such a one by one removal is very troublesome, and there will still be errors nativeVideoPlayerController?.stop(); nativeVideoPlayerController?.onPlaybackPositionChanged.removeListener(() { }); nativeVideoPlayerController?.onPlaybackReady.removeListener(() { }); nativeVideoPlayerController?.onPlaybackEnded.removeListener(() { }); nativeVideoPlayerController== null;

W/MediaPlayer(12403): mediaplayer went away with unhandled events E/flutter (12403): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method getPlaybackPosition on channel me.albemala.native_video_player.api.0) E/flutter (12403): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:313:7) E/flutter (12403): E/flutter (12403): #1 NativeVideoPlayerController._onPlaybackPositionTimerChanged (package:native_video_player/src/native_video_player_controller.dart:229:22) E/flutter (12403): E/flutter (12403): #2 NativeVideoPlayerController.stop (package:native_video_player/src/native_video_player_controller.dart:149:5) E/flutter (12403): E/flutter (12403):

I don't know if this is correct or not, but I don't like the simple command of writing a separate method. There is no method name in all remove

tudosxxx commented 1 year ago
  1. refresh will be replay, The video will flash once and then start playing again