-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop the current video before starting a new one. #44
base: master
Are you sure you want to change the base?
Conversation
This fixes the youtube app losing sync with the current playing video/position when starting a new video from the app while there was one already playing.
Maybe the addon should use onAVstarted event instead of onPlaybackStarted for all kodi versions since leia, this new event was not available by the time I build this plugin. By the time onPlaybackStarted is called, there's no guarantee a stream is already available in the player. |
I did some testing and with There is another issues though: it seems like yt really wants to know from us that we stopped playing the video we were playing before before starting the new one. (which calling We could call The working alternative is to call |
By the time onPlaybackStarted is triggered, the stream isn't yet available to Kodi's VideoPlayer. This means that our custom |
Can you explain a bit better how you're experiencing problems so I'm able to somehow reproduce the same behaviour? |
From the youtube app: start playing a video, wait a few seconds for kodi start playing it, then play another video without stopping the previous one (so that it enqueues it). |
I think that inside I tested calling |
@NextLight old code but could you check if the issue still exists with script.tubecast and youtube app clicking on play for two videos. I cannot reproduce with kodi 20.2 on Debian amd64 and latest script.tubecast 1.5.0+matrix.1, with youtube addon 7.0.2.2. |
This fixes the youtube app losing sync with the current playing video/position when starting a new video from the app while there was one already playing.
The reason why this happens is that for some reason
xbmc.Player
is reporting the oldtime
andtotalTime
insideonPlayBackStarted
, which causesreport_now_playing
to use the old values and YouTube gets confused by that.There are other, more complicated ways to approach this issue.
The thing I don't like about this approach is that it has to wait for the player to close and than open again, but I feel like it's good enough since it doesn't take that long and it keeps things easy.