5454import java .util .Date ;
5555import java .util .List ;
5656import java .util .Locale ;
57+ import java .util .concurrent .CountDownLatch ;
5758
5859
5960public 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