Fix Peertube videos

This commit is contained in:
Thomas 2022-09-07 19:16:38 +02:00
parent c9516e7763
commit 22d393919a
5 changed files with 25 additions and 3 deletions

View File

@ -10,8 +10,8 @@ android {
defaultConfig { defaultConfig {
minSdk 21 minSdk 21
targetSdk 31 targetSdk 31
versionCode 402 versionCode 403
versionName "3.1.0" versionName "3.1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
flavorDimensions "default" flavorDimensions "default"

View File

@ -1,4 +1,9 @@
[ [
{
"version": "3.1.1",
"code": "403",
"note": "Added:\n- Export Settings\n\nFixed:\n- Respect the default visibility account when replying\n- Discriminate gif from images\n- App crashes when opening external instance timeline\n- Remove button in thread composer crashes the app\n- Back button opens a lot of old activities before closing the app\n- Problems with sharing"
},
{ {
"version": "3.1.0", "version": "3.1.0",
"code": "402", "code": "402",

View File

@ -117,6 +117,21 @@ public class PeertubeVideo implements Serializable {
public List<File> files; public List<File> files;
@SerializedName("views") @SerializedName("views")
public int views; public int views;
@SerializedName("streamingPlaylists")
public List<StreamingPlaylist> streamingPlaylists;
}
public class StreamingPlaylist implements Serializable {
@SerializedName("id")
public String id;
@SerializedName("type")
public int type;
@SerializedName("playlistUrl")
public String playlistUrl;
@SerializedName("segmentsSha256Url")
public String segmentsSha256Url;
@SerializedName("files")
public List<File> files;
} }
public class File implements Serializable { public class File implements Serializable {

View File

@ -1119,7 +1119,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
// start the new activity // start the new activity
context.startActivity(mediaIntent, options.toBundle()); context.startActivity(mediaIntent, options.toBundle());
}); });
if (statusToDeal.media_attachments.get(0).type != null && statusToDeal.media_attachments.get(0).type.equalsIgnoreCase("video")) { if (statusToDeal.media_attachments.get(0).type != null && (statusToDeal.media_attachments.get(0).type.equalsIgnoreCase("video") || statusToDeal.media_attachments.get(0).type.equalsIgnoreCase("gifv"))) {
layoutMediaBinding.playVideo.setVisibility(View.VISIBLE); layoutMediaBinding.playVideo.setVisibility(View.VISIBLE);
} else { } else {
layoutMediaBinding.playVideo.setVisibility(View.GONE); layoutMediaBinding.playVideo.setVisibility(View.GONE);

View File

@ -210,6 +210,8 @@ public class FragmentMedia extends Fragment {
timelinesVM.getPeertubeVideo(attachment.peertubeHost, attachment.peertubeId).observe(requireActivity(), video -> { timelinesVM.getPeertubeVideo(attachment.peertubeHost, attachment.peertubeId).observe(requireActivity(), video -> {
if (video != null && video.files != null && video.files.size() > 0) { if (video != null && video.files != null && video.files.size() > 0) {
loadVideo(video.files.get(0).fileUrl, finalType); loadVideo(video.files.get(0).fileUrl, finalType);
} else if (video != null && video.streamingPlaylists != null && video.streamingPlaylists.size() > 0 && video.streamingPlaylists.get(0).files.size() > 0) {
loadVideo(video.streamingPlaylists.get(0).files.get(0).fileUrl, finalType);
} }
}); });
} else { } else {