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

视频剪辑Cordova插件

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

cordova-plugin-video-trim

截取短视频cordova插件,目前支持大于cordova-android@8.0.0版本

安装

先安装依赖项插件

cordova plugin add cordova-plugin-device
cordova plugin add cordova-plugin-media
cordova plugin add cordova-plugin-media-capture

由于安卓版本碎片化问题,以上依赖项必须手动安装

正式安装 cordova-plugin-video-trim

cordova plugin add https://github.com/waitaction/cordova-plugin-video-trim.git

怎么用

初始 cordova-plugin-video-trim

videoTrimmer.init(function () {
    // 初始化成功
    // todo
});

从视频选择对话框开始,选择源视频后截取视频片段

var dataDirectory = window.cordova.file.dataDirectory;
var outPath = dataDirectory + "test.mp4"; // 输出最终短视频的路径
videoTrimmer.openSelectVideoPage({ outPath: outPath }, function (videoUrl) {
    // 截取视频片段成功,视频片段地址 videoUrl
    // 播放截取后的视频片段
    videoTrimmer.play({ path:videoUrl },function(){ },function(){ }); // 播放
}, function (err) {
    // 截取视频片段失败
});

打开摄像头录制短视频

videoTrimmer.openRecordVideoPage({outPath:outPath},function (videoUrl) {
    // 截取视频片段成功,视频片段地址 videoUrl
    // todo
}, function (error) { 
    // 截取视频片段失败
});

输入源视频路径截取视频片段

videoTrimmer.openTrimmerPage({ path:sourcePath , outPath:targetPath },function(videoUrl){
    // 截取视频片段成功,视频片段地址 videoUrl
    // todo
},function(error){
    // 截取视频片段失败
});

从视频截图封面图

videoTrimmer.trimVideoImage({ path:data , outPath:imgPath },function(url){
    $("body").append("<img src='" + url + "' />");
});
Demo
videoTrim2

cordova-plugin-video-trim插件部分代码来源 https://github.com/iknow4/Android-Video-Trimmer

Keywords

FAQs

Package last updated on 08 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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