-1

Please, I wanna know how to prevent or stop video when the user eject the earphones from the device. Flutter

I tried to find a package for that. but i didn't found any package or solution

1 Answers1

0

you can listen on the headset events with this package and inside the listener check if the event is DISCONNECT then pause the video through videoController.pause()

Additional ref links:

Detecting whether a headset is plugged into an Android device or not.

omar hatem
  • 1,799
  • 1
  • 10
  • 23