PaulleDemon / tkVideoPlayer

Video player for tkinter.
MIT License
79 stars 25 forks source link

Pause and Stop functions don't work #39

Closed LeonPupier closed 11 months ago

LeonPupier commented 1 year ago

Hey, When a video is playing, and by pressing a button I launch a function which calls video.pause() or video.close(), nothing happens. Video appears and plays well but won't pause or stop... I'm on Ubuntu with the latest pip version of your package.

Here is my code:

...

# Init the video
self.video = TkinterVideo(master=self, scaled=True)
self.video.load("test.mp4")
self.video.play()
self.video.pack(expand=True, fill="both")

# Init the button to go to the next video normally...
self.button = customtkinter.CTkButton(self, text="Next")
self.button.configure(command=self.step_2)
self.button.pack()

def step_2(self):
  self.video.pause()
  ...

Thank you very much in advance for any help, Leon

PaulleDemon commented 1 year ago

Hi @LeonPupier Would you mind showing a screen recording and a minimal reproducible example, I am on Ubuntu as well, and it works as expected for me.

LeonPupier commented 1 year ago

Okkaayy I just got it. Actually everything works fine, but I would like my video to loop once it reaches the end so I put a tkinter loop like this:

def loop(self):
    # Replay the video if it's the end
    if self.video.is_paused():
        self.video.play()

    # Loop method
    self.after(10, self.loop)

So she doesn't care about the pause AND the stop sign... Is there a better technique?

PaulleDemon commented 11 months ago

Hi sorry for the late reply please upgrade the library and use the example: https://github.com/PaulleDemon/tkVideoPlayer/blob/master/examples/loop_example.py