cordovaionic-frameworkionic-view

Ionic - Pause/Stop Video on Navigating away from a view


Framework: IONIC
Consider I have two views A and B

View A contains list of videos.
On Clicking a video in View A, you will be navigated to View B.

Now the user plays the video and when navigating back to View A, the video doesn't stop playing. (The app will be in View A, but I can still hear the video playing in background)

Note: All the videos are embedded using iframe from youtube.
Any idea or suggestion on how this can be handled.


Solution

  • Found it myself!!

    Add cache-view="false" as an attribute to ion-view of your View B. This will prevent the video from playing back.

    <ion-view view-title="Videos" cache-view="false">