Wrong DURATION in MediaStore.Video.Media.DURATION

扶醉桌前 提交于 2019-12-02 03:59:11

solved in this way:

    MediaPlayer mp = MediaPlayer.create(this, Uri.parse(outputfilename));
    int duration = mp.getDuration();
    mp.release();

    ContentValues values = new ContentValues();
    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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!