错误:无法打开此文件(内容://com.android.providers.media.documents/document/)

时间:2016-08-24 05:10:31

标签: android android-mediaplayer android-videoview

我在移动设备上运行应用时遇到了一些错误。 错误代码:

        MediaController mc = new MediaController(this);
    mc.setAnchorView(mVIdeoView);
    mc.setMediaPlayer(mVIdeoView);
    //Uri video = Uri.parse(LINK);
    mVIdeoView.setMediaController(mc);
    mVIdeoView.setVideoURI(Uri.parse(c.getString(1)));
    mVIdeoView.start();

这是我的代码:

  fetch(Properties.uris.base + Properties.uris.getBusinessDetails.replace("{businessId}",   Properties.appId).replace("{timezone",this.getTimeZone()), {
        method: "GET",
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json',
            'User-Agent': DeviceInfo.getUserAgent(),
            'X-UserId':userDetailsJson.username,
            'X-BusinessId':Properties.appId,
            'X-App-Version': DeviceInfo.getVersion(),
            'Api-Version': Properties.fetchHeaderInformation.apiVersion,
        }})
        .then((response) => response.json())

1 个答案:

答案 0 :(得分:0)

我得到了自己的答案

   //use for gallery
private void openGalleryAudio() {

    Intent intent = new Intent();
    intent.setType("video/*");
    /*intent.setAction(Intent.ACTION_GET_CONTENT);*/
    intent.setAction(Intent.ACTION_OPEN_DOCUMENT);
    startActivityForResult(Intent.createChooser(intent, "Select video "), SELECT_VIDEO);

}

将Intent.ACTION_GET_CONTENT替换为Intent.ACTION_OPEN_DOCUMENT