Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3396633
D7478.id25236.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
D7478.id25236.diff
View Options
diff --git a/native/media/ffmpeg.js b/native/media/ffmpeg.js
--- a/native/media/ffmpeg.js
+++ b/native/media/ffmpeg.js
@@ -81,19 +81,21 @@
transcodeVideo(
ffmpegCommand: string,
inputVideoDuration: number,
- onTranscodingProgress: (percent: number) => void,
+ onTranscodingProgress?: (percent: number) => void,
): Promise<{ rc: number, lastStats: ?FFmpegStatistics }> {
const duration = inputVideoDuration > 0 ? inputVideoDuration : 0.001;
const wrappedCommand = async () => {
RNFFmpegConfig.resetStatistics();
let lastStats;
- RNFFmpegConfig.enableStatisticsCallback(
- (statisticsData: FFmpegStatistics) => {
- lastStats = statisticsData;
- const { time } = statisticsData;
- onTranscodingProgress(time / 1000 / duration);
- },
- );
+ if (onTranscodingProgress) {
+ RNFFmpegConfig.enableStatisticsCallback(
+ (statisticsData: FFmpegStatistics) => {
+ lastStats = statisticsData;
+ const { time } = statisticsData;
+ onTranscodingProgress(time / 1000 / duration);
+ },
+ );
+ }
const ffmpegResult = await RNFFmpeg.execute(ffmpegCommand);
return { ...ffmpegResult, lastStats };
};
diff --git a/native/media/media-utils.js b/native/media/media-utils.js
--- a/native/media/media-utils.js
+++ b/native/media/media-utils.js
@@ -20,7 +20,7 @@
+hasWiFi: boolean,
// Blocks return until we can confirm result has the correct MIME
+finalFileHeaderCheck?: boolean,
- +onTranscodingProgress: (percent: number) => void,
+ +onTranscodingProgress?: (percent: number) => void,
};
type SharedMediaResult = {
+success: true,
diff --git a/native/media/video-utils.js b/native/media/video-utils.js
--- a/native/media/video-utils.js
+++ b/native/media/video-utils.js
@@ -38,7 +38,7 @@
};
type VideoProcessConfig = {
- +onTranscodingProgress: (percent: number) => void,
+ +onTranscodingProgress?: (percent: number) => void,
};
type ProcessVideoResponse = {
@@ -200,7 +200,7 @@
async function transcodeVideo(
plan: ProcessPlan,
duration: number,
- onProgressCallback: number => void,
+ onProgressCallback?: number => void,
): Promise<TranscodeVideoMediaMissionStep> {
const transcodeStart = Date.now();
let returnCode,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 2, 1:51 PM (19 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2607387
Default Alt Text
D7478.id25236.diff (2 KB)
Attached To
Mode
D7478: [native] Make `onTranscodingProgress` field of `MediaProcessConfig` optional
Attached
Detach File
Event Timeline
Log In to Comment