Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic nav-view and external resource

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?

like image 519
Burbas Avatar asked Jul 27 '15 12:07

Burbas


1 Answers

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();
                 }


            }

        });
like image 189
kuljeet singh Avatar answered Oct 27 '22 00:10

kuljeet singh