Swap videos

Hi, here i have a project that needs to swap two videos.
At first it will play video1 loop , if i press ‘s’ and after video1 finished, it will play video2 loop. if i release ‘s’, after 30 seconds, it will play video1.

it is easy in c++, i can use four status: noPrs, gotoVideo2, playVideo2, gotoVideo1, and write some code like below:
if (status == noPrs) {
play video1
if (btnS) {
status = gotoVideo2;
}
} esle if (status == gotoVideo2) {
play video1
if (video1 end) {
status = playVideo2;
btnS = true;
}
} else if (status == playvideo2) {
play video2;
if (noPrs) {
if (btnS) {
t = now();
} else {
if (now() - t > 30) {
status = noPrs;
}
}
} else {
btnS = true;
}
}

can anyone tell how to implement it into vvvv?

First do basic tutorials this will help you to have vvvv approach

The chain for videos is usually
Dir / getslice string / filestream / videotexture / quad / renderer
Where getslice will be the selector of you file.
Toggle togedge decay switch will also help you

In c++ wich lib are you using ?

Yours

tks, i use openframeworks and gstream for play video. but the framerate is too low, so i swap it to vvvv, but can’t write the logic

Hum. It takes time to reconfigure the head in vvvv way but irs really powerfull. Do you want a patch or is it enough with the nodes i have enumerated?

a simple state machine can be found here: process-(animation)

i’ve tried delay, framedelay, timeliner and s+h, but the logic is still a mess.

is that something like this ? there are some exotic nodes like flipflop and monoflop …

video toggle.v4p (19.0 kB)

yes, monoflop fix the problem