Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3345801
D4979.id16335.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D4979.id16335.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D4979: [native] Upload video thumbnails to `keyserver` and persist in serverDB
Attached
Detach File
Event Timeline
Log In to Comment