Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Add this to your package's `pubspec.yaml` file:

```yaml
dependencies:
video_compress: ^3.1.0
video_compress: ^1.0.0
```

### 2. Install it
Expand Down
13 changes: 7 additions & 6 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
group 'com.example.video_compress'
version '1.0-SNAPSHOT'
group 'com.spectora.video_compress'
version '1.0'

buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.8.10'
repositories {
google()
mavenCentral()
Expand All @@ -18,20 +18,21 @@ rootProject.allprojects {
repositories {
google()
mavenCentral()
// jcenter()
}
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 31
compileSdkVersion 33

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
minSdkVersion 18
minSdkVersion 21
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
lintOptions {
Expand All @@ -41,5 +42,5 @@ android {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.otaliastudios:transcoder:0.9.1'
implementation 'com.otaliastudios:transcoder:0.10.5'
}
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.video_compress">
package="com.spectora.video_compress">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.video_compress
package com.spectora.video_compress

import android.content.Context
import android.graphics.Bitmap
Expand Down Expand Up @@ -47,4 +47,4 @@ class ThumbnailUtility(channelName: String) {

result.success(file.absolutePath)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.video_compress
package com.spectora.video_compress

import android.content.Context
import android.graphics.Bitmap
Expand Down Expand Up @@ -131,4 +131,4 @@ class Utility(private val channelName: String) {
val dir = context.getExternalFilesDir("video_compress")
result.success(dir?.deleteRecursively())
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.video_compress
package com.spectora.video_compress

import android.content.Context
import android.net.Uri
Expand All @@ -13,7 +13,7 @@ import com.otaliastudios.transcoder.strategy.RemoveTrackStrategy
import com.otaliastudios.transcoder.strategy.TrackStrategy
import io.flutter.embedding.engine.plugins.FlutterPlugin
import io.flutter.plugin.common.BinaryMessenger
import com.otaliastudios.transcoder.internal.Logger
import com.otaliastudios.transcoder.internal.utils.Logger
import io.flutter.plugin.common.MethodCall
import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
Expand Down Expand Up @@ -79,8 +79,8 @@ class VideoCompressPlugin : MethodCallHandler, FlutterPlugin {
val path = call.argument<String>("path")!!
val quality = call.argument<Int>("quality")!!
val deleteOrigin = call.argument<Boolean>("deleteOrigin")!!
val startTime = call.argument<Int>("startTime")
val duration = call.argument<Int>("duration")
val startTime = call.argument<Double>("startTime")
val duration = call.argument<Double>("duration")
val includeAudio = call.argument<Boolean>("includeAudio") ?: true
val frameRate = if (call.argument<Int>("frameRate")==null) 30 else call.argument<Int>("frameRate")

Expand Down Expand Up @@ -140,7 +140,10 @@ class VideoCompressPlugin : MethodCallHandler, FlutterPlugin {

val dataSource = if (startTime != null || duration != null){
val source = UriDataSource(context, Uri.parse(path))
TrimDataSource(source, (1000 * 1000 * (startTime ?: 0)).toLong(), (1000 * 1000 * (duration ?: 0)).toLong())
val startTimeInMillis = (1000 * 1000 * (startTime ?: 0.0)).toLong()
val durationInMillis = (1000 * 1000 * (duration ?: 0.0)).toLong()
TrimDataSource(source, startTimeInMillis, durationInMillis)
// TrimDataSource(source, (1000 * 1000 * (startTime ?: 0)).toLong(), (1000 * 1000 * (duration ?: 0)).toLong())
}else{
UriDataSource(context, Uri.parse(path))
}
Expand Down
16 changes: 13 additions & 3 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31


compileSdkVersion 33

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -39,8 +41,8 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.video_compress_example"
minSdkVersion 18
targetSdkVersion 31
minSdkVersion 21
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -53,6 +55,13 @@ android {
signingConfig signingConfigs.debug
}
}
namespace "com.example.video_compress_example"






}

flutter {
Expand All @@ -61,6 +70,7 @@ flutter {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.otaliastudios:transcoder:0.10.5'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
Expand Down
3 changes: 1 addition & 2 deletions example/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.video_compress_example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
4 changes: 3 additions & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.video_compress_example">
>

<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
Expand All @@ -10,11 +10,13 @@
<application
android:name="${applicationName}"
android:label="video_compress_example"

android:icon="@mipmap/ic_launcher">
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:exported="true"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
Expand Down
3 changes: 1 addition & 2 deletions example/android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.video_compress_example">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
6 changes: 3 additions & 3 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.8.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
4 changes: 4 additions & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

6 changes: 3 additions & 3 deletions example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri May 17 10:22:14 CST 2019
#Wed Jul 19 10:11:06 WAT 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
zipStoreBase=GRADLE_USER_HOME
18 changes: 0 additions & 18 deletions example/ios/Flutter/Flutter.podspec

This file was deleted.

2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.titleMedium,
),
InkWell(
child: Icon(
Expand Down
11 changes: 6 additions & 5 deletions example/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXAggregateTarget section */
Expand Down Expand Up @@ -203,7 +203,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
Expand Down Expand Up @@ -278,6 +278,7 @@
};
3399D490228B24CF009A79C7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -404,7 +405,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
Expand Down Expand Up @@ -483,7 +484,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
Expand Down Expand Up @@ -530,7 +531,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion ios/video_compress.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pod::Spec.new do |s|
s.description = <<-DESC
A new flutter plugin project.
DESC
s.homepage = 'https://github.com/jonataslaw/video_compress'
s.homepage = 'https://github.com/SpectoraSoftware/VideoCompress'
s.license = { :file => '../LICENSE' }
s.author = { 'Jonny Borges' => 'jonataborges01@gmail.com' }
s.source = { :path => '.' }
Expand Down
5 changes: 2 additions & 3 deletions lib/src/video_compress/video_compressor.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -124,8 +123,8 @@ extension Compress on IVideoCompress {
String path, {
VideoQuality quality = VideoQuality.DefaultQuality,
bool deleteOrigin = false,
int? startTime,
int? duration,
double? startTime,
double? duration,
bool? includeAudio,
int frameRate = 30,
}) async {
Expand Down
4 changes: 2 additions & 2 deletions macos/video_compress.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Pod::Spec.new do |s|
s.description = <<-DESC
A new flutter plugin project.
DESC
s.homepage = 'https://github.com/jonataslaw/video_compress'
s.homepage = 'https://github.com/SpectoraSoftware/VideoCompress'
s.license = { :file => '../LICENSE' }
s.author = { 'Jonny Borges' => 'jonataborges01@gmail.com' }
s.author = { 'Gabriel Araujo' => 'gabriel@spectora.com' }
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'FlutterMacOS'
Expand Down
Loading