Browse Source

ExternalBrowser: reset player for unlabelled media

Some browsers won't prefix intent types with "video", if a video is
already playing in background, it will play the new video in background.
Because of this, it is safer to stop the player, causing 'isPlaying' to
go false in playIndex(...) and not keeping the previous state.
merge-requests/2174/head
Duncan McNamara 2 years ago
committed by Nicolas Pomepuy
parent
commit
1f6022014c
  1. 8
      application/vlc-android/src/org/videolan/vlc/StartActivity.kt

8
application/vlc-android/src/org/videolan/vlc/StartActivity.kt

@ -291,7 +291,13 @@ class StartActivity : FragmentActivity() {
}
intent.data?.authority == getString(R.string.tv_provider_authority) -> MediaUtils.openMediaNoUiFromTvContent(this@StartActivity, intent.data)
intent.data?.authority == "skip_to" -> PlaybackService.instance?.playIndex(intent.getIntExtra("index", 0))
else -> withContext(Dispatchers.IO) { FileUtils.getUri(intent.data)}?.let { MediaUtils.openMediaNoUi(it) }
else -> withContext(Dispatchers.IO) { FileUtils.getUri(intent.data)}?.let {
// Some media might not be properly labeled
// As the last option, it is safer to reset the player before playing any media
if (PlaybackService.instance?.isPlaying == true)
PlaybackService.instance?.playlistManager?.player?.stop()
MediaUtils.openMediaNoUi(it)
}
}
finish()
}

Loading…
Cancel
Save