I'm trying to display a video within my application. I've created a link to it such:
<a href="movie/my_movie.mp4">Start movie</a>
Everything is fine and the video spins up, but when I push the back button the nav state is resetted and I have to restart my app in order to get back to the "main" page of my app. Is there any trick to maintain the nav state when starting my video?
Yes There is trick you can use the below code in your back button listener
below is the example for your reference you can adjust it by getting the status of your media player like mediaplayer.isPlaying()
final MediaPlayer mp1 = MediaPlayer.create(PlayaudioActivity.this, R.raw.beet);
mBackBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mp1.isPlaying()) {
}else{
finish();
}
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With