Giter Site home page Giter Site logo

ludolphus / ti.ios.trim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from martintietz/ti.ios.trim

0.0 2.0 0.0 60.75 MB

A module for trimming and compressing videos with Appcelerator Titanium.

License: MIT License

Objective-C 45.92% Python 45.33% JavaScript 8.75%

ti.ios.trim's Introduction


This project is not actively maintained. Proceed at your own risk!

(If you're willing to take over, please leave a message at #5)


ti.ios.trim Module

Description

This module extends the Appcelerator Titanium Mobile framework and allows trimming and compressing videos on iOS. This is currently not possible using Titanium's VideoPlayer:

[#TIMOB-1816] iOS: Phone > Record Video, edit/trimming is not shown in playback - Appcelerator JIRA [#TIMOB-4200] iOS - Edit mode on record video returns entire video - Appcelerator JIRA

Getting the module

Find the newest version in the dist folder.

Referencing the module

Simply add the following lines to your tiapp.xml file:

<modules>
    <module platform="iphone" version="0.2">ti.ios.trim</module>
</modules>

Accessing the module

To access this module from JavaScript, you would do the following:

var trimmer = require('ti.ios.trim');

The trimmer variable is a reference to the Module object. a

Reference

trimVideo({Object} options)

options can have the following keys:

  • input
    • the path to video file to be trimmed
    • this has to be either an absolute file path (via file.resolve()) or a path to an object inside the asset library (e.g. using the TiAssetsLibrary Module)
  • quality (optional)
    • the quality of the output video (1 = low, 2 = medium, 3 = high)
    • as an orientation: the example .mp4 file has a size of 15.3 MB and the output file (no trimming, only compression) sizes are the following: 1.12 MB (low), 6.12 MB (medium), 15.26 (high)
  • startTime (optional, default: 0)
    • beginning of the trimmed movie (in seconds)
  • endTime (optional, default: duration of the video file)
    • end of the trimmed movie (in seconds)
  • success
    • callback to be invoked after successful trimming
    • the callback is passed an object that has the following properties:
      • thumbnail: the thumbnail of the video as an image blob
      • videoURL: the path to the trimmed video file
  • error
    • callback to be invoked in case of an error
var inputFile = Ti.Filesystem.getFile('path/to/videoFile');
trimmer.trimVideo({
    input: inputFile.resolve(),
    quality: 1,
    startTime: 0,
    endTime: 10,
    success: function(e) {
        Ti.API.info('SUCCESS:');
        Ti.API.info('path to trimmed file: '+ e.videoURL);
    },
    error: function(e) {
        Ti.API.error('ERROR:');
        Ti.API.info(JSON.stringify(e));
    }
});

Changelog

  • 0.3:
    • adds the thumbnail of the trimmed video to the success callback
  • 0.2:
    • adds an optional quality parameter to compress videos
    • adds support for video files inside the asset library
    • makes startTime and endTime optional
  • 0.1: Initial version

Author

Martin Tietz web: http://www.martin-tietz.com email: [email protected]

License

Copyright (c) 2013 Martin Tietz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.