IllegalArgumentException:当尝试将cloudinary URL链接到firebase时,Firebase存储URL必须指向存储桶中的对象

时间:2019-07-15 06:52:21

标签: android firebase firebase-storage

我正在使用Cloudiary服务,以减小上载视频的大小。我正在获取图片的URL(我认为这是视频的第一帧)作为响应。尝试从Firebase加载视频时,出于某种原因,我得到的是URL,而不是URI。这是我的方法-


 private void loadVideoUri(String storageUri) {
        if (StringUtils.isBlank(storageUri)) {
            return;
        }

        // load firebase storage
        Task<Uri> downloadUrlTask = FirebaseStorage.getInstance().getReferenceFromUrl(storageUri).getDownloadUrl(); // -> crash happends here
        if (getContext() instanceof Activity) {
            downloadUrlTask.addOnCompleteListener((Activity) getContext(), mOnDownloadUrlCompleted);
        } else {
            downloadUrlTask.addOnCompleteListener(mOnDownloadUrlCompleted);
        }

    }


这是完整的错误-


java.lang.IllegalArgumentException: Firebase Storage URLs must point to an object in your Storage Bucket. Please obtain a URL using the Firebase Console or getDownloadUrl().
        at com.google.firebase.storage.internal.Util.normalize(com.google.firebase:firebase-storage@@16.0.5:134)
        at com.google.firebase.storage.FirebaseStorage.getReferenceFromUrl(com.google.firebase:firebase-storage@@16.0.5:281)
        at com.onemdtalent.app.ui.views.mdview.FirebasePlayerView.loadVideoUri(FirebasePlayerView.java:156)

0 个答案:

没有答案