Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cordova-plugin-video-trim

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-video-trim - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

hook/android/after_build.js

2

package.json
{
"name": "cordova-plugin-video-trim",
"version": "2.1.0",
"version": "2.2.0",
"description": "视频剪辑功能的Cordova插件",

@@ -5,0 +5,0 @@ "cordova": {

@@ -0,0 +0,0 @@

@@ -7,7 +7,6 @@

* 视频剪辑
* 输入视频路径,成功输出剪辑后的视频路径
*/
Trimmer.prototype.trimVideo = function (videoPath, success, error) {
var that = this; var platform = device.platform;
if (platform.toLowerCase() == "android") {
var that = this;
if (device.platform.toLowerCase() == "android") {
this.init(function () {

@@ -20,19 +19,6 @@ var outPath = window.cordova.file.dataDirectory + (new Date()).getTime() + ".mp4"; // 输出路径

}
if (platform.toLowerCase() == "ios") {
var nativeUrl = videoPath;
that.iosTrim(
function (result) {
success && success(result);
},
function (err) {
error && error(err);
},
{
path: nativeUrl, // path to input video,
limit: 20, // max limit, only for android
fileUri: nativeUrl, // for ios
duration: 15 //for ios
}
);
if (device.platform.toLowerCase() == "ios") {
//ios不支持
alert("trimVideo方法ios不支持");
success(videoPath)
}

@@ -46,4 +32,3 @@ }

var that = this;
var platform = device.platform;
if (platform.toLowerCase() == "android") {
if (device.platform.toLowerCase() == "android") {
this.init(function () {

@@ -56,28 +41,41 @@ var outPath = window.cordova.file.dataDirectory + (new Date()).getTime() + ".mp4"; // 输出路径

}
if (platform.toLowerCase() == "ios") {
//先打开选择视频的页面 cordova-plugin-trim
if (device.platform.toLowerCase() == "ios") {
navigator.camera.getPicture(function (nativeUrl) {
that.iosTrim(
function (result) {
success && success(result);
},
function (err) {
error && error(err);
},
{
path: nativeUrl, // path to input video,
limit: 20, // max limit, only for android
fileUri: nativeUrl, // for ios
duration: 15 //for ios
}
);
<<<<<<< HEAD
var fileUrl = "file://" + nativeUrl;
//复制文件
window.resolveLocalFileSystemURL(fileUrl, function (entry) {
window.resolveLocalFileSystemURL(window.cordova.file.dataDirectory, function (dirEntry) {
entry.copyTo(dirEntry, (new Date()).getTime() + ".mp4",
function (tEntry) {
if (tEntry.nativeURL.indexOf("file://") == 0) {
success(tEntry.nativeURL);
} else {
success("file://" + tEntry.nativeURL);
}
}, function (tError) {
console.error(tError);
error(tError)
});
}, function (error) {
console.error(error);
error(error)
});
}, function (error) {
console.error(error);
error(error)
})
}, function (error) {
console.error(error);
error(error)
}, {
allowEdit: true,
destinationType: Camera.DestinationType.NATIVE_URI,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
mediaType: Camera.MediaType.VIDEO,
popoverOptions: new CameraPopoverOptions(300, 300, 100, 100, Camera.PopoverArrowDirection.ARROW_ANY)
});
allowEdit: true,
destinationType: Camera.DestinationType.NATIVE_URI,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
mediaType: Camera.MediaType.VIDEO,
popoverOptions: new CameraPopoverOptions(0, 32, 320, 480, Camera.PopoverArrowDirection.ARROW_ANY)
});
}

@@ -92,4 +90,3 @@

var that = this;
var platform = device.platform;
if (platform.toLowerCase() == "android") {
if (device.platform.toLowerCase() == "android") {
this.init(function () {

@@ -102,23 +99,31 @@ var outPath = window.cordova.file.dataDirectory + (new Date()).getTime() + ".mp4"; // 输出路径

}
if (platform.toLowerCase() == "ios") {
if (device.platform.toLowerCase() == "ios") {
navigator.device.capture.captureVideo(function (mediaFiles) {
var nativeUrl = mediaFiles[0].fullPath;
that.iosTrim(
function (result) {
success && success(result);
},
function (err) {
error && error(err);
},
{
path: nativeUrl, // path to input video,
limit: 20, // max limit, only for android
fileUri: nativeUrl, // for ios
duration: 15 //for ios
}
);
var fileUrl = "file://" + mediaFiles[0].fullPath;
//复制文件
window.resolveLocalFileSystemURL(fileUrl, function (entry) {
window.resolveLocalFileSystemURL(window.cordova.file.dataDirectory, function (dirEntry) {
entry.copyTo(dirEntry, (new Date()).getTime() + ".mp4",
function (tEntry) {
if (tEntry.nativeURL.indexOf("file://") == 0) {
success(tEntry.nativeURL);
} else {
success("file://" + tEntry.nativeURL);
}
}, function (tError) {
console.error(tError);
error(tError)
});
}, function (error) {
console.error(error);
error(error)
});
}, function (error) {
console.error(error);
error(error)
})
}, function (err) {
error(err);
}, { limit: 1, duration: 20 })
}, { limit: 1, duration: 15 })
}

@@ -131,3 +136,2 @@ }

Trimmer.prototype.play = function (videoPath, success, error) {
// Play a video with callbacks
var options = {

@@ -209,17 +213,5 @@ successCallback: function () {

Trimmer.prototype.iosTrim = function (success, error, options) {
var self = this;
var win = function (result) {
if (typeof result.progress !== 'undefined') {
if (typeof options.progress === 'function') {
options.progress(result.progress);
}
} else {
success(result);
}
};
exec(win, error, 'VideoTrim', 'trim', [options]);
};
module.exports = new Trimmer();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc