i’m using media player to display .m3u8 streaming in my application,
when pressing Home button ,,or when the screen Goes off..i want to pause the media then when the user return to it ..it start playing..
I tried onPause and onResume to pause and start the Media player..
But it Gives a nullPointerExc on the onResume Method.
i’m using media player to display .m3u8 streaming in my application, when pressing Home
Share
In onPause, save whatever metadata you need in order to reload the media into the MediaPlayer (file location, current position, etc).
In onResume, check the MediaPlayer instance for null. If it’s null, reload your media from this information. Where you save this data is up to you, but SharedPreferences is probably the easiest to get started with.