Skip to content

Commit 43d5a5d

Browse files
動画のサムネイル画像保存の修正。
1 parent 9d940ce commit 43d5a5d

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

  • dConnectDevicePlugin/dConnectDeviceHost/app/src/main/java/org/deviceconnect/android/deviceplugin/host/recorder/camera

dConnectDevicePlugin/dConnectDeviceHost/app/src/main/java/org/deviceconnect/android/deviceplugin/host/recorder/camera/Camera2Recorder.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import java.util.Date;
5555
import java.util.List;
5656
import java.util.Locale;
57+
import java.util.concurrent.CountDownLatch;
5758

5859

5960
public class Camera2Recorder extends AbstractCamera2Recorder implements HostDevicePhotoRecorder, HostDeviceStreamRecorder {
@@ -582,10 +583,12 @@ private long registerVideoThumbnail(final File videoFile, final long videoId) {
582583
Log.d(TAG, "Stored thumbnail file: path=" + thumbnailFilePath);
583584
}
584585
ContentValues values = new ContentValues();
585-
values.put(MediaStore.Video.Thumbnails.DATA, thumbnailFilePath);
586+
values.put(MediaStore.Video.Thumbnails.DATA, videoFilePath);
586587
values.put(MediaStore.Video.Thumbnails.WIDTH, thumbnail.getWidth());
587588
values.put(MediaStore.Video.Thumbnails.HEIGHT, thumbnail.getHeight());
588589
values.put(MediaStore.Video.Thumbnails.KIND, kind);
590+
values.put(MediaStore.Video.Media.MIME_TYPE, "image/jpeg");
591+
589592
values.put(MediaStore.Video.Thumbnails.VIDEO_ID, videoId);
590593
ContentResolver resolver = getContext().getApplicationContext().getContentResolver();
591594
Uri uri = resolver.insert(MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI, values);
@@ -606,12 +609,7 @@ private long registerVideoThumbnail(final File videoFile, final long videoId) {
606609
return -1;
607610
}
608611
return Long.parseLong(id);
609-
} catch (IOException e) {
610-
if (DEBUG) {
611-
Log.e(TAG, "Failed to store video thumbnail by FileManager: videoFilePath=" + videoFilePath, e);
612-
}
613-
return -1;
614-
} catch (NumberFormatException e) {
612+
} catch (IOException | NumberFormatException e) {
615613
if (DEBUG) {
616614
Log.e(TAG, "Failed to parse thumbnail ID as long type: videoFilePath=" + videoFilePath);
617615
}

0 commit comments

Comments
 (0)