Skip to content

Commit

Permalink
Added seekbar to the .avi and other files.
Browse files Browse the repository at this point in the history
  • Loading branch information
octacode committed Jul 16, 2017
1 parent c94ae8b commit bbaa7c3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ dependencies {
androidTestCompile 'com.android.support:support-annotations:25.3.1'
provided 'com.squareup.dagger:dagger-compiler:1.2.5'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.14'
}

task generateWrapper(type: Wrapper) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import android.graphics.Color;
import android.graphics.PixelFormat;
import android.media.MediaMetadataRetriever;
import android.media.session.PlaybackState;
import android.net.Uri;
import android.os.Build;
Expand All @@ -41,6 +42,7 @@
import android.util.DisplayMetrics;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.widget.Toast;

import org.amahi.anywhere.AmahiApplication;
import org.amahi.anywhere.R;
Expand All @@ -58,6 +60,8 @@

import javax.inject.Inject;

import wseemann.media.FFmpegMediaMetadataRetriever;


public class TvPlaybackVideoFragment extends PlaybackFragment {

Expand Down Expand Up @@ -92,11 +96,10 @@ public void onCreate(Bundle savedInstanceState) {
}

private void setDuration() {
android.media.MediaPlayer mediaPlayer = android.media.MediaPlayer.create(getActivity(), getFileUri());
if(mediaPlayer!=null) {
mDuration = mediaPlayer.getDuration();
mediaPlayer.release();
}
FFmpegMediaMetadataRetriever mFFmpegMediaMetadataRetriever = new FFmpegMediaMetadataRetriever();
mFFmpegMediaMetadataRetriever .setDataSource(getFileUri().toString());
String mVideoDuration = mFFmpegMediaMetadataRetriever .extractMetadata(FFmpegMediaMetadataRetriever .METADATA_KEY_DURATION);
mDuration = Integer.parseInt(mVideoDuration);
}

private void playVideo() {
Expand Down

0 comments on commit bbaa7c3

Please sign in to comment.