Dale Beermann created CB-11390:
----------------------------------

             Summary: Released Media are not removed from Android's 
pausedForFocus or pausedForPhone lists, generating NullPointerException and 
crash.
                 Key: CB-11390
                 URL: https://issues.apache.org/jira/browse/CB-11390
             Project: Apache Cordova
          Issue Type: Bug
    Affects Versions: 6.1.1
         Environment: Mac OS X 10.11.5, Cordova 6.1.1, Cordova android 5.1.1, 
Nexus 5X running Android 6.0.1
            Reporter: Dale Beermann


When changing views, the {{AudioHandler}} receives {{onAudioFocusChange}} and 
adds all running media to a {{pausedForFocus}} list. With Angular, a 
controller's life cycle might not exactly match what Android is seeing for this 
event (I'm a bit unclear on how the focus change events are fired). So if that 
media object is later released, it needs to be removed from those lists in 
{{AudioHandler.release}}:

{quote}
pausedForFocus.remove(audio);
pausedForPhone.remove(audio);
{quote}

If this does not happen, the {{AudioHandler}} receives another 
{{onAudioFocusChange}} event and calls {{resumeAllGainedFocus}} which calls 
{{AudioPlayer.startPlaying}} with a {{null}} file, in turn calling 
{{readyPlayer(null)}}, causing a NullPointerException and crash at the line:

{{if (this.audioFile.compareTo(file) == 0)}}

There might be a root cause here that I am missing, but this displays the 
symptom I am seeing. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to