cordova-plugin-video-trim
Advanced tools
Comparing version 2.1.0 to 2.2.0
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
359
4
19670832
59
2