So I'm trying to implement some videos onto an already existing pygame program that uses the pygame_functions (see https://github.com/StevePaget/Pygame_Functions/blob/master/pygame_functions.py). I found a pyvidplayer that seems to allow videos on python with very simple code (https://github.com/ree1261/pyvidplayer/blob/main/pyvidplayer.py). I've tried implementing a video to a step of the task, but when I run this code, the program gets stuck. After getting the participant's name the task usually follows with the instructions page, but in my case (after adding the video) it freezes.
Ideally I would like the program to continue once the video is finished as it did before.
The programs main.py starts off like this
pygame.init()
pygame.font.init()
screenSize = (1200, 800)  
size = (6, 6)  # can be changed to any n x m grid
# add participant information
part = Start(screenSize, overall_score)
participant = part.add_participant()
# display consent
start = Start(screenSize, overall_score)
cons = start.add_consent()
# start the game and get username
start = Start(screenSize, overall_score)
username = start.add_name()
# display instruction
start = Start(screenSize, overall_score)
instr = start.add_instruction()
Here is the start Class and the definition I added the video to:
class Start:
    def __init__(self, screenSize, overall_score):
        self.screenSize = screenSize
        self.overall_score = overall_score
        self.username = None
        self.participant = None
        self.instruction = None
        self.robot = None
        self.consent = None
    def add_name(self):
        screen = screenSize(self.screenSize[0], self.screenSize[1])
        screen
        setBackgroundColour("white")
        videoSurface = pygame.Surface((800,800))
        instruction = makeLabel("Please enter a nickname: ", 30, 240, 30, "black", "Arial", "white")
        showLabel(instruction)
        wordBox = makeTextBox(240, 110, 300, 0, "Enter Text here", 0, 24)
        showTextBox(wordBox)
        
        vid = Video(r"Clips/Edited_welcome_name.mp4")
        vid.set_size((800,800))
        while True:
            
            vid.draw(videoSurface, (0, 0))
            screen.blit(videoSurface, (600,0))
            pygame.display.update()
            for event in pygame.event.get():
                if event.type == pygame.KEYDOWN:
                    vid.close()
                    videoSurface.fill((255,255,255))
                    screen.blit(videoSurface, (600,0))
                    
        self.username = textBoxInput(wordBox)
        return self.username
Any help would be greatly appreciated. Please bare in mind I'm very new to pygame and don't really know what I'm doing.