2016-03-17, 17:01
(2016-03-17, 12:52)dabinn Wrote: I found another issue, when pressing 'next' button to playt next video in the series, the subtitle is not loaded.
But if I played the video to the end, and the player loads the next video, the subtitle is OK.
I check the log file for the difference,
- in normal situation:
video played to the end --> CDVDPlayer::CloseFile() --> player.PlayStream() --> player.setsubtitle() -->new video loaded
- when pressing 'next' :
Player didn't know the video is about to be end --> player.PlayStream() --> player.setsubtitle() --> CDVDPlayer::CloseFile() -->new video loaded
The subtitle is cleared with the closing of previous video?
--
Edit:
Not sure how to resolve this, but add an 1 second delay before player.setsubtitle() seems to be a workaround.
This helps setsubtitle() executed after CDVDPlayer::CloseFile()
Code:diff --git a/default.py b/default.py
index 25645b5..c6f14b6 100644
--- a/default.py
+++ b/default.py
@@ -1344,7 +1344,8 @@ elif mode == 'audio' or mode == 'video' or mode == 'search' or mode == 'play' or
item.setPath(mediaURL.url)
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
-
+ if player.isPlaying():
+ xbmc.sleep(1000)
# need to seek?
if seek > 0:
Yes, the subtitles not loading unless there is a pause is a known KODI issue. I had the following to deal with that:
PHP Code:
# load captions
if (settings.srt or settings.cc) and service.protocol == 2:
while not (player.isPlaying()):
xbmc.sleep(1000)
But yes, because the player is already playing it is skipped and the subtitle isn't loaded. It doesn't distract from anything to add it.
I'm actually probably going to move the subtitle addition to the player object (tied to the OnPlayerStart). I'm adding support to playlists and adding subtitles needs to change.[/quote]