blonsky95 / TimeStopperAndroid

0 stars 0 forks source link

bug - black screen when app is on background #41

Closed blonsky95 closed 3 years ago

blonsky95 commented 3 years ago

Detect when exoplayer has removed resources and put a black screen, and put the start fragment again

blonsky95 commented 3 years ago

Added a boolean called hasMediaLoaded

It is default false, and set to true when onresult of media selected, or when coming from implicit intent.

Sets to false when on backpressed and user is prompted to leave current video. (Or app is closed and therefore it will be reinitialised to false.

If the app is reentered before closed, if back was pressed it will be on start fragment, if not it will go to onresume, in which it checks if isMediaLoaded is true, if it is and the video is still there then fine, but if not then its probably black and meets the condition:

     if (hasMediaLoaded && exoPlayer?.currentMediaItem == null)

should be true so here it triggers the toast to pair the dark screen - if works then get the start fragment