Skip to content

Instantly share code, notes, and snippets.

@kmturley
Created November 10, 2015 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmturley/164fe4c659b3b06b8f96 to your computer and use it in GitHub Desktop.
Save kmturley/164fe4c659b3b06b8f96 to your computer and use it in GitHub Desktop.
Extending video editor functionality
//
// VideoEditor.js
//
// Created by Josh Bavari on 01-14-2014
// Modified by Ross Martin on 01-29-15
//
var exec = require('cordova/exec'),
pluginName = 'VideoEditor';
function VideoEditor() {}
VideoEditor.prototype.transcodeVideo = function (successCallback, fail, options) {
// https://github.com/apache/cordova-plugin-file-transfer/blob/master/www/FileTransfer.js#L197
var self = this,
win = function (result) {
if (typeof result.lengthComputable !== "undefined") {
if (self.onprogress) {
self.onprogress(result);
}
} else {
successCallback(result);
}
};
exec(win, fail, pluginName, 'transcodeVideo', [options]);
};
VideoEditor.prototype.createThumbnail = function (success, error, options) {
exec(success, error, pluginName, 'createThumbnail', [options]);
};
VideoEditor.prototype.killVideoProcessor = function (success, error, options) {
exec(success, error, pluginName, 'killVideoProcessor', [options]);
};
module.exports = new VideoEditor();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment