theta-client-react-native
Version:
This library provides a way to control RICOH THETA using.
32 lines (31 loc) • 1.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.convertVideoFormatsImpl = convertVideoFormatsImpl;
var _reactNative = require("react-native");
var _notifyController = require("../notify-controller");
const ThetaClientReactNative = _reactNative.NativeModules.ThetaClientReactNative;
const NOTIFY_PROGRESS = 'CONVERT-VIDEO-FORMATS-PROGRESS';
const MESSAGE_ERROR_RUNNING = 'convertVideoFormats is running.';
async function convertVideoFormatsImpl(fileUrl, toLowResolution, applyTopBottomCorrection, onProgress) {
const notify = _notifyController.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