toro icon indicating copy to clipboard operation
toro copied to clipboard

[Feature Request] Make Player attached to lifecycle

Open shivamsoods opened this issue 4 years ago • 2 comments

Feature Request

Despite the player working seamlessly it still goes on playing in the background even when the screen is off. The toro widget container could be attached to the lifecycle of the activity/fragment.

The toro player lifecycle should be attached to the activity/fragment and lifecycle states should decide whether to play or pause or release the player.

I tried to control the playback of the player from the Toro Container from the Activity but I was not able to modify the container in the onPause and onResume state of the activity.

shivamsoods avatar May 01 '20 09:05 shivamsoods

@shivamsoods You can archive the behavior by manually observing the lifecycle change, and then update the PlayerSelector accordingly: a PlayerSelector that selects nothing if the lifecycle is paused or stopped or anything of your choice, and a default PlayerSelector that selects one player otherwise.

eneim avatar Jun 30 '20 13:06 eneim

Okay. I'll try it out and see if i am able to implement it. Thanks

shivamsoods avatar Jul 01 '20 08:07 shivamsoods