diff --git a/app/build.gradle b/app/build.gradle index 08fac31..623a220 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -166,8 +166,8 @@ dependencies { implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' implementation 'com.github.GrenderG:Toasty:1.4.2' - implementation 'com.google.android.exoplayer:exoplayer:2.12.1' - implementation 'com.google.android.exoplayer:extension-mediasession:2.12.1' + implementation 'com.google.android.exoplayer:exoplayer:2.12.2' + implementation 'com.google.android.exoplayer:extension-mediasession:2.12.2' implementation "com.github.mabbas007:TagsEditText:1.0.5" implementation "com.github.bumptech.glide:glide:4.11.0" annotationProcessor "com.github.bumptech.glide:compiler:4.11.0" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index bbfff94..27cd325 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -10,7 +10,9 @@ --> - + diff --git a/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java b/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java index b7e26eb..1d5500e 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java +++ b/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java @@ -1318,11 +1318,11 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd } - private void stream(VideoData.Video video, String resolution, boolean autoPlay, long position, Uri subtitles, String lang) { - String videoURL = video.getFileUrl(resolution, PeertubeActivity.this); + private void stream(VideoData.Video video, String localTorrentUrl, String resolution, boolean autoPlay, long position, Uri subtitles, String lang) { + String videoURL = localTorrentUrl == null ? video.getFileUrl(resolution, PeertubeActivity.this) : localTorrentUrl; SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE); int video_cache = sharedpreferences.getInt(Helper.SET_VIDEO_CACHE, Helper.DEFAULT_VIDEO_CACHE_MB); - if (videoURL != null && videoURL.endsWith(".torrent")) { + if (videoURL != null && (videoURL.endsWith(".torrent") || videoURL.startsWith("magnet"))) { torrentStream.startStream(videoURL); return; } else { @@ -1438,13 +1438,13 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd finish(); }); dialogBuilder.setPositiveButton(R.string.play, (dialog, id) -> { - stream(video, resolution, autoPlay, position, subtitles, lang); + stream(video, null, resolution, autoPlay, position, subtitles, lang); dialog.dismiss(); }); alertDialog = dialogBuilder.create(); alertDialog.show(); } else { - stream(video, resolution, autoPlay, position, subtitles, lang); + stream(video, torrentLocal, resolution, autoPlay, position, subtitles, lang); }