anrayliu / pyvidplayer2

Reliable, easy, and fast video playing in Python
MIT License
32 stars 7 forks source link

Weird error when importing pyvidplayer2 #6

Closed Vxtzq closed 11 months ago

Vxtzq commented 1 year ago

Hello,

When i try to import pyvidplayer with this line : from pyvidplayer2 import Video

I get this error : TypeError: unsupported operand type(s) for |: 'type' and 'type' in line 131 of the pyvidplayer code

Why? is my import wrong?

Any help would be greatly appreciated

anrayliu commented 1 year ago

Hello,

What version of pyvidplayer2 are you using? What version of python are you using? And if you could provide some sample code, I can better debug this.

anrayliu commented 1 year ago

Try using a python above 3.10 and see if the problem persists.

Vxtzq commented 1 year ago

ok ill try, im using pyvidplayer latest version i think

Vxtzq commented 1 year ago

And python 3.8.10

Vxtzq commented 1 year ago

And this is my code :


from pyvidplayer2 import Video

# create video object

vid = Video("ressources/vid.mp4")

win = pygame.display.set_mode(vid.current_size)
pygame.display.set_caption(vid.name)

while vid.active:
    key = None
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            vid.stop()
        elif event.type == pygame.KEYDOWN:
            key = pygame.key.name(event.key)

    if key == "r":
        vid.restart()           #rewind video to beginning
    elif key == "p":
        vid.toggle_pause()      #pause/plays video
    elif key == "m":
        vid.toggle_mute()       #mutes/unmutes video
    elif key == "right":
        vid.seek(15)            #skip 15 seconds in video
    elif key == "left":
        vid.seek(-15)           #rewind 15 seconds in video
    elif key == "up":
        vid.set_volume(1.0)     #max volume
    elif key == "down":
        vid.set_volume(0.0)     #min volume
    elif key == "1":
        vid.set_speed(1.0)      #regular playback speed
    elif key == "2":
        vid.set_speed(2.0)      #doubles video speed

    # only draw new frames, and only update the screen if something is drawn

    if vid.draw(win, (0, 0), force_draw=False):
        pygame.display.update()

    pygame.time.wait(16) # around 60 fps

# close video when done

vid.close()
pygame.quit()```
anrayliu commented 11 months ago

Hello, after updating your Python, did this problem persist? If not, I will be closing this issue soon.