Page MenuHomePhabricator

D4979.id16335.diff
No OneTemporary

D4979.id16335.diff

diff --git a/native/input/input-state-container.react.js b/native/input/input-state-container.react.js
--- a/native/input/input-state-container.react.js
+++ b/native/input/input-state-container.react.js
@@ -22,7 +22,7 @@
type MultimediaUploadCallbacks,
type MultimediaUploadExtras,
} from 'lib/actions/upload-actions';
-import { pathFromURI } from 'lib/media/file-utils';
+import { pathFromURI, replaceExtension } from 'lib/media/file-utils';
import { isLocalUploadID, getNextLocalUploadID } from 'lib/media/media-utils';
import { videoDurationLimit } from 'lib/media/video-utils';
import {
@@ -653,22 +653,49 @@
const uploadStart = Date.now();
let uploadExceptionMessage, uploadResult, mediaMissionResult;
try {
- const loop =
- processedMedia.mediaType === 'video' ? processedMedia.loop : undefined;
- uploadResult = await this.props.uploadMultimedia(
- { uri: uploadURI, name: filename, type: mime },
- { ...processedMedia.dimensions, loop },
- {
- onProgress: (percent: number) =>
- this.setProgress(
- localMessageID,
- localMediaID,
- 'uploading',
- percent,
- ),
- uploadBlob: this.uploadBlob,
- },
+ const uploadPromises = [];
+ uploadPromises.push(
+ this.props.uploadMultimedia(
+ { uri: uploadURI, name: filename, type: mime },
+ {
+ ...processedMedia.dimensions,
+ loop:
+ processedMedia.mediaType === 'video'
+ ? processedMedia.loop
+ : undefined,
+ },
+ {
+ onProgress: (percent: number) =>
+ this.setProgress(
+ localMessageID,
+ localMediaID,
+ 'uploading',
+ percent,
+ ),
+ uploadBlob: this.uploadBlob,
+ },
+ ),
);
+
+ if (processedMedia.mediaType === 'video') {
+ uploadPromises.push(
+ this.props.uploadMultimedia(
+ {
+ uri: processedMedia.uploadThumbnailURI,
+ name: replaceExtension(`thumb${filename}`, 'jpg'),
+ type: 'image/jpeg',
+ },
+ {
+ ...processedMedia.dimensions,
+ loop: false,
+ },
+ {
+ uploadBlob: this.uploadBlob,
+ },
+ ),
+ );
+ }
+ [uploadResult] = await Promise.all(uploadPromises);
mediaMissionResult = { success: true };
} catch (e) {
uploadExceptionMessage = getMessageForException(e);

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 7:04 AM (18 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2569552
Default Alt Text
D4979.id16335.diff (2 KB)

Event Timeline