From 70a0d0f7a9bd466be183c5e3aeb186e4704c34f2 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 19 Mar 2020 17:24:56 +0100 Subject: [PATCH] properly handle content uris as Panorama Videos --- .../pro/activities/PanoramaVideoActivity.kt | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PanoramaVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PanoramaVideoActivity.kt index 510f71792..b9a7976c3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PanoramaVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PanoramaVideoActivity.kt @@ -13,7 +13,6 @@ import android.widget.SeekBar import com.google.vr.sdk.widgets.video.VrVideoEventListener import com.google.vr.sdk.widgets.video.VrVideoView import com.simplemobiletools.commons.extensions.* -import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.extensions.* import com.simplemobiletools.gallery.pro.helpers.MIN_SKIP_LENGTH @@ -44,14 +43,7 @@ open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeList supportActionBar?.hide() checkNotchSupport() - handlePermission(PERMISSION_WRITE_STORAGE) { - if (it) { - checkIntent() - } else { - toast(R.string.no_storage_permissions) - finish() - } - } + checkIntent() } override fun onResume() { @@ -99,9 +91,14 @@ open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeList try { val options = VrVideoView.Options() options.inputType = VrVideoView.Options.TYPE_MONO + val uri = if (path.startsWith("content://")) { + Uri.parse(path) + } else { + Uri.fromFile(File(path)) + } vr_video_view.apply { - loadVideo(Uri.fromFile(File(path)), options) + loadVideo(uri, options) pauseVideo() setFlingingEnabled(true)