Don't try to play again the video in case of error

When we detected a playback error due to a too small downloaded file
the user had the choice to try again to play the video. On OSMC+raspi3
it was leading to a crash everytime the user was trying to play again
the video.
To avoid this now the user is only offered the option to pause or not
the download: the user will have to manually play again the video.
Depending on the user feedbacks and the test on other platforms (for
instance if the code that was removed is actually working on other
platforms), we may enable back this feature.
This commit is contained in:
Thomas Bétous 2021-11-07 22:55:25 +01:00
parent 6d26b5d9c4
commit efe953d6a5
4 changed files with 23 additions and 14 deletions

View File

@ -216,5 +216,8 @@ msgid "Playback error"
msgstr "" msgstr ""
msgctxt "#30424" msgctxt "#30424"
msgid "When the playback started, the portion of the video that was downloaded was probably not big enough. Do you want to try again to play the video?\n(If this error occurs often you should increase the initial wait time in the settings.)" msgid "When the playback started, the portion of the video that was downloaded was probably not big enough.\n"
"The video is being downloaded in the backgroud: do you want to stop the download?\n"
"Answer \"no\" if you plan to try again to play the video (but you should wait a few seconds).\n"
"Otherwise answer \"yes\"."
msgstr "" msgstr ""

View File

@ -217,5 +217,8 @@ msgid "Playback error"
msgstr "" msgstr ""
msgctxt "#30424" msgctxt "#30424"
msgid "When the playback started, the portion of the video that was downloaded was probably not big enough. Do you want to try again to play the video?\n(If this error occurs often you should increase the initial wait time in the settings.)" msgid "When the playback started, the portion of the video that was downloaded was probably not big enough.\n"
"The video is being downloaded in the backgroud: do you want to stop the download?\n"
"Answer \"no\" if you plan to try again to play the video (but you should wait a few seconds).\n"
"Otherwise answer \"yes\"."
msgstr "" msgstr ""

View File

@ -224,5 +224,11 @@ msgid "Playback error"
msgstr "Erreur de lecture" msgstr "Erreur de lecture"
msgctxt "#30424" msgctxt "#30424"
msgid "When the playback started, the portion of the video that was downloaded was probably not big enough. Do you want to try again to play the video?\n(If this error occurs often you should increase the initial wait time in the settings.)" msgid "When the playback started, the portion of the video that was downloaded was probably not big enough.\n"
msgstr "Quand la lecture a démarré, la portion de la vidéo qui avait été téléchargée était certainement trop petite. Voulez-vous essayer de lire la vidéo à nouveau ?\n(Si cette erreur survient souvent vous devriez augmenter le délai d'attente initial dans les paramètres.)" "The video is being downloaded in the backgroud: do you want to stop the download?\n"
"Answer \"no\" if you plan to try again to play the video (but you should wait a few seconds).\n"
"Otherwise answer \"yes\"."
msgstr "Quand la lecture a démarré, la portion de la vidéo qui avait été téléchargée était certainement trop petite.\n"
"La vidéo est en train d'être téléchargée en arrière plan : voulez-vous arrêter le téléchargement ?\n"
"Utilisez \"non\" si vous allez essayer de lire la vidéo de nouveau (mais vous devriez attendre quelques secondes).\n"
"Utilisez \"oui\" sinon."

View File

@ -51,8 +51,8 @@ class PeertubePlayer(xbmc.Player):
any error and it was stopped willingly by the user. In this case we any error and it was stopped willingly by the user. In this case we
pause the download of the torrent to avoid downloading in background a pause the download of the torrent to avoid downloading in background a
video which may never be played again. video which may never be played again.
But if no file was being played, we ask the user if we should try again But if no file was being played, we ask the user if the download should
to play the file: it supports the use case when the playback started be paused or not: it supports the use case when the playback started
whereas the portion of the file that was downloaded was not big enough. whereas the portion of the file that was downloaded was not big enough.
""" """
# First check if the file that was being played belongs to this add-on # First check if the file that was being played belongs to this add-on
@ -60,9 +60,9 @@ class PeertubePlayer(xbmc.Player):
if self.torrent_url is not None: if self.torrent_url is not None:
# Then check if the playback actually started: if the playback # Then check if the playback actually started: if the playback
# didn't start (probably because there was a too small portion of # didn't start (probably because there was a too small portion of
# the file that was downloaded), do not pause the torrent (Kodi # the file that was downloaded), ask the user if the download of
# do not call onPlayBackError() in this case for some reason...) # the torrent should be paused (Kodi do not call onPlayBackError()
# and ask the user what should be done. # in this case for some reason...).
# Otherwise pause the torrent because we consider the user decided # Otherwise pause the torrent because we consider the user decided
# to stop the playback. # to stop the playback.
if self.playback_started: if self.playback_started:
@ -72,13 +72,10 @@ class PeertubePlayer(xbmc.Player):
self.playback_started = False self.playback_started = False
else: else:
self.debug(message="Playback stopped but an error was" self.debug(message="Playback stopped but an error was"
" detected: asking the user what should be" " detected: asking the user if the"
" done.") " download must be stopped.")
if kodi.open_yes_no_dialog(title=kodi.get_string(30423), if kodi.open_yes_no_dialog(title=kodi.get_string(30423),
message=kodi.get_string(30424)): message=kodi.get_string(30424)):
self.debug(message="Trying to play the video again...")
self.play(item=self.run_url)
else:
self.debug(message="Pausing the download...") self.debug(message="Pausing the download...")
self.pause_torrent() self.pause_torrent()
self.torrent_url = None self.torrent_url = None