Stopping an AVI file after it plays once [SOVLED] thanks!

Hi,

I’ve tried using the

movie.setLoopCount(n)

found here panda3d.org/manual/index.php … _AVI_files

to try and set the loop count of the movie to 0 I’m guessing thats what the code is suppose to do?

But what I want it to do is play the movie once and not have it loop but just stop.

Here is my whole code file:

import direct.directbase.DirectStart

#Set the backgroung color
base.setBackgroundColor(0, 0, 0)

   
#Load and display front end
#Load cardmaker to display movie on
#Front end code example to help me was done by: powerpup118 on panda3d forums
from pandac.PandaModules import CardMaker
from pandac.PandaModules import NodePath
from pandac.PandaModules import TextureStage

#Load the movie onto default panda mode
front_end_movie=loader.loadTexture("eve_rts/video/front_end.avi")
myObject = loader.loadModel("smiley")
myObject.setTexture(front_end_movie, True)
myObject.reparentTo(render)


#Create cardmaker object
cm = CardMaker("My Fullscreen Card");
cm.setFrameFullscreenQuad()
cm.setUvRange(front_end_movie)
card = NodePath(cm.generate())
card.reparentTo(render2d)
card.setTexture(front_end_movie) 

run()

So the program starts playing the movie right away but will keep looping it and I have no clue how to put in a countermesure to just stop it from looping :imp:

Now should I somehow destroy the card. at the end or after a certain time to earase it? would that be better such as after the say 15 second movie is done the cardMaker is destoryed and will not display the movie on it but then how would i do that?

Is there a thing in panda that you can have something wait a certain time such as I know my video file is 15 seconds I can say movie.stop() after 15 seconds.

Yes, this is taskMgr.doMethodLater(), as described in the manual.

Though you could also just call movie.play(), which means to play the movie exactly once and then stop, as opposed to the default which is movie.loop(), which means to loop forever.

David

Thing is the movie is set on a model which plays on the cardMaker and I’m not calling movie.play() to play the movie… so is there another way to play a movie other than using cardMaker.

What i’m trying to do is load movie at start of program plays the movie then stops at end of movie.

Is there anther way to just load an avi file and then say play movie as you said movie.play() and thats it without using cardMaker?

heres is my updated code:

import direct.directbase.DirectStart

#Set the backgroung color
base.setBackgroundColor(0, 0, 0)

def front_end():

    #Load and display front end
    #Load cardmaker to display movie on
    #Front end code example to help me was done by: powerpup118 on panda3d forums
    from pandac.PandaModules import CardMaker
    from pandac.PandaModules import NodePath
    from pandac.PandaModules import TextureStage

    #Load the movie onto default panda mode
    front_end_movie=loader.loadTexture("eve_rts/video/front_end.avi")
    myObject = loader.loadModel("smiley")
    myObject.setTexture(front_end_movie, True)
    myObject.reparentTo(render)


    #Create cardmaker object
    cm = CardMaker("My Fullscreen Card");
    cm.setFrameFullscreenQuad()
    cm.setUvRange(front_end_movie)
    card = NodePath(cm.generate())
    card.reparentTo(render2d)
    card.setTexture(front_end_movie)
    #Set dispaly paramiters if needed
    #card.setTexScale(TextureStage.getDefault(), myMovieTexture.getTexScale())

    return

front_end()




run()

Got it to work thanks for the help heres what I did:

import direct.directbase.DirectStart

#Set the backgroung color
base.setBackgroundColor(0, 0, 0)



#Load and display front end
#Load cardmaker to display movie on
#Front end code example to help me was done by: powerpup118 on panda3d forums
from pandac.PandaModules import CardMaker
from pandac.PandaModules import NodePath
from pandac.PandaModules import TextureStage

#Load the movie onto default panda mode
front_end_movie=loader.loadTexture("eve_rts/video/front_end.avi")
myObject = loader.loadModel("smiley")
myObject.setTexture(front_end_movie, True)
myObject.reparentTo(render)


#Create cardmaker object
cm = CardMaker("My Fullscreen Card");
cm.setFrameFullscreenQuad()
cm.setUvRange(front_end_movie)
card = NodePath(cm.generate())
card.reparentTo(render2d)
card.setTexture(front_end_movie)
#Set dispaly paramiters if needed
#card.setTexScale(TextureStage.getDefault(), myMovieTexture.getTexScale())





def stop_movie(blank):
    front_end_movie.stop()

    return

taskMgr.doMethodLater(12, stop_movie, 'stop_movie')


run()

Thanks for the hint!

When you load a movie texture, it automatically calls loop() on itself by default, so that’s what happens if you do nothing.

If you call movie.play() immediately after loading it, that supercedes the implicit call to loop(). So if you call play(), there’s no need to call anything else if you just want it to play and then stop.

David