WindowXML: Seek Slider for External Player
#1
Hey guys, I got another question I'm hoping you guys can help me out with (probably something easy I overlooked again, sorry in advance)

I have this script that controls an external player (chromecast). I got all the controls to work fine, except for the seek slider.

The Problem:
When I click the slider and drag, it starts okay. In the log, I see the new position is set correctly. But then things go haywire. The script keeps seeking to the same position over and over again. i.e. seek to 18 minutes using the slider, chromecast buffers, then starts playing from the new position. But then it seeks to that same position again, buffers again and plays again and so on. It' hard to explain exactly what's going on.

Hoping this will help: I basically have the same problem described by this guy:
Weird Slider behaviour


Here's the original code

The onClick() code for the Seek Slider Control:
PHP Code:
elif controlID == 501:
        
newSliderPercent int(self.SLIDER_SEEK.getPercent())
        
time.sleep(1)
        
self.set_Seeked_Position(newSliderPercent

The set_Seeked_Position function:
PHP Code:
def set_Seeked_Position(selfnewPercentage):
        if 
self.cc_duration 0:
            
# Get the new position in seconds
            
newPosition int((float(newPercentage) * float(self.cc_duration)) / 100)

            
# Now send the seek message to the CC
            
kodicast.cmc.seek(newPosition


I know this is kind of a long shot. But figured it wouldn't hurt to ask before throwing in the towel lol.
Reply
#2
Got bored and just messed with it again, I think I got an idea of what's going on. And I'm pretty sure it's just another amateur hour mistake by me. For anybody else who might ever have a problem with something like this:

(Saw this after adding some print statements to get more info from the log)

When the slider is dragged to seek to a new player position, an onClick is called for each percentage point that the slider is dragged to.
i.e. When dragging the slider from something like 4% to 30%, this drag action is translated to 26 onClick events. (I think / guessing)

So, with respect to the code I posted in the previous post, specifically everything under 'elif controlID == 501:',
Whenever the slider was dragged from percentage A to percentage B, control 501 (the slider control) was being "clicked" an X amount of times, where X is equal to
(Percentage A - Percentage B)

And this is why the script was seeking to that same position over and over again, instead of just once.

(This is all just me guessing. I don't actually know if this is really what's up.)


I don't think the slider control is intended for anything other than seeking Kodi's internal player and adjusting Kodi's volume. So this is probably not a bug but just how it is.

For anybody trying to work around this:
Dragging the slider doesn't work, but clicking the slider at the place you want to seek to works just fine. I just added a dialog that shows when the script is started, telling the user to be sure not to drag the slider, and to just click / touch the position on the slider they want to seek to instead. Not very 'elegant' lol, so if anybody has any other suggestions
Reply

Logout Mark Read Team Forum Stats Members Help
WindowXML: Seek Slider for External Player0