Skip to content

Commit

Permalink
fix: issues #81,#78
Browse files Browse the repository at this point in the history
  • Loading branch information
Gowtham committed Jun 11, 2022
1 parent b71b125 commit 2165f3d
Show file tree
Hide file tree
Showing 16 changed files with 2,940 additions and 24 deletions.
17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 31
compileSdkVersion 32
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.gowtham.videotrimmer"
minSdkVersion 19
targetSdkVersion 31
targetSdkVersion 32
versionCode 1
versionName "1.0"
multiDexEnabled true
Expand Down
15 changes: 7 additions & 8 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 31
compileSdkVersion 32
buildToolsVersion "31.0.0"

packagingOptions {
Expand All @@ -12,7 +12,7 @@ android {

defaultConfig {
minSdkVersion 19
targetSdkVersion 31
targetSdkVersion 32
consumerProguardFiles "consumer-rules.pro"

ndkVersion '22.1.7171670'
Expand Down Expand Up @@ -41,15 +41,14 @@ android {

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.exoplayer:exoplayer:2.17.1'
implementation 'com.crystal:crystalrangeseekbar:1.1.3'
implementation 'com.arthenica:mobile-ffmpeg-min:4.4.LTS'
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
implementation 'com.github.bumptech.glide:glide:4.13.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.1'
implementation 'com.akexorcist:localization:1.2.9'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.google.code.gson:gson:2.9.0'
}
repositories {
mavenCentral()
Expand Down
21 changes: 11 additions & 10 deletions library/src/main/java/com/gowtham/library/ui/ActVideoTrimmer.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
import com.bumptech.glide.request.RequestOptions;
import com.crystal.crystalrangeseekbar.widgets.CrystalRangeSeekbar;
import com.crystal.crystalrangeseekbar.widgets.CrystalSeekbar;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.SimpleExoPlayer;
import com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.source.ProgressiveMediaSource;
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
import com.google.android.exoplayer2.ui.PlayerView;
import com.google.android.exoplayer2.ui.StyledPlayerView;
import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.upstream.DefaultDataSource;
import com.google.gson.Gson;
import com.gowtham.library.R;
import com.gowtham.library.ui.seekbar.widgets.CrystalRangeSeekbar;
import com.gowtham.library.ui.seekbar.widgets.CrystalSeekbar;
import com.gowtham.library.utils.CompressOption;
import com.gowtham.library.utils.CustomProgressView;
import com.gowtham.library.utils.FileUtils;
Expand All @@ -72,8 +72,8 @@
public class ActVideoTrimmer extends LocalizationActivity {

private static final int PER_REQ_CODE = 115;
private PlayerView playerView;
private SimpleExoPlayer videoPlayer;
private StyledPlayerView playerView;
private ExoPlayer videoPlayer;

private ImageView imagePlayPause;

Expand Down Expand Up @@ -194,7 +194,7 @@ private void setUpToolBar(ActionBar actionBar, String title) {
**/
private void initPlayer() {
try {
videoPlayer = new SimpleExoPlayer.Builder(this).build();
videoPlayer = new ExoPlayer.Builder(this).build();
playerView.setResizeMode(AspectRatioFrameLayout.RESIZE_MODE_FIT);
playerView.setPlayer(videoPlayer);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
Expand Down Expand Up @@ -284,7 +284,7 @@ private void seekTo(long sec) {

private void buildMediaSource(Uri mUri) {
try {
DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(this, getString(R.string.app_name));
DataSource.Factory dataSourceFactory = new DefaultDataSource.Factory(this);
MediaSource mediaSource = new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(MediaItem.fromUri(mUri));
videoPlayer.addMediaSource(mediaSource);
videoPlayer.prepare();
Expand All @@ -306,6 +306,7 @@ public void onPlaybackStateChanged(int state) {
break;
case Player.STATE_READY:
isVideoEnded = false;
imagePlayPause.setVisibility(View.GONE);
startProgress();
LogMessage.v("onPlayerStateChanged: Ready to play.");
break;
Expand Down Expand Up @@ -489,7 +490,7 @@ public boolean onPrepareOptionsMenu(Menu menu) {
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_done) {
//prevent multiple clicks
//preventing multiple clicks
if (SystemClock.elapsedRealtime() - lastClickedTime < 800)
return true;
lastClickedTime = SystemClock.elapsedRealtime();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.gowtham.library.ui.seekbar.interfaces;

/**
* Created by owais.ali on 7/14/2016.
*/
public interface OnRangeSeekbarChangeListener {
void valueChanged(Number minValue, Number maxValue);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.gowtham.library.ui.seekbar.interfaces;

/**
* Created by owais.ali on 7/14/2016.
*/
public interface OnRangeSeekbarFinalValueListener {
void finalValue(Number minValue, Number maxValue);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.gowtham.library.ui.seekbar.interfaces;

/**
* Created by owais.ali on 7/14/2016.
*/
public interface OnSeekbarChangeListener {
void valueChanged(Number value);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.gowtham.library.ui.seekbar.interfaces;

/**
* Created by owais.ali on 7/14/2016.
*/
public interface OnSeekbarFinalValueListener {
void finalValue(Number value);
}
Loading

0 comments on commit 2165f3d

Please sign in to comment.