Skip to content Skip to sidebar Skip to footer

Wrong Duration In Mediastore.video.media.duration

I'm trying to record video in my application and I've noticed that displaying their duration, I see wrong minutes \ seconds. This happens only with the video recorded trough the fo

Solution 1:

solved in this way:

MediaPlayermp= MediaPlayer.create(this, Uri.parse(outputfilename));
    intduration= mp.getDuration();
    mp.release();

    ContentValuesvalues=newContentValues();
    values.put(MediaStore.Video.Media.DATA, outputfilename);
    values.put(MediaStore.Video.Media.DATE_TAKEN, dateTaken);
    values.put(MediaStore.Video.Media.DURATION, duration);

It was the need to calculate and add the video duration to the MediaStore properties.

Post a Comment for "Wrong Duration In Mediastore.video.media.duration"