From 3f6da4102e8a14862ebe907123ccf57627b40ef1 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Fri, 15 Jul 2022 10:16:31 +0200 Subject: [PATCH] fix open crash --- .../java/com/github/libretube/fragments/PlayerFragment.kt | 8 ++++++-- app/src/main/res/layout/fragment_player.xml | 2 +- app/src/main/res/values/strings.xml | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) 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 b05624a71..51ceca53a 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -892,7 +892,7 @@ class PlayerFragment : Fragment() { } if (response.hls != null) { - binding.relPlayerVlc.setOnClickListener { + binding.relPlayerOpen.setOnClickListener { // start an intent with video as mimetype using the hls stream val uri: Uri = Uri.parse(response.hls) val intent = Intent() @@ -904,7 +904,11 @@ class PlayerFragment : Fragment() { intent.putExtra("artist", uploader) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) - startActivity(intent) + try { + startActivity(intent) + } catch (e: Exception) { + Toast.makeText(context, R.string.no_player_found, Toast.LENGTH_SHORT).show() + } } } if (relatedStreamsEnabled) { diff --git a/app/src/main/res/layout/fragment_player.xml b/app/src/main/res/layout/fragment_player.xml index 6584543e2..527da5407 100644 --- a/app/src/main/res/layout/fragment_player.xml +++ b/app/src/main/res/layout/fragment_player.xml @@ -185,7 +185,7 @@ Automatically switch to player fullscreen when the device gets turned. Pure theme Pure white/black theme + No external player found. Please make sure you have one installed. \ No newline at end of file