setLoopState(OF_LOOP_NONE) not working

Hi, my problem is that I want to play one video on top of the other, but then I can’t get the previous video to stop looping. Here’s some of my code. It works for the very first video (not shown in the code) but when I try to implement it on other videos such as video2 and video3, the loop keeps going.

void ofApp::draw(){

remember.draw();

video.draw(60, 150, 600, 400);

if(remember.clicked == true){
}else{
    video2.draw(60,150,600,400);
    video2.play();
    video2.setLoopState(OF_LOOP_NONE);
    remember2.draw();
}
    
if(remember2.clicked == true){
}else{
    video3.draw(60,150,600,400);
    video3.play();
    video3.setLoopState(OF_LOOP_NONE);
    remember3.draw();
}

I fell it is because you invoke the “play()” command again and again in each frame.

how would i be able to fix it? do i invoke play() elsewhere? I wanted it so that the video plays after the button is clicked.

Although a different code flow could be implemented, the most simple solution for your current specific case might be:

if (video2.getLoopState() != OF_LOOP_NONE) video2.play();