java.lang.IllegalArgumentException-MediaMetadataRetriever.setDataSource

1
2
3
4
5
6
7
8
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);

if (requestCode == VideoApi.REQUEST_CODE_SELECT_VIDEO && RESULT_OK == resultCode) {
Uri videoUri = data.getData();
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(videoUri.getPath());
1
2
3
4
5
6
7
8
9
10
11
12
Caused by: java.lang.IllegalArgumentException
at android.media.MediaMetadataRetriever.setDataSource(MediaMetadataRetriever.java:73)
at com.caiyi.youle.MainActivity.onActivityResult(MainActivity.java:433)
at android.app.Activity.dispatchActivityResult(Activity.java:6479)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3915)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3962) 
at android.app.ActivityThread.access$1500(ActivityThread.java:180) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1543) 
at android.os.Handler.dispatchMessage(Handler.java:111) 
at android.os.Looper.loop(Looper.java:207) 
at android.app.ActivityThread.main(ActivityThread.java:5791) 
at java.lang.reflect.Method.invoke(Native Method)

没有申请读写权限
WRITE_EXTERNAL_STORAGE