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

Plugin Media :app crashed when a telephone call come in if app is playing mp3.

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.0
    • None
    • cordova-plugin-media
    • None
    • android 4.4/6.0.1,cordova 6.2.0

    • Important

    Description

      app crashed when a telephone call come in if app is playing mp3.

      following lines are exception info in logcat :

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: FATAL EXCEPTION: main

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: Process: com.sin360.icolor, PID: 23393

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: java.lang.RuntimeException: Error receiving broadcast Intent

      { act=android.intent.action.PHONE_STATE flg=0x10 (has extras) }

      in org.apache.cordova.CoreAndroid$5@ea96372

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:934)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:815)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:104)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at android.os.Looper.loop(Looper.java:207)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5701)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:749)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: Caused by: java.lang.NullPointerException: rhs == null

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at java.lang.String.compareTo(Native Method)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at org.apache.cordova.media.AudioPlayer.readyPlayer(AudioPlayer.java:492)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at org.apache.cordova.media.AudioPlayer.startPlaying(AudioPlayer.java:217)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at org.apache.cordova.media.AudioHandler.onMessage(AudioHandler.java:199)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at org.apache.cordova.PluginManager.postMessage(PluginManager.java:312)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at org.apache.cordova.CoreAndroid$5.onReceive(CoreAndroid.java:298)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:924)

      07-30 16:53:39.932 23393 23393 E AndroidRuntime: ... 7 more

      Attachments

        Issue Links

          Activity

            kerrishotts Kerri Shotts added a comment -

            Thanks for the report. It would be nice if you could link to a sample app that duplicates the issue that you are seeing so that we can duplicate it on our ends as well.

            kerrishotts Kerri Shotts added a comment - Thanks for the report. It would be nice if you could link to a sample app that duplicates the issue that you are seeing so that we can duplicate it on our ends as well.
            githubbot ASF GitHub Bot added a comment -

            GitHub user alsorokin opened a pull request:

            https://github.com/apache/cordova-plugin-media/pull/107

            CB-11655 (Android) Enabled asynchronous error handling

            <!--
            Please make sure the checklist boxes are all checked before submitting the PR. The checklist
            is intended as a quick reference, for complete details please see our Contributor Guidelines:

            http://cordova.apache.org/contribute/contribute_guidelines.html

            Thanks!
            -->

                1. Platforms affected
                  Android
                1. What does this PR do?
                  Fixes a crash and enables asynchronous MediaPlayer error handling.
                  The crash was happening because the plugin wasn't catching the error from Android's MediaPlayer and thus when the error (in this case, [MEDIA_ERROR_TIMED_OUT](https://developer.android.com/reference/android/media/MediaPlayer.html#MEDIA_ERROR_TIMED_OUT)) occurred, the plugin wasn't aware of this and tried to send new commands to the MediaPlayer which was causing the crash.
                1. What testing has been done on this change?
                  Manual and automatic mobilespec tests on Android 4.4 emulator.
                1. Checklist

            You can merge this pull request into a Git repository by running:

            $ git pull https://github.com/alsorokin/cordova-plugin-media CB-11655

            Alternatively you can review and apply these changes as the patch at:

            https://github.com/apache/cordova-plugin-media/pull/107.patch

            To close this pull request, make a commit to your master/trunk branch
            with (at least) the following in the commit message:

            This closes #107


            commit 6557e2478702fed410f0c28c4814aeb4ae45f534
            Author: Alexander Sorokin <alexander.sorokin@akvelon.com>
            Date: 2016-08-12T15:37:23Z

            CB-11655 (Android) Enabled asynchronous error handling


            githubbot ASF GitHub Bot added a comment - GitHub user alsorokin opened a pull request: https://github.com/apache/cordova-plugin-media/pull/107 CB-11655 (Android) Enabled asynchronous error handling <!-- Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines: http://cordova.apache.org/contribute/contribute_guidelines.html Thanks! --> Platforms affected Android What does this PR do? Fixes a crash and enables asynchronous MediaPlayer error handling. The crash was happening because the plugin wasn't catching the error from Android's MediaPlayer and thus when the error (in this case, [MEDIA_ERROR_TIMED_OUT] ( https://developer.android.com/reference/android/media/MediaPlayer.html#MEDIA_ERROR_TIMED_OUT )) occurred, the plugin wasn't aware of this and tried to send new commands to the MediaPlayer which was causing the crash. What testing has been done on this change? Manual and automatic mobilespec tests on Android 4.4 emulator. Checklist [x] [ICLA] ( http://www.apache.org/licenses/icla.txt ) has been signed and submitted to secretary@apache.org. [x] [Reported an issue] ( http://cordova.apache.org/contribute/issues.html ) in the JIRA database [x] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected. [ ] Added automated test coverage as appropriate for this change. You can merge this pull request into a Git repository by running: $ git pull https://github.com/alsorokin/cordova-plugin-media CB-11655 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-media/pull/107.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #107 commit 6557e2478702fed410f0c28c4814aeb4ae45f534 Author: Alexander Sorokin <alexander.sorokin@akvelon.com> Date: 2016-08-12T15:37:23Z CB-11655 (Android) Enabled asynchronous error handling
            githubbot ASF GitHub Bot added a comment -

            Github user vladimir-kotikov commented on the issue:

            https://github.com/apache/cordova-plugin-media/pull/107

            LGTM :ship: it

            githubbot ASF GitHub Bot added a comment - Github user vladimir-kotikov commented on the issue: https://github.com/apache/cordova-plugin-media/pull/107 LGTM :ship: it

            Commit ae8b3567d2400ad6398ff11df2dc600585919e60 in cordova-plugin-media's branch refs/heads/master from alsorokin
            [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-media.git;h=ae8b356 ]

            CB-11655 (Android) Enabled asynchronous error handling

            jira-bot ASF subversion and git services added a comment - Commit ae8b3567d2400ad6398ff11df2dc600585919e60 in cordova-plugin-media's branch refs/heads/master from alsorokin [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-media.git;h=ae8b356 ] CB-11655 (Android) Enabled asynchronous error handling
            githubbot ASF GitHub Bot added a comment -

            Github user asfgit closed the pull request at:

            https://github.com/apache/cordova-plugin-media/pull/107

            githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/cordova-plugin-media/pull/107
            githubbot ASF GitHub Bot added a comment -

            Github user cordova-qa commented on the issue:

            https://github.com/apache/cordova-plugin-media/pull/107

            Cordova CI Build has one or more failures.

            *Commit* - [Link](https://github.com/apache/cordova-plugin-media/pull/107/commits/6557e2478702fed410f0c28c4814aeb4ae45f534)
            *Dashboard* - [Link](http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55/)

            Builder Name Console Output Test Report Device Logs
            :---: :---: :---: :---:
            [Windows 8.1 Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-store/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-store/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-store/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-store/artifact/)
            [Windows 10 Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-10-store/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-10-store/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-10-store/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-10-store/artifact/)
            [Windows 8.1 Phone]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-phone/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-phone/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-phone/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-phone/artifact/)
            [iOS]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=ios/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=ios/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=ios/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=ios/artifact/)
            [Android]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=android/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=android/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=android/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=android/artifact/)
            githubbot ASF GitHub Bot added a comment - Github user cordova-qa commented on the issue: https://github.com/apache/cordova-plugin-media/pull/107 Cordova CI Build has one or more failures. * Commit * - [Link] ( https://github.com/apache/cordova-plugin-media/pull/107/commits/6557e2478702fed410f0c28c4814aeb4ae45f534 ) * Dashboard * - [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55/ ) Builder Name Console Output Test Report Device Logs :---: :---: :---: :---: [Windows 8.1 Store] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-store/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-store/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-store/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-store/artifact/ ) [Windows 10 Store] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-10-store/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-10-store/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-10-store/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-10-store/artifact/ ) [Windows 8.1 Phone] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-phone/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-phone/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-phone/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=windows-8.1-phone/artifact/ ) [iOS] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=ios/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=ios/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=ios/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=ios/artifact/ ) [Android] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=android/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=android/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=android/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/55//PLATFORM=android/artifact/ )
            githubbot ASF GitHub Bot added a comment -

            Github user cordova-qa commented on the issue:

            https://github.com/apache/cordova-plugin-media/pull/107

            Cordova CI Build has one or more failures.

            *Commit* - [Link](https://github.com/apache/cordova-plugin-media/pull/107/commits/ae8b3567d2400ad6398ff11df2dc600585919e60)
            *Dashboard* - [Link](http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56/)

            Builder Name Console Output Test Report Device Logs
            :---: :---: :---: :---:
            [Windows 8.1 Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-store/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-store/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-store/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-store/artifact/)
            [Windows 10 Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-10-store/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-10-store/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-10-store/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-10-store/artifact/)
            [Windows 8.1 Phone]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-phone/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-phone/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-phone/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-phone/artifact/)
            [iOS]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=ios/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=ios/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=ios/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=ios/artifact/)
            [Android]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=android/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=android/console) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=android/testReport/) [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=android/artifact/)
            githubbot ASF GitHub Bot added a comment - Github user cordova-qa commented on the issue: https://github.com/apache/cordova-plugin-media/pull/107 Cordova CI Build has one or more failures. * Commit * - [Link] ( https://github.com/apache/cordova-plugin-media/pull/107/commits/ae8b3567d2400ad6398ff11df2dc600585919e60 ) * Dashboard * - [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56/ ) Builder Name Console Output Test Report Device Logs :---: :---: :---: :---: [Windows 8.1 Store] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-store/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-store/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-store/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-store/artifact/ ) [Windows 10 Store] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-10-store/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-10-store/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-10-store/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-10-store/artifact/ ) [Windows 8.1 Phone] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-phone/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-phone/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-phone/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=windows-8.1-phone/artifact/ ) [iOS] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=ios/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=ios/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=ios/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=ios/artifact/ ) [Android] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=android/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=android/console ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=android/testReport/ ) [Link] ( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-media-pr/56//PLATFORM=android/artifact/ )

            People

              alsorokin Alexander Sorokin
              leitz lei
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: