[ 
https://issues.apache.org/jira/browse/CB-12157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15852722#comment-15852722
 ] 

ASF GitHub Bot commented on CB-12157:
-------------------------------------

Github user ghenry22 commented on the issue:

    https://github.com/apache/cordova-plugin-media/pull/122
  
    So I have started to encounter the problem this fixes recently.  Using 
runkeeper along with my music app runkeeper will take the audio focus for it's 
announcements.  If it happens to do this just as your media is being released 
or created then when it hands the focus back the app will fail as it will call 
play on a media that wasn't successfully created.
    
    Would be good to get this merged as it has resolved this issue for me on 
Android with no side effects that I have noticed.


> audio.startPlaying(null) causes NullPointerException
> ----------------------------------------------------
>
>                 Key: CB-12157
>                 URL: https://issues.apache.org/jira/browse/CB-12157
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Media
>    Affects Versions: Master
>         Environment: android
>            Reporter: Frank Koenigstein
>              Labels: Android
>             Fix For: Master
>
>
> When AudioHandler.resumeAllGainedFocus is called it calls each AudioPlayer 
> with startPlaying(null). That causes a NullPointerException:
> {code}
> 11-16 16:13:11.071 E/AndroidRuntime(30650): FATAL EXCEPTION: JavaBridge
> 11-16 16:13:11.071 E/AndroidRuntime(30650): java.lang.NullPointerException
> 11-16 16:13:11.071 E/AndroidRuntime(30650):     at 
> org.apache.cordova.media.AudioPlayer.readyPlayer(AudioPlayer.java:583)
> 11-16 16:13:11.071 E/AndroidRuntime(30650):     at 
> org.apache.cordova.media.AudioPlayer.startPlaying(AudioPlayer.java:299)
> 11-16 16:13:11.071 E/AndroidRuntime(30650):     at 
> org.apache.cordova.media.AudioHandler.resumeAllGainedFocus(AudioHandler.java:414)
> 11-16 16:13:11.071 E/AndroidRuntime(30650):     at 
> org.apache.cordova.media.AudioHandler$1.onAudioFocusChange(AudioHandler.java:431)
> 11-16 16:13:11.071 E/AndroidRuntime(30650):     at 
> android.media.AudioManager$FocusEventHandlerDelegate$1.handleMessage(AudioManager.java:2044)
> 11-16 16:13:11.071 E/AndroidRuntime(30650):     at 
> android.os.Handler.dispatchMessage(Handler.java:102)
> 11-16 16:13:11.071 E/AndroidRuntime(30650):     at 
> android.os.Looper.loop(Looper.java:136)
> 11-16 16:13:11.071 E/AndroidRuntime(30650):     at 
> android.os.HandlerThread.run(HandlerThread.java:61)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to