Looping video
- Juan Carlos
- Posts: 887
- Joined: Mon Sep 06, 2010 1:02 pm
Re: Looping video
To aovid the first black frame you can use the instruction SeekVideo and gives it the frame with image, the song like background you can use the tirck StopMusic(1) and after PlayMusic(1, 1).
- Juan Carlos
- Posts: 887
- Joined: Mon Sep 06, 2010 1:02 pm
Re: Looping video
The code for you:
Code: Select all
@REQUIRE "oggvorbis"
@REQUIRE "avcodec"
@VIDEO 1, "Videos/RomBoot3-0.mp4"
@MUSIC 1, "Melodias/TheCrackSong01.ogg"
Function p_IntroVideo()
;Also you can jump to music start
SeekMusic(1, 1000) ;Jump to 1000 miliseconds to avoid the silence start.
PlayMusic(1, 1) ;1 to infinite times, 0 to once.
SeekVideo(1, 1000) ;Jump to 1000 miliseconds to avoid the black first frame.
PlayVideo(1, #CENTER, #CENTER)
EndFunction
Function p_Main()
;This to play the video in loop:
StopMusic(1) ;Stop the background song when the video is finish.
p_IntroVideo() ;Here the program goes to p_IntroVideo() to play it in loop.
EndFunction
;Main function to run this program.
p_IntroVideo()
InstallEventHandler({OnVideoEnd=p_Main})
EscapeQuit(True)
Repeat
WaitEvent
Forever
- airsoftsoftwair
- Posts: 5433
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Looping video
If your aim is to have videos looping seamlessly, this is not possible. I think it's impossible to loop videos without a very short pause between the individual cycles...
Re: Looping video
Thank you. It almost works. The black frame is still there. And the music needs to be played outside the loop.Juan Carlos wrote: ↑Fri Aug 28, 2020 3:50 pm The code for you:Code: Select all
@REQUIRE "oggvorbis" @REQUIRE "avcodec" @VIDEO 1, "Videos/RomBoot3-0.mp4" @MUSIC 1, "Melodias/TheCrackSong01.ogg" Function p_IntroVideo() ;Also you can jump to music start SeekMusic(1, 1000) ;Jump to 1000 miliseconds to avoid the silence start. PlayMusic(1, 1) ;1 to infinite times, 0 to once. SeekVideo(1, 1000) ;Jump to 1000 miliseconds to avoid the black first frame. PlayVideo(1, #CENTER, #CENTER) EndFunction Function p_Main() ;This to play the video in loop: StopMusic(1) ;Stop the background song when the video is finish. p_IntroVideo() ;Here the program goes to p_IntroVideo() to play it in loop. EndFunction ;Main function to run this program. p_IntroVideo() InstallEventHandler({OnVideoEnd=p_Main}) EscapeQuit(True) Repeat WaitEvent Forever
It worked brilliantly in Designer, no visible seam at all. But with the hand coded project it doesn't work properly. And I don't really understand what to do about it.airsoftsoftwair wrote: ↑Sun Aug 30, 2020 10:26 pm If your aim is to have videos looping seamlessly, this is not possible. I think it's impossible to loop videos without a very short pause between the individual cycles...
- airsoftsoftwair
- Posts: 5433
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Looping video
My sincerest apologies. I went back and checked. I was experimenting with different formats to see what would work best as playback was so slow. Apparently I used an anim5 file in Designer. I assumed the options would be the same as for a video, but they are not.airsoftsoftwair wrote: ↑Tue Sep 01, 2020 8:33 pmThat is strange. How did you make it loop in Designer? Using action events?
Sorry for the confusion.