UNPKG

theta-client-react-native

Version:

This library provides a way to control RICOH THETA using.

26 lines 1.11 kB
import { NativeModules } from 'react-native'; import { NotifyController } from '../notify-controller'; const ThetaClientReactNative = NativeModules.ThetaClientReactNative; const NOTIFY_PROGRESS = 'CONVERT-VIDEO-FORMATS-PROGRESS'; const MESSAGE_ERROR_RUNNING = 'convertVideoFormats is running.'; export async function convertVideoFormatsImpl(fileUrl, toLowResolution, applyTopBottomCorrection, onProgress) { const notify = NotifyController.instance; if (notify.existsNotify(NOTIFY_PROGRESS)) { throw new Error(MESSAGE_ERROR_RUNNING); } notify.addNotify(NOTIFY_PROGRESS, event => { var _event$params; if (onProgress != null && ((_event$params = event.params) === null || _event$params === void 0 ? void 0 : _event$params.completion) != null) { onProgress(event.params.completion); } }); try { const result = await ThetaClientReactNative.convertVideoFormats(fileUrl, toLowResolution, applyTopBottomCorrection); return result; } catch (error) { throw error; } finally { notify.removeNotify(NOTIFY_PROGRESS); } } //# sourceMappingURL=convert-video-formats.js.map