Cordova Slack Digest

Wed, 21 Apr 2021 08:22:57 GMT

User count: 4455

Join the conversation at slack.cordova.io

Channel #general (4 messages)


Tue, 20 Apr 2021 20:38:55 GMT

@fb_bcy says

hi

Tue, 20 Apr 2021 20:39:04 GMT

@fb_bcy says

safari has 224 mb canvas memory limit.

Tue, 20 Apr 2021 20:39:19 GMT

@fb_bcy says

Is this limit available in the cordova?

Tue, 20 Apr 2021 20:39:31 GMT

@fb_bcy says

if available, can we increase this limit?

Channel #cordova-windows (1 messages)


Wed, 21 Apr 2021 06:07:07 GMT

@amit.agarwal.1980 says

Looks like some of the Cordova plugins e.g. cordova-sqlite-storage, cordova-plugin-advanced-http, etc are not supported on windows platform. Any other alternatives for such plug-ins with which we can support mobile application on Window

Channel #cordova-android (1 messages)


Tue, 20 Apr 2021 14:06:21 GMT

@ucheozoemena says

Hey folks, I‘m having some issues getting the durations of videos stored on devices running Android 11. I’ve been using this type of code:

                    .getColumnIndex(MediaStore.Files.FileColumns.DATA);
            String path = cursor.getString(dataColumn);

            MediaMetadataRetriever retriever = new MediaMetadataRetriever();
            File file = new File(path);
            retriever.setDataSource(context, Uri.fromFile(file));
            boolean hasVideo = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_HAS_VIDEO).equals("yes");
            String time = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
            int duration = 0;
            if (time != null && hasVideo) {
                duration = (int) Math.ceil(Integer.parseInt(time) / 1000);
            }```
This was working until I began to target Android 11 (API level 30) in my app. Now the duration is always reported as `0`. I can see that `MediaStore.Files.FileColumns.DATA` was <https://developer.android.com/reference/android/provider/MediaStore.MediaColumns#DATA|deprecated beginning with Android 10 (API level 29)>, and `ContentResolver.openFileDescriptor` is the recommended alternative. However, I don't know how to get a video's duration from a `ParcelFileDescriptor` or `FileDescriptor`. I also haven't been able to find resources that demonstrate how to do so. So, how can I do that?

I've also tried other possible solutions, none of which have worked:
- Using `retriever.setDataSource(file.getAbsolutePath())` instead of `retriever.setDataSource(context, Uri.fromFile(file))`. I saw that <https://stackoverflow.com/a/61336282/7987987|here> and <https://stackoverflow.com/a/42250183/7987987|here>, so I tried it but it didn't work (the duration is still zero)
- I tried querying the duration field directly from the `MediaStore` but it still didn't work. This was the code I used:
```                            int vidDurationColumn = cursor.getColumnIndex(MediaStore.Video.Media.DURATION);
                            int duration = (int)cursor.getInt(vidDurationColumn);```
So yeah, I'm open to any ideas that work. Thanks!