简体   繁体   中英

pygame play many movies

i'm trying to play few videos. And got error:

python2.6: ../../src/xcb_io.c:183: process_responses: Assertion `!(req && current_request && !(((long) (req->sequence) - (long) (current_request)) <= 0))' failed.

I think some error in threads, and pygame movie player.

In documentation on pygame wrote:

The video overlay planes are drawn on top of everything in the display window. To draw the movie as normal graphics into the display window, create an offscreen Surface and set that as the movie target. Then once per frame blit that surface to the screen

Could give me example anybody?

pygame.init()
screen = pygame.display.set_mode((1024, 768))
background = pygame.Surface((1024, 768))

screen.blit(background, (0, 0))
pygame.display.update()

movie = pygame.movie.Movie('media/video.mpg')
mrect = pygame.Rect(0,0,140,113)
movie.set_display(screen, mrect.move(65, 150))
movie.set_volume(0)
movie.play()

mrect2 = pygame.Rect(0,0,140,113)
movie2 = pygame.movie.Movie('media/video2.mpg')
movie2.set_display(screen, mrect2.move(350, 150))
movie2.set_volume(0)
movie2.play()

you are setting both videos on the same screen, that might be the cause of a multi-tread error. Try defining new Surfaces for each movie and blit those on the screen

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM