From d48e8f5fb9775f2273cfcb5b2abf6118485d837d Mon Sep 17 00:00:00 2001 From: Bnyro Date: Thu, 16 Jun 2022 16:46:06 +0200 Subject: [PATCH 1/2] fix live videos not playing --- .../libretube/fragments/PlayerFragment.kt | 9 +++- .../main/res/layout-land/activity_main.xml | 52 +++++++++++++++++++ 2 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/layout-land/activity_main.xml diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt index f2d1aff9f..b354bc2bc 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -720,12 +720,18 @@ class PlayerFragment : Fragment() { setMediaSource(subtitle, videoUri, audioUrl) qualityText.text = videosNameArray[index] return@lit - } else if (index + 1 == response.videoStreams.size) { + } else if (response.hls != null) { val mediaItem: MediaItem = MediaItem.Builder() .setUri(response.hls) .setSubtitleConfigurations(subtitle) .build() exoPlayer.setMediaItem(mediaItem) + } else { + Toast.makeText( + context, + getString(R.string.unknown_error), + Toast.LENGTH_LONG + ).show() } } } @@ -967,7 +973,6 @@ class PlayerFragment : Fragment() { return@launchWhenCreated } catch (e: HttpException) { Log.e(TAG, "HttpException, unexpected response") - Toast.makeText(context, R.string.server_error, Toast.LENGTH_SHORT).show() return@launchWhenCreated } commentsAdapter = CommentsAdapter(videoId!!, commentsResponse.comments) diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml new file mode 100644 index 000000000..07cdfd792 --- /dev/null +++ b/app/src/main/res/layout-land/activity_main.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + \ No newline at end of file From 3621154e39d7a559a31cd398bbe18921200fa428 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Thu, 16 Jun 2022 16:47:26 +0200 Subject: [PATCH 2/2] ktlint --- .../main/res/layout-land/activity_main.xml | 52 ------------------- 1 file changed, 52 deletions(-) delete mode 100644 app/src/main/res/layout-land/activity_main.xml diff --git a/app/src/main/res/layout-land/activity_main.xml b/app/src/main/res/layout-land/activity_main.xml deleted file mode 100644 index 07cdfd792..000000000 --- a/app/src/main/res/layout-land/activity_main.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - \ No newline at end of file