Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-11390

Released Media are not removed from Android's pausedForFocus or pausedForPhone lists, generating NullPointerException and crash.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 6.1.1
    • None
    • cordova-plugin-media
    • Mac OS X 10.11.5, Cordova 6.1.1, Cordova android 5.1.1, Nexus 5X running Android 6.0.1

    Description

      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:

      pausedForFocus.remove(audio);
      pausedForPhone.remove(audio);

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dalebeermann Dale Beermann
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: