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.0.0 to 2.1.0

.vscode/ipch/3ce04c594b1f843d/mmap_address.bin

2

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

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

@@ -8,5 +8,6 @@

| cordova | ≥ 9.0.0 |
| cordova-android | ≥8.0.0 |
| cordova-android | ≥ 8.0.0 |
| cordova-ios | ≥ 5.0.0 |
> 视频剪辑需要在手机设备运行,安卓虚拟机无法剪辑
> 视频剪辑需要在手机设备运行,虚拟机无法剪辑

@@ -18,11 +19,11 @@ ## 安装

```
> 安装需要消耗大约20MB流量
## 方法列表
| 方法 | 描述 |
| ---------------------------- | -------------------- |
| videoTrim.trimVideo | 视频剪辑 |
| videoTrim.trimSelectedVideo | 从相册选择视频后剪辑 |
| videoTrim.trimRecordedVideo | 录像后前辑 |
| videoTrim.play | 播放视频(允许全屏) |
| videoTrim.getVideoPreviewImg | 获取视频预览图 |
| 方法 | 描述 |
| ---------------------------- | -------------------------------------------- |
| videoTrim.trimVideo | 视频剪辑 (支持android与ios) |
| videoTrim.trimSelectedVideo | 从相册选择视频后剪辑 (支持android与ios) |
| videoTrim.trimRecordedVideo | 录像后前辑 (支持android与ios) |
| videoTrim.play | 播放全屏视频 (支持android与ios) |
| videoTrim.getVideoPreviewImg | 获取视频预览图 (支持android,暂时不支持ios) |

@@ -43,2 +44,3 @@

### 从相册选择视频后剪辑
``` javascript

@@ -97,2 +99,3 @@ videoTrim.trimSelectedVideo(trimSuccess,trimFail);

感谢开源项目 [Android-Video-Trimmer](https://github.com/iknow4/Android-Video-Trimmer) 提供部分安卓源代码

@@ -99,0 +102,0 @@

@@ -10,9 +10,29 @@

Trimmer.prototype.trimVideo = function (videoPath, success, error) {
var that = this;
this.init(function () {
var outPath = window.cordova.file.dataDirectory + (new Date()).getTime() + ".mp4"; // 输出路径
that.openTrimmerPage({ path: videoPath, outPath: outPath }, success, error);
}, function (error) {
error(error)
});
var that = this; var platform = device.platform;
if (platform.toLowerCase() == "android") {
this.init(function () {
var outPath = window.cordova.file.dataDirectory + (new Date()).getTime() + ".mp4"; // 输出路径
that.openTrimmerPage({ path: videoPath, outPath: outPath }, success, error);
}, function (error) {
error(error)
});
}
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
}
);
}
}

@@ -25,8 +45,39 @@

var that = this;
this.init(function () {
var outPath = window.cordova.file.dataDirectory + (new Date()).getTime() + ".mp4"; // 输出路径
that.openSelectVideoPage({ outPath: outPath }, success, error);
}, function (error) {
error(error)
});
var platform = device.platform;
if (platform.toLowerCase() == "android") {
this.init(function () {
var outPath = window.cordova.file.dataDirectory + (new Date()).getTime() + ".mp4"; // 输出路径
that.openSelectVideoPage({ outPath: outPath }, success, error);
}, function (error) {
error(error)
});
}
if (platform.toLowerCase() == "ios") {
//先打开选择视频的页面 cordova-plugin-trim
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
}
);
}, function (error) {
console.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)
});
}
}

@@ -39,8 +90,33 @@

var that = this;
this.init(function () {
var outPath = window.cordova.file.dataDirectory + (new Date()).getTime() + ".mp4"; // 输出路径
that.openRecordVideoPage({ outPath: outPath }, success, error);
}, function (error) {
error(error)
});
var platform = device.platform;
if (platform.toLowerCase() == "android") {
this.init(function () {
var outPath = window.cordova.file.dataDirectory + (new Date()).getTime() + ".mp4"; // 输出路径
that.openRecordVideoPage({ outPath: outPath }, success, error);
}, function (error) {
error(error)
});
}
if (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
}
);
}, function (err) {
error(err);
}, { limit: 1, duration: 20 })
}
}

@@ -73,8 +149,14 @@

Trimmer.prototype.getVideoPreviewImg = function (videoPath, success, error) {
this.init(function () {
var outPath = window.cordova.file.dataDirectory + (new Date()).getTime() + ".jpg"; // 输出路径
exec(success, error, "CordovaTrimmer", "trimVideoImage", [{ path: videoPath, outPath: outPath }]);
}, function (error) {
error(error)
});
var platform = device.platform;
if (platform.toLowerCase() == "android") {
this.init(function () {
var outPath = window.cordova.file.dataDirectory + (new Date()).getTime() + ".jpg"; // 输出路径
exec(success, error, "CordovaTrimmer", "trimVideoImage", [{ path: videoPath, outPath: outPath }]);
}, function (error) {
error(error)
});
} else {
alert("获取视频预览图暂时不支持ios,在ios平台不要调用此方法getVideoPreviewImg");
}
}

@@ -81,0 +163,0 @@

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