Psychopy Video Not Properly Playing After Pause

I’m attaching my code. Essentially, everything works fine, except the video doesn’t properly resume playing as it should. The audio continues, but the video does not resume properly. Please help. I’ve basically commented everything out, but to give an overview my code displays a dialogue box and pauses the video. If the passwords don’t match, the user is re-prompted until they enter the correct password. Once the password is entered correctly, the video should resume as normal. Also, I know that Python uses Lists, so excuse me for referring to them as arrays in my code. I’m just coming from C, so that’s what I’m used to. I will correct this moving forward.

#!/usr/bin/env python2
# -*- coding: utf-8 -*-

############################################################
#      This program is designed to play a video            #
#      where the user has to enter different passwords     #
#      to resume playing of the video file                 #
############################################################

from __future__ import division

from psychopy import visual, core, event, gui
import time, os
from timeit import default_timer

videopath = r'./Devin.mp4'
videopath = os.path.join(os.getcwd(), videopath)
if not os.path.exists(videopath):
    raise RuntimeError("Video File could not be found:" + videopath)

win = visual.Window([2500, 1600])

# Create your movie stim.
mov = visual.MovieStim2(win, videopath,
    size = 1280,
    pos=[0,420], 
    flipVert=False, flipHoriz=False,
    loop=False)
    
globalClock = core.Clock() # May use this to end the video 

#Passwords that are required to resume playing the video
progPassword = ['doggy', 'garbage', 'actively', 'caring']

# The intervals in time[] indicate when the video pause occurs in seconds 
# The times indicate the seconds after each previous interval passes
# The first interval is 0 + 90, so the pause occurs at 90 seconds
# The times[2] represents 90 + 135, or 225 seconds.
# So, the second pause occurs after a 3:45 progression into the movie
#times = [90, 135, 210, 285] 
times = [5, 5, 5, 5]
j = (len(progPassword) - 1) # Number of entries in the array 'password' -- count the commas in progPassword, that's the value of j
print(j)
# n = progPassword[-1] <-- refers to the last entry in an array in python

"""Program Start"""

i = 0 # Starts i = 0 because arrays are indexed at 0. times[0] corresponds to 90 seconds
while i <= j:
    start = time.time() # Starting a timer to run in tandem with the video
    future = start + times[i] 
    print(future)
    mov.play() 
    while time.time() < future: # Plays the video for the corresponding interval in time[i]
        mov.draw()
        win.flip()
        
    mov.pause()    
    while time.time() > future:  # Pauses the video and displays my dialogue box prompting
        myDlg = gui.Dlg(title = 'The password is: ' + progPassword[i])
        myDlg.addField('Please enter the password')
        myDlg.show()
        if myDlg.OK:
            userPassword = myDlg.data[0]
            if userPassword == progPassword[i]:
               i += 1
               print(i)
               break
            if userPassword != progPassword[i] or myDlg != myDlg.OK: 
               continue # If user doesn't enter the correct password, then the loop repeats until the correct password is entered

"""Playing movie until EOF"""

mov.play()
while i > j:
    mov.draw()
    win.flip()
       
win.close()
core.quit()

In the Coder demos>stimuli there is a demo called MoviePause using a simpler mechanism of just using core.wait() after mov.pause(). Does that work for you? Does MovieStim3 behave better than MovieStim2? Trying to work out if this is a PsychoPy bug or an issue with your code.

cheers,
Jon