Ren'Py [solved] Playing video in screen with no loops?

Lou111

Active Member
Jun 2, 2018
538
680
How do you stop a video from looping when played in a screen?
I register the video to a channel with looping == False and also say 0 loops and it just keeps on keeping on...
I could do something really neat if I could change that.

Python:
init python:
    renpy.music.register_channel("movie", mixer="voice", loop=False, stop_on_mute=False, tight=False, file_prefix='', file_suffix='', buffer_queue=True, movie=True)
 
    setattr(store, "/movie/movie.webm", Movie(size=(480,720), play="/movie/movie.webm", channel="movie"))

label start:
    var1 = "/movie/movie.webm"


screen movie1():
    add getattr(store, var1):
        xalign 0.5
        ypos 75
       #  SetVariable(PleaseStopLooping, True)

Thanks! (y)
 

LightmanP

Well-Known Member
Modder
Game Developer
Oct 5, 2020
1,672
15,505
loop=False is set for your new audio channel which makes audio files played on it not loop by default, it does not apply to a movie. You need to add loop=False to your Movie statement instead. I'd also suggest adding image= to the Movie, so that it shows after a loop ends instead of switching to a transparent screen. Sometimes I prefer to have a timed pause for 1 loop instead since that allows to have a smooth transition to the next image instead of suddenly changing to the one set in image=.

Not sure why you need to register a new audio channel, if you want to tie movie audio to an existing mixer, it's easier to do define config.movie_mixer = "voice".
 
  • Love
Reactions: Lou111

Lou111

Active Member
Jun 2, 2018
538
680
loop=False is set for your new audio channel which makes audio files played on it not loop by default, it does not apply to a movie. You need to add loop=False to your Movie statement instead. I'd also suggest adding image= to the Movie, so that it shows after a loop ends instead of switching to a transparent screen. Sometimes I prefer to have a timed pause for 1 loop instead since that allows to have a smooth transition to the next image instead of suddenly changing to the one set in image=.

Not sure why you need to register a new audio channel, if you want to tie movie audio to an existing mixer, it's easier to do define config.movie_mixer = "voice".
You're fantastic.
Like showing movies in the Image() statement, my brain just accepted that videos that contain audio had to be registered to audio channels... it made so much sense until now. (mostly because of Movie argument while registering the channel)
I just plugged loop=False in the setattr() and changed the channel to something random. Worked like a charm.
Thank you, friend.
 
Last edited:
  • Like
Reactions: LightmanP