diff --git a/app/build.gradle b/app/build.gradle
index 956f95d..ea8cc53 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -4,7 +4,7 @@ android {
compileSdkVersion 27
defaultConfig {
applicationId "net.schueller.peertube"
- minSdkVersion 24
+ minSdkVersion 23
targetSdkVersion 27
versionCode 100
versionName "1.0.0"
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 2a335cb..baeaede 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -27,8 +27,10 @@
android:name=".activity.LoginActivity"
android:label="@string/title_activity_login" />
(), VideoListActivity.this);
recyclerView.setAdapter(videoAdapter);
- loadVideos(currentStart, count, sort);
+ loadVideos(currentStart, count, sort, filter);
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
@@ -211,7 +215,7 @@ public class VideoListActivity extends AppCompatActivity {
if(!recyclerView.canScrollVertically(RecyclerView.FOCUS_DOWN)){
if (!isLoading) {
currentStart = currentStart + count;
- loadVideos(currentStart, count, sort);
+ loadVideos(currentStart, count, sort, filter);
}
}
}
@@ -223,13 +227,13 @@ public class VideoListActivity extends AppCompatActivity {
// Refresh items
if (!isLoading) {
currentStart = 0;
- loadVideos(currentStart, count, sort);
+ loadVideos(currentStart, count, sort, filter);
}
});
}
- private void loadVideos(int start, int count, String sort) {
+ private void loadVideos(int start, int count, String sort, String filter) {
isLoading = true;
@@ -237,7 +241,7 @@ public class VideoListActivity extends AppCompatActivity {
GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL + "/api/v1/").create(GetVideoDataService.class);
- Call call = service.getVideosData(start, count, sort);
+ Call call = service.getVideosData(start, count, sort, filter);
/*Log the URL called*/
Log.d("URL Called", call.request().url() + "");
diff --git a/app/src/main/java/net/schueller/peertube/activity/TorrentVideoPlayActivity.java b/app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java
similarity index 70%
rename from app/src/main/java/net/schueller/peertube/activity/TorrentVideoPlayActivity.java
rename to app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java
index 3cb6451..8881c63 100644
--- a/app/src/main/java/net/schueller/peertube/activity/TorrentVideoPlayActivity.java
+++ b/app/src/main/java/net/schueller/peertube/activity/VideoPlayActivity.java
@@ -1,13 +1,16 @@
package net.schueller.peertube.activity;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
+import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
+import android.view.Surface;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
@@ -18,7 +21,9 @@ import com.github.se_bastiaan.torrentstream.TorrentOptions;
import com.github.se_bastiaan.torrentstream.TorrentStream;
import com.github.se_bastiaan.torrentstream.listeners.TorrentListener;
import com.google.android.exoplayer2.ExoPlayerFactory;
+import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.SimpleExoPlayer;
+import com.google.android.exoplayer2.decoder.DecoderCounters;
import com.google.android.exoplayer2.source.ExtractorMediaSource;
import com.google.android.exoplayer2.source.MediaSource;
import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
@@ -31,6 +36,7 @@ import com.google.android.exoplayer2.upstream.DataSource;
import com.google.android.exoplayer2.upstream.DefaultBandwidthMeter;
import com.google.android.exoplayer2.upstream.DefaultDataSourceFactory;
import com.google.android.exoplayer2.util.Util;
+import com.google.android.exoplayer2.video.VideoRendererEventListener;
import net.schueller.peertube.R;
import net.schueller.peertube.helper.APIUrlHelper;
@@ -44,17 +50,18 @@ import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
-public class TorrentVideoPlayActivity extends AppCompatActivity {
+public class VideoPlayActivity extends AppCompatActivity implements VideoRendererEventListener {
- private static final String TAG = "TorrentVideoPlayActivity";
+ private static final String TAG = "VideoPlayActivity";
private ProgressBar progressBar;
+ private PlayerView simpleExoPlayerView;
private SimpleExoPlayer player;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_torrent_video_play);
+ setContentView(R.layout.activity_video_play);
// get video ID
Intent intent = getIntent();
@@ -64,7 +71,9 @@ public class TorrentVideoPlayActivity extends AppCompatActivity {
progressBar = findViewById(R.id.progress);
progressBar.setMax(100);
- PlayerView videoView = findViewById(R.id.video_view);
+// PlayerView videoView = findViewById(R.id.video_view);
+ simpleExoPlayerView = new PlayerView(this);
+ simpleExoPlayerView = findViewById(R.id.video_view);
// 1. Create a default TrackSelector
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
@@ -75,8 +84,68 @@ public class TorrentVideoPlayActivity extends AppCompatActivity {
// 2. Create the player
player = ExoPlayerFactory.newSimpleInstance(getApplicationContext(), trackSelector);
- videoView.setPlayer(player);
+ simpleExoPlayerView.setPlayer(player);
+ // get video details from api
+ String apiBaseURL = APIUrlHelper.getUrl(this);
+ GetVideoDataService service = RetrofitInstance.getRetrofitInstance(apiBaseURL + "/api/v1/").create(GetVideoDataService.class);
+
+ Call