I've come across an issue when using .play() and stop() in one function.
When creating buttons for each of the methods videoplayer.stop() and videoplayer.play(), everything works perfectly fine.
But as soon as i combine them in one function, they don't work properly anymore:
directory = "/Users/..."
videofiles = [] # this is a list which gets filled with the video files in a specific folder
COUNT = 0
global videoplayer
global COUNT
def load_next_video():
increment() # basic function to increase the COUNT variable by one, so it pulls the next object from the videofiles list
videoplayer.load(r"{}".format(directory + "/" + videofiles[COUNT]))
def add_to_list():
videoplayer.stop()
load_next_video_()
videoplayer.play()
I've kept out the rest of the code, which are only some buttons and basic pack statements.
When i use my add_to_list function behind a button, the video just keeps playing and does not change.
Only when the video is fully played through and you click the button, a new video gets loaded.
I want to be able to change the video with one button click, even if the video is not completely over yet.
Does anyone have an idea how to fix this?