Retriggering Cutscenes Problem

I’m currently working on a game that requires cutscenes (playing movie textures). I managed to play both the movie texture along with the audio synchronized to the movie. Once after the cutscene is finished, I used a task function to remove the card (node path) used to display the movie. However, when I retrigger the cutscene that requires the software to play the same movie texture again, the application stops responding, as though it had enter an infinite loop or something.

I introduce the movie texture in the init function:

self.movieE=loader.loadTexture("Movies/goingup.avi")
self.cmE = CardMaker("My Fullscreen Card")
self.cmE.setFrameFullscreenQuad()
self.cmE.setUvRange(self.movieE)
self.soundE=loader.loadSfx("Movies/goingup.avi")
self.movieE.synchronizeTo(self.soundE)

When the characters enter a trigger zone that triggers the cutscene, I introduce a nodepath to display the movie texture, and I play the movie:

self.cardE = NodePath(self.cmE.generate()) 
self.cardE.reparentTo(render2d)
self.cardE.setTexture(self.movieE)
self.soundE.play()

After the trigger event finishes playing (using a task function), I remove the card texture:

if self.soundE.getTime()<=5:
                    print task.time
                    return Task.cont
                if self.soundE.getTime()>=5:
                    self.movieE.clear()
                    self.cardE.remove()
                    self.collide=0
                    self.escalator=0
                    return Task.done

It works perfectly fine till this stage. However, when I tried to retrigger this cutscene using the same function (which is necessary), the application stop responding.

self.cardE = NodePath(self.cmE.generate()) 
self.cardE.reparentTo(render2d)
self.cardE.setTexture(self.movieE)
self.soundE.play()

Would gladly appreciate any help on this problem. Thanks!

Make sure to stop the sound when done, and you don’t have to use task just to know if it’s finished. Use sound.setFinishedEvent, and accept the event.

    self.soundE.setFinishedEvent("finished !!!")
    self.accept('finished !!!', self.mediaFinished)

  def mediaFinished(self):
      self.soundE.stop()
      self.cardE.removeNode()
      print 'FINISHED !!'

Thanks ynjh_jo! setFinishedEvent helped in getting a more precise and efficient way of ending the movie.

However and peculiarly, when I attempt to play the movie texture once again by using the same nodepath after removing it when it has played finished, the application stops working.

Maybe this error could be the cause, which I’m unable to understand what error it is exactly:

:movies(error): Seek failure. Shutting down movie.

This error however do not show on the media player sample program, which might mean something’s wrong with my software.

Never happen to me. It must be your .AVI. How about the panda .AVI ?

Yeah, the pandasneeze avi works perfect. It can even be replayed.

This might mean that the avi I’m using has some problem. Initially my avi is rendered out using DV PAL, then I read up in the manual that the panda cannot support DV, so I tried rendering in 800x600 desktop. But it didn’t work too.