jaeger25 / Html5Video

A Phonegap plugin that allows playback of local video files using html 5 video tags
Apache License 2.0
99 stars 65 forks source link

Improve log output when filenames are invalid #39

Open DavidFrahm opened 9 years ago

DavidFrahm commented 9 years ago

I had a heck of a time tracing/debugging an issue where the videos would not play, and it was due to the known Android restriction of filenames needing to be lowercase.

Even though I knew about the filename restrictions, I thought I had that taken care of and so I tried using the logcat/console output to point me to the root cause.

I feel like it would have really helped if somewhere an error would have been thrown. Something like the typical "FILES MUST CONTAIN ONLY [a-z0-9_.]" error, or even more specific and explanatory for the use case of this video plugin.

The logcat output I did get was this:

W/ResourceType( 3820): No package identifier when getting value for resource number 0x00000000
E/Html5VideoCordovaPlugin( 3820): Failed to copy video file to data dir.
E/Html5VideoCordovaPlugin( 3820): android.content.res.Resources$NotFoundException: Resource ID #0x0
E/Html5VideoCordovaPlugin( 3820):   at android.content.res.Resources.getValue(Resources.java:1266)
E/Html5VideoCordovaPlugin( 3820):   at android.content.res.Resources.openRawResourceFd(Resources.java:1224)
E/Html5VideoCordovaPlugin( 3820):   at org.apache.cordova.plugin.b.a(Unknown Source)
E/Html5VideoCordovaPlugin( 3820):   at org.apache.cordova.plugin.b.a(Unknown Source)
E/Html5VideoCordovaPlugin( 3820):   at org.apache.cordova.plugin.Html5Video.a(Unknown Source)
E/Html5VideoCordovaPlugin( 3820):   at org.apache.cordova.ae.a(Unknown Source)
E/Html5VideoCordovaPlugin( 3820):   at org.apache.cordova.bi.a(Unknown Source)
E/Html5VideoCordovaPlugin( 3820):   at org.apache.cordova.s.a(Unknown Source)
E/Html5VideoCordovaPlugin( 3820):   at org.apache.cordova.as.exec(Unknown Source)
E/Html5VideoCordovaPlugin( 3820):   at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
E/Html5VideoCordovaPlugin( 3820):   at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:53)
E/Html5VideoCordovaPlugin( 3820):   at android.os.Handler.dispatchMessage(Handler.java:102)
E/Html5VideoCordovaPlugin( 3820):   at android.os.Looper.loop(Looper.java:135)
E/Html5VideoCordovaPlugin( 3820):   at android.os.HandlerThread.run(HandlerThread.java:61)
DavidFrahm commented 9 years ago

By the way, I see that there is some callback error handling in Html5Video.js here:

https://github.com/jaeger25/Html5Video/blob/master/www/Html5Video.js#L23

However, I never say that output anywhere. Might be another related opportunity for improvement.