Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

java.lang.IllegalArgumentException: MIME type #90

Open
Normalnick12 opened this issue Feb 18, 2022 · 2 comments
Open

java.lang.IllegalArgumentException: MIME type #90

Normalnick12 opened this issue Feb 18, 2022 · 2 comments

Comments

@Normalnick12
Copy link

Hi!

Describe the bug

Crash app

To Reproduce

Steps to reproduce the behavior:

  1. Open AddMediaScreen.
  2. Click on "Add Video" or "Add Audio"
 java.lang.IllegalArgumentException: MIME type video/mp4 cannot be inserted into content://media/external/images/media; expected MIME type under image/*
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:172)
        at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
        at android.content.ContentProviderProxy.insert(ContentProviderNative.java:549)
        at android.content.ContentResolver.insert(ContentResolver.java:2149)
        at android.content.ContentResolver.insert(ContentResolver.java:2111)
        at com.google.modernstorage.storage.AndroidFileSystem.createMediaStoreUri(AndroidFileSystem.kt:425)
        at com.google.modernstorage.sample.mediastore.MediaStoreViewModel$addMedia$1.invokeSuspend(MediaStoreViewModel.kt:76)

It seems to fix the error you need to change the following:
in MediaStoreViewModel
change field "Collection"
For video ->

collection = MediaStore.Video.Media.getContentUri("external")

For Audio ->

  collection = MediaStore.Audio.Media.getContentUri("external")
@mrsinhloi
Copy link

Thanks you @Normalnick12 . I am fixed.

@vsoftphuong
Copy link

I am too. Thanks @Normalnick12

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants