1

I'm facing a strange issue when using the android.media.MediaMetadataRetriever. It fails to extract the video width from video files on Samsung phones with Android version 4.0.4 and 4.1.2. The call metaRetriever.extractMetadata() seems to return either null or an empty string, as users of my app are reporting the VideoSetupException with error code ASVF_3.

It works on the Google emulators with said Android versions and all other Android versions and devices.

Any idea what might be causing this? It seems to me that there is a bug in the Android version distributed by Samsung.

Thanks a lot.

M.

    private void setVideoViewDimensionToMatchVideoMetadata(VideoView videoView, Uri uri) {
    String metadataVideoWidth;
    String metadataVideoHeight;
    try {
        final MediaMetadataRetriever metaRetriever = new MediaMetadataRetriever();
        metaRetriever.setDataSource(getActivity(), uri);
        metadataVideoWidth = metaRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH);
        metadataVideoHeight = metaRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT);
        metaRetriever.release();
    } catch (NullPointerException | IllegalArgumentException ex) {
        throw new VideoSetupException(getActivity().getString(R.string.ASVF_2)
                + StringUtils.SPACE + ex.getLocalizedMessage(), ex);
    }
    if (StringUtils.isEmpty(metadataVideoWidth)) {
        throw new VideoSetupException(getActivity().getString(R.string.ASVF_3));
    }
Matthias T
  • 1,230
  • 2
  • 10
  • 24
  • Hi did u solve the issue? – hushed_voice Oct 10 '17 at 11:36
  • @free_style No I didn't. We shot new videos in the meantime. As they are all of the same dimensions I don't need to resort to the MediaMetadataRetriever anymore. This issue only appears on old Samsung devices so it should not be to relevant anymore. Are you suffering from the same problem? – Matthias T Oct 10 '17 at 18:56
  • i am suffering from a similar problem..i want to get the frame of a video with metadataretriver and only on samsung devices (S5 and s8) i am getting null instead of the frame bitmap.. – hushed_voice Oct 11 '17 at 05:30
  • @free_style I get the impression that the MediaMetadataRetriever is somewhat broken. Have you tried storing the dimensions in a SQLite database or changing the filenames to reflect the dimensions? – Matthias T Oct 11 '17 at 18:30
  • This is only happening for samsung devices..its working well in pixel and moto – hushed_voice Oct 12 '17 at 06:28

0 Answers0