ฉันกำลังพยายามรับความกว้างและขนาดวิดีโอโดยใช้โค้ดง่ายๆ นี้:
String[] filePathColumn = {MediaStore.Video.VideoColumns.DATA,
MediaStore.Video.VideoColumns.WIDTH,
MediaStore.Video.VideoColumns.HEIGHT};
cursor = mContext.getContentResolver().query(mVideoUri, filePathColumn, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
mVideoDecodableString = cursor.getString(cursor.getColumnIndex(filePathColumn[0]));
mVideoWidth = cursor.getInt(cursor.getColumnIndex(filePathColumn[1]));
mVideoHeight = cursor.getInt(cursor.getColumnIndex(filePathColumn[2]));
}
น่าเสียดายที่ฉันมักจะได้รับความกว้างและความสูง 0 เสมอสำหรับไฟล์วิดีโอทุกไฟล์ในแกลเลอรีของฉัน แต่การรับข้อมูลวิดีโอใช้งานได้
ฉันกำลังทำอะไรผิดหรือทำไม่ได้ใน Android