[
https://issues.apache.org/jira/browse/CB-11086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15247441#comment-15247441
]
Fabrice Lebas commented on CB-11086:
------------------------------------
To be clear, this patch was done while looking after a problem of codrova app
restarting when the phone is plugged or unplugged from a car audio stand. It
seams that an event telling the app the audio system has changed makes the app
restart. I first thought the app restart was due to that null pointer
exception, but once fixed, the app still restarts... I decided to propose the
patch (as well as CB-11085) so this work is not lost, and code cleaner for
going forward. In my opinion, the real problem comes from the player creation
logic: we should never have this.players.get(id) returning a non null while the
player is null. There should be a mecanism in Android that indicates when the
player is really ready.
https://github.com/apache/cordova-plugin-media/pull/93#issuecomment-211529912
> setVolume fires a Null pointer exception if called too soon
> -----------------------------------------------------------
>
> Key: CB-11086
> URL: https://issues.apache.org/jira/browse/CB-11086
> Project: Apache Cordova
> Issue Type: Bug
> Components: Plugin Media
> Affects Versions: 2.0.0, 2.1.0, 2.2.0, 2.3.0, 2.4.0, 2.5.0, 2.6.0, 2.7.0,
> 2.8.0, 2.9.0, 3.0.0, 3.1.0, 3.2.0, 3.3.0, 3.4.0, 2.9.1, 3.5.0
> Reporter: Fabrice Lebas
> Priority: Minor
> Labels: Android, easyfix, triaged, wfc
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> On player creation, we can sometime observe:
> E/PluginManager( 5442): Uncaught exception from plugin
> E/PluginManager( 5442): java.lang.NullPointerException
> E/PluginManager( 5442): at
> org.apache.cordova.media.AudioPlayer.setVolume(AudioPlayer.java:441)
> E/PluginManager( 5442): at
> org.apache.cordova.media.AudioHandler.setVolume(AudioHandler.java:455)
> E/PluginManager( 5442): at
> org.apache.cordova.media.AudioHandler.execute(AudioHandler.java:143)
> E/PluginManager( 5442): at
> org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
> E/PluginManager( 5442): at
> org.apache.cordova.PluginManager.exec(PluginManager.java:133)
> E/PluginManager( 5442): at
> org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
> E/PluginManager( 5442): at
> org.apache.cordova.CordovaBridge.promptOnJsPrompt(CordovaBridge.java:135)
> E/PluginManager( 5442): at
> org.apache.cordova.engine.SystemWebChromeClient.onJsPrompt(SystemWebChromeClient.java:124)
> E/PluginManager( 5442): at
> android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:886)
> E/PluginManager( 5442): at
> android.os.Handler.dispatchMessage(Handler.java:99)
> E/PluginManager( 5442): at android.os.Looper.loop(Looper.java:137)
> E/PluginManager( 5442): at
> android.app.ActivityThread.main(ActivityThread.java:4921)
> E/PluginManager( 5442): at java.lang.reflect.Method.invokeNative(Native
> Method)
> E/PluginManager( 5442): at
> java.lang.reflect.Method.invoke(Method.java:511)
> E/PluginManager( 5442): at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
> E/PluginManager( 5442): at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
> E/PluginManager( 5442): at dalvik.system.NativeStart.main(Native Method)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]