I am trying to pick video file through intent and extract meta data from the video.
However, I got some error reports from users and reporting following exception:
Exception java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=12004, result=-1, data=Intent { dat=content://media/external/images/media/63141 flg=0x1 (has extras) }} to activity {my.app/my.app.VideoActivity}:
java.lang.RuntimeException: setDataSource failed: status = 0x80000000
Here is the code grabbing meta data:
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
Uri uri = intent.getData();
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
try {
retriever.setDataSource(this, uri); // error occurs here
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
}
}
Why does the exception appears and how to fix it?