
Android- Not able to Play audio in background service (startForeground) from the provided sample
Hello
From the answer provided on query (Android - Play audio in background service (startForeground))
https://support.jwplayer.com/customer/en/portal/questions/17032020-android-play-audio-in-background-service-startforeground-?
Want to add more details on this to get clarification.
Member from JW team provided sample source (http://qa.jwplayer.com.s3.amazonaws.com/~george/BackgroundAudioService.zip) from the above link you can check details.
By using sample code from the given link I am getting crash from jwplayerview class and here I've given link for the crash log
https://gist.github.com/adneerav/853af0cc717ead6b16eec443c7eb9145
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.longtailvideo.jwplayer.c.g.a(boolean)' on a null object reference
What else I tried... ?
Removed mPlayerView.onPause(); from onPause method of activity where its giving NPE. and also make some changes to bind and start service.
VideoAcitivity
https://gist.github.com/adneerav/dd822d42cf5e5164259e3b117a082646
Foreground service
https://gist.github.com/adneerav/f76bac3d8f6904f59938b23f7a7a58fc
Here application is not crashing & Service starting in foreground also,but after playing audio in service and if reopen the app after that Player's pause & play method is not functioning from service.
Steps to reproduce Play and pause method not responding.
1)Play Audio from activity
2)Exit from application
3)Play & pause from notification (in this it will work)
4)Open application from notification tap or from launcher icon
5)Repeat Step 4 here(Play button from notification not responding)
Please provide details on above and guide on what I am missing or doing wrong. So I can proceed with the next process.
Thanks