abdelaziz-mahdy / flutter_meedu_videoplayer

Cross-Platform Video Player for flutter
https://abdelaziz-mahdy.github.io/flutter_meedu_videoplayer/
MIT License
132 stars 69 forks source link

I think it would be better to add a function switch that can still continue playing in the background #108

Closed JieNengi closed 11 months ago

JieNengi commented 1 year ago

I am trying to modify and implement this switch😢

abdelaziz-mahdy commented 1 year ago

U can use pip? On Android at least , it's not supported yet on iOS

JieNengi commented 1 year ago

U can use pip? On Android at least , it's not supported yet on iOS

like music play, not pip.When the application is in the background, it can still continue playing

abdelaziz-mahdy commented 1 year ago

U can use pip? On Android at least , it's not supported yet on iOS

like music play, not pip.When the application is in the background, it can still continue playing

I think for music you would need another package, since this package is only for video playing

But will check if video_player allows background playback and if it allows I will let you know

abdelaziz-mahdy commented 1 year ago

U can use pip? On Android at least , it's not supported yet on iOS

like music play, not pip.When the application is in the background, it can still continue playing

I think for music you would need another package, since this package is only for video playing

But will check if video_player allows background playback and if it allows I will let you know

they do allow, but its from flutter side , so the app can be closed by the system

i dont recommend it in that case, i recommend either pip or a dedicated music player

Goshin commented 1 year ago

It would be nice to have this feature. Like YouTube, it comes with the PIP mode, but it also allows you to play in the background when you lock the screen or close the pip floating window.

Regarding keeping the app running in the background, it uses a foreground service to show a notification with some player controls and to keep itself running without being killed, but I guess this can be implemented in a later stage.

abdelaziz-mahdy commented 1 year ago

It would be nice to have this feature. Like YouTube, it comes with the PIP mode, but it also allows you to play in the background when you lock the screen or close the pip floating window.

Regarding keeping the app running in the background, it uses a foreground service to show a notification with some player controls and to keep itself running without being killed, but I guess this can be implemented in a later stage.

I think media_kit will be able/ will want to add this feature, since I can't implement it from my side

Goshin commented 1 year ago

video_player has the option to control this. You don't have to implement this from scratch, but just expose the setting in meedu_videoplayer. https://pub.dev/documentation/video_player_platform_interface/latest/video_player_platform_interface/VideoPlayerOptions/allowBackgroundPlayback.html

abdelaziz-mahdy commented 1 year ago

video_player has the option to control this. You don't have to implement this from scratch, but just expose the setting in meedu_videoplayer. https://pub.dev/documentation/video_player_platform_interface/latest/video_player_platform_interface/VideoPlayerOptions/allowBackgroundPlayback.html

It's from flutter side not using a platform native, which means no notification, and system can close it at anytime

If that's what you feel you need open a pr and I will happily merge it

Goshin commented 1 year ago

I think the concern about being killed by the system might be a bit out of the scope of a widget. Developers can have their own methods to keep the app alive in background based on their needs.

Anyway, it is just my thought. It is up to you to decide.

abdelaziz-mahdy commented 1 year ago

I think the concern about being killed by the system might be a bit out of the scope of a widget. Developers can have their own methods to keep the app alive in background based on their needs.

Anyway, it is just my thought. It is up to you to decide.

I believe a platform way of handling it is much better, but I use video_player and media_kit and wrap them with my controls

And media_kit is releasing the cross platform release soon, so I think having each platform having native code for background playback will be much better than a half working solution