Manual Player dismiss
You may want to dismiss the StoryPlayer on your own, without user interaction, for example on a back press event. To help you with that behavior, you have two options.
With StoryPlayer
The StoryPlayer object exposes:
- a isVisible property, indicating whether the player is currently displayed or not
- a dismiss() method, to force the play dismiss.
Example for a back press:
override fun onBackPressed() {
if (storyPlayer.isVisible) {
storyPlayer.dismiss()
} else {
super.onBackPressed()
}
}