diff --git a/README.md b/README.md index 1c4681da..f558f151 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/android/build.gradle b/android/build.gradle index ae95c4ff..2fde10d3 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -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() @@ -18,6 +18,7 @@ rootProject.allprojects { repositories { google() mavenCentral() +// jcenter() } } @@ -25,13 +26,13 @@ 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 { @@ -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' } diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 55d34d07..4f14169c 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,4 +1,4 @@ + package="com.spectora.video_compress"> diff --git a/android/src/main/kotlin/com/example/video_compress/ThumbnailUtility.kt b/android/src/main/kotlin/com/spectora/video_compress/ThumbnailUtility.kt similarity index 97% rename from android/src/main/kotlin/com/example/video_compress/ThumbnailUtility.kt rename to android/src/main/kotlin/com/spectora/video_compress/ThumbnailUtility.kt index e63aec80..fd086ebd 100644 --- a/android/src/main/kotlin/com/example/video_compress/ThumbnailUtility.kt +++ b/android/src/main/kotlin/com/spectora/video_compress/ThumbnailUtility.kt @@ -1,4 +1,4 @@ -package com.example.video_compress +package com.spectora.video_compress import android.content.Context import android.graphics.Bitmap @@ -47,4 +47,4 @@ class ThumbnailUtility(channelName: String) { result.success(file.absolutePath) } -} \ No newline at end of file +} diff --git a/android/src/main/kotlin/com/example/video_compress/Utility.kt b/android/src/main/kotlin/com/spectora/video_compress/Utility.kt similarity index 99% rename from android/src/main/kotlin/com/example/video_compress/Utility.kt rename to android/src/main/kotlin/com/spectora/video_compress/Utility.kt index f5647097..04f59a0e 100644 --- a/android/src/main/kotlin/com/example/video_compress/Utility.kt +++ b/android/src/main/kotlin/com/spectora/video_compress/Utility.kt @@ -1,4 +1,4 @@ -package com.example.video_compress +package com.spectora.video_compress import android.content.Context import android.graphics.Bitmap @@ -131,4 +131,4 @@ class Utility(private val channelName: String) { val dir = context.getExternalFilesDir("video_compress") result.success(dir?.deleteRecursively()) } -} \ No newline at end of file +} diff --git a/android/src/main/kotlin/com/example/video_compress/VideoCompressPlugin.kt b/android/src/main/kotlin/com/spectora/video_compress/VideoCompressPlugin.kt similarity index 93% rename from android/src/main/kotlin/com/example/video_compress/VideoCompressPlugin.kt rename to android/src/main/kotlin/com/spectora/video_compress/VideoCompressPlugin.kt index 2861da1d..30ab48b9 100644 --- a/android/src/main/kotlin/com/example/video_compress/VideoCompressPlugin.kt +++ b/android/src/main/kotlin/com/spectora/video_compress/VideoCompressPlugin.kt @@ -1,4 +1,4 @@ -package com.example.video_compress +package com.spectora.video_compress import android.content.Context import android.net.Uri @@ -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 @@ -79,8 +79,8 @@ class VideoCompressPlugin : MethodCallHandler, FlutterPlugin { val path = call.argument("path")!! val quality = call.argument("quality")!! val deleteOrigin = call.argument("deleteOrigin")!! - val startTime = call.argument("startTime") - val duration = call.argument("duration") + val startTime = call.argument("startTime") + val duration = call.argument("duration") val includeAudio = call.argument("includeAudio") ?: true val frameRate = if (call.argument("frameRate")==null) 30 else call.argument("frameRate") @@ -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)) } diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 3629ef02..5755c624 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -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' @@ -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" @@ -53,6 +55,13 @@ android { signingConfig signingConfigs.debug } } + namespace "com.example.video_compress_example" + + + + + + } flutter { @@ -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' diff --git a/example/android/app/src/debug/AndroidManifest.xml b/example/android/app/src/debug/AndroidManifest.xml index 8d6c2e59..f880684a 100644 --- a/example/android/app/src/debug/AndroidManifest.xml +++ b/example/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index bc57e571..172d38c7 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ +> diff --git a/example/android/build.gradle b/example/android/build.gradle index c10ca09f..3402903d 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -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" } } @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/example/android/gradle.properties b/example/android/gradle.properties index b6e61b62..b4979fd4 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -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 + diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index fed8471d..8f79fd39 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec deleted file mode 100644 index 663d5b29..00000000 --- a/example/ios/Flutter/Flutter.podspec +++ /dev/null @@ -1,18 +0,0 @@ -# -# NOTE: This podspec is NOT to be published. It is only used as a local source! -# This is a generated file; do not edit or check into version control. -# - -Pod::Spec.new do |s| - s.name = 'Flutter' - s.version = '1.0.0' - s.summary = 'High-performance, high-fidelity mobile apps.' - s.homepage = 'https://flutter.io' - s.license = { :type => 'MIT' } - s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } - s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } - s.ios.deployment_target = '9.0' - # Framework linking is handled by Flutter tooling, not CocoaPods. - # Add a placeholder to satisfy `s.dependency 'Flutter'` plugin podspecs. - s.vendored_frameworks = 'path/to/nothing' -end diff --git a/example/lib/main.dart b/example/lib/main.dart index d2beae6b..d4e449f0 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -75,7 +75,7 @@ class _MyHomePageState extends State { ), Text( '$_counter', - style: Theme.of(context).textTheme.headline4, + style: Theme.of(context).textTheme.titleMedium, ), InkWell( child: Icon( diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index 060cec7b..c47b05af 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXAggregateTarget section */ @@ -203,7 +203,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 0930; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { @@ -278,6 +278,7 @@ }; 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -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; @@ -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; @@ -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; diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index ae8ff59d..7fd7126b 100644 --- a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ '../LICENSE' } s.author = { 'Jonny Borges' => 'jonataborges01@gmail.com' } s.source = { :path => '.' } diff --git a/lib/src/video_compress/video_compressor.dart b/lib/src/video_compress/video_compressor.dart index 3b7b38e3..7153c7c4 100644 --- a/lib/src/video_compress/video_compressor.dart +++ b/lib/src/video_compress/video_compressor.dart @@ -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'; @@ -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 { diff --git a/macos/video_compress.podspec b/macos/video_compress.podspec index 788046c2..a68cb04c 100644 --- a/macos/video_compress.podspec +++ b/macos/video_compress.podspec @@ -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' diff --git a/pubspec.yaml b/pubspec.yaml index c7a901bb..8703c6f2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,61 +1,25 @@ name: video_compress description: Light library of video manipulation of Flutter. Compress video, remove audio, get video thumbnail from dart code. -version: 3.1.2 -homepage: https://github.com/jonataslaw/VideoCompress +version: 1.0.0 +homepage: https://github.com/SpectoraSoftware/VideoCompress environment: - sdk: '>=2.16.2 <3.0.0' + sdk: '>=2.16.2 <4.0.0' flutter: ">=2.0.0" dependencies: flutter: sdk: flutter -# dev_dependencies: -# flutter_test: -# sdk: flutter - -# For information on the generic Dart part of this file, see the -# following page: https://www.dartlang.org/tools/pub/pubspec - flutter: plugin: platforms: android: - package: com.example.video_compress + package: com.spectora.video_compress pluginClass: VideoCompressPlugin ios: pluginClass: VideoCompressPlugin macos: pluginClass: VideoCompressPlugin - # To add assets to your plugin package, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - # - # For details regarding assets in packages, see - # https://flutter.dev/assets-and-images/#from-packages - # - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # To add custom fonts to your plugin package, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts in packages, see - # https://flutter.dev/custom-fonts/#from-packages + \ No newline at end of file