GiraffePlayer2 icon indicating copy to clipboard operation
GiraffePlayer2 copied to clipboard

How to pause video when come back to the activity?

Open yangxu4536 opened this issue 6 years ago • 4 comments

i play video in a activity, and i pause the video when swith to other app. when i come back to my app, the video auto play. i want video to stay pause because i pause it when last leave.

yangxu4536 avatar May 24 '19 10:05 yangxu4536

In your base activity place this code in onPause() method

@Override public void onPause() { super.onPause(); try { if (PlayerManager.getInstance().getCurrentPlayer() != null) { PlayerManager.getInstance().getCurrentPlayer().onActivityPaused(); } } catch (Exception e) { e.printStackTrace(); } }

prakashmp avatar May 25 '19 10:05 prakashmp

I try it but not solve my problem, can you give more detail infomation?

yangxu4536 avatar May 28 '19 08:05 yangxu4536

when from back to front, the log are below: image

yangxu4536 avatar May 28 '19 08:05 yangxu4536

PlayerManager.getInstance().getCurrentPlayer().pause(); >> use this and check whether still audio in background or not ??

prakashmp avatar May 28 '19 11:05 prakashmp