Wayaer / fl_pip

flutter picture-in-picture plugin for ios and android
MIT License
27 stars 14 forks source link

iOS background - optional value force unwrapping issue #12

Open Dongkyu-ES opened 9 months ago

Dongkyu-ES commented 9 months ago

i follow almost guide and success to run Android / iOS application both.

but sometimes with this config, then ios main thread was break like this config -> const FlPiPiOSConfig( enabledWhenBackground: true, createNewEngine: true, enableControls: true, enablePlayback: true, path: 'assets/landscape.mp4', packageName: null));

and break point is here -> fl_pip/FlPiPPlugin.swift:240 Fatal error: Unexpectedly found nil while unwrapping an Optional value

so how about change like this ? https://github.com/Wayaer/fl_pip/blob/main/ios/Classes/FlPiPPlugin.swift#L240 self.pipController!.startPictureInPicture() -> self.pipController?.startPictureInPicture()

Dongkyu-ES commented 9 months ago

sorry it's hard to reproduce

maybe with new engine, and goes to background.

and close pip window, and wait some minutes then..(waiting in home or open other application)

스크린샷 2024-01-30 오전 11 53 26

so i found optional pipController was really helpful.