VideoEditor.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // VideoEditor.js
  3. //
  4. // Created by Josh Bavari on 01-14-2014
  5. // Modified by Ross Martin on 01-29-15
  6. //
  7. var exec = require('cordova/exec');
  8. var pluginName = 'VideoEditor';
  9. function VideoEditor() {}
  10. VideoEditor.prototype.transcodeVideo = function(success, error, options) {
  11. var self = this;
  12. var win = function(result) {
  13. if (typeof result.progress !== 'undefined') {
  14. if (typeof options.progress === 'function') {
  15. options.progress(result.progress);
  16. }
  17. } else {
  18. success(result);
  19. }
  20. };
  21. exec(win, error, pluginName, 'transcodeVideo', [options]);
  22. };
  23. VideoEditor.prototype.trim = function(success, error, options) {
  24. var self = this;
  25. var win = function(result) {
  26. if (typeof result.progress !== 'undefined') {
  27. if (typeof options.progress === 'function') {
  28. options.progress(result.progress);
  29. }
  30. } else {
  31. success(result);
  32. }
  33. };
  34. exec(win, error, pluginName, 'trim', [options]);
  35. };
  36. VideoEditor.prototype.createThumbnail = function(success, error, options) {
  37. exec(success, error, pluginName, 'createThumbnail', [options]);
  38. };
  39. VideoEditor.prototype.getVideoInfo = function(success, error, options) {
  40. exec(success, error, pluginName, 'getVideoInfo', [options]);
  41. };
  42. VideoEditor.prototype.execFFMPEG = function(success, error, options) {
  43. var msg = 'execFFMPEG has been removed as of v1.1.0';
  44. console.log(msg);
  45. error(msg);
  46. };
  47. VideoEditor.prototype.execFFPROBE = function(success, error, options) {
  48. var msg = 'ffprobe has been removed as of v1.0.9';
  49. console.log(msg);
  50. error(msg);
  51. };
  52. module.exports = new VideoEditor();