Problem
The "error" event of a Ti.Media.VideoPlayer doesn't fire on Android.
Expected Behavior
"error" should be called, and the alert dialog should not appear by its own volition.
Sample Code
The following code attempts to play a video that does not exist; this results in an alert dialog popping up saying "Video View // Unknown error". The "error" event is never fired on the VideoPlayer we created.
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
win.open();
var video = Ti.Media.createVideoPlayer({
url: 'file://sdcard/iDoNotExist.mp4'
});
video.addEventListener('error', function(evt) {
Ti.API.error('**** ERROR! **** ' + JSON.stringify(evt));
});
video.play();
Trace Log
D/KrollContext(12424): (kroll$1: app://app.js) [46,154] Running evaluated script: file:///android_asset/Resources/app.js
D/dalvikvm(12424): GC_FOR_MALLOC freed 5219 objects / 336648 bytes in 28ms
D/dalvikvm( 2532): GC_EXTERNAL_ALLOC freed 8589 objects / 453176 bytes in 76ms
I/ActivityManager( 2449): Starting activity: Intent { cmp=com.dawson.playgroundmobile/ti.modules.titanium.media.TiVideoActivity (has extras) }
I/TiRootActivity(12424): (main) [0,0] checkpoint, on root activity resume. context = org.appcelerator.titanium.TiContext@4833fff8
W/TiAnalyticsSvc(12424): (Thread-10) [44,44] Analytics Service Started
E/TiVideoActivity(12424): (main) [42,86] exiting onCreate
I/@@@@@@@@@@(12424): (main) [1,87] setting size: 480x800
I/@@@@@@@@@@(12424): (main) [20,107] setting size: 480x800
I/copybit ( 2449): [createPP] fimc version : 50 9c
V/VideoView(12424): reset duration to -1 in openVideo
E/OsclDirectFileIO( 2351): [LargeFileSupport] OsclDirectFileIO::OpenFileOrSharedFd Error = -1
E/MediaPlayer(12424): message received msg=200, ext1=1, ext2=26
W/MediaPlayer(12424): info/warning (1, 26)
E/MediaPlayer(12424): callback application
E/MediaPlayer(12424): back from callback
E/PlayerDriver( 2351): Command PLAYER_SET_DATA_SOURCE completed with an error or info -4
E/MediaPlayer(12424): message received msg=100, ext1=-4, ext2=-4
E/MediaPlayer(12424): error (-4, -4)
E/MediaPlayer(12424): callback application
E/MediaPlayer(12424): back from callback
W/PlayerDriver( 2351): PVMFInfoErrorHandlingComplete
I/ActivityManager( 2449): Displayed activity com.dawson.playgroundmobile/ti.modules.titanium.media.TiVideoActivity: 245 ms (total 1087 ms)
I/MediaPlayer(12424): Info (1,26)
E/MediaPlayer(12424): Error (-4,-4)
D/VideoView(12424): Error: -4,-4
I/TiAnalyticsSvc(12424): (Thread-10) [227,334] Sending 1 analytics events.
Associated Helpdesk Ticket
http://appc.me/c/APP-197698 http://appc.me/c/APP-584886
Having the same issue on Android 2.3 (Google Nexus One). Would be great if this could be fixed soon. Thanks for all you do, Markus
This is fixed in 1.8.1 as a result of another ticket.
Closing ticket as duplicate.