ofVideoPlayer: setLoopSate vs loopMode

Hi,

Besides documented method setLoopState(), ofVideoPlayer also exposes loopMode. How are they different and which one should be used?

Thanks,
Nuno

Hum…

looking into the code I realized that the logic execution depends on:

#ifdef OF_VIDEO_PLAYER_QUICKTIME

should I declare this on my code?

Actually… this is all over the code so it must be very important. This is not declared in the movie player example so I guess I shouldn’t need it. But, unless I’m doing something wrong, setting the loopState to OF_LOOP_NONE doesn’t seem to work.

Hum…

Thanks,
Nuno

you don’t have to touch that stuff, it’s for linux people. you might have better luck by looking at http://openframeworks.cc/documentation
if looking at the code is confusing.

we use #define to let the code work across platforms, etc…
more info: http://en.wikipedia.org/wiki/Preprocess-…-.2FC.2B.2B

you should use setLoopState()
how are you using it? it works for me.

this is code from the moviePlayer example, testApp.cpp to test:

  
  
#include "testApp.h"  
#include "stdio.h"  
  
//--------------------------------------------------------------  
testApp::testApp(){  
  
}  
  
//--------------------------------------------------------------  
void testApp::setup(){  
	ofBackground(255,255,255);  
	fingerMovie.loadMovie("movies/fingers.mov");  
	fingerMovie.play();  
	fingerMovie.setSpeed(3);  
	fingerMovie.setLoopState(OF_LOOP_NONE);  
}  
  
//--------------------------------------------------------------  
void testApp::update(){  
	fingerMovie.idleMovie();  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
	ofSetColor(0xFFFFFF);  
	fingerMovie.draw(20,20);  
}  
  
//--------------------------------------------------------------  
void testApp::keyPressed  (int key){  
}  
  
//--------------------------------------------------------------  
void testApp::keyReleased(int key){  
}  
  
//--------------------------------------------------------------  
void testApp::mouseMoved(int x, int y ){  
}  
  
//--------------------------------------------------------------  
void testApp::mouseDragged(int x, int y, int button){  
}  
  
//--------------------------------------------------------------  
void testApp::mousePressed(int x, int y, int button){  
}  
  
//--------------------------------------------------------------  
void testApp::mouseReleased(){  
}  
  

take care!
zach

Hi,

Thanks. Problem solved. But it’s kind of obscure. If you try to do setLoopState() before you do play() it won’t work. That’s what I was doing. I simply switched their order and now it works.

Yes, I am looking into documentation also, but since the documentation has some irregularities (like saying OF_QT_LOOP_NONE instead of OF_LOOP_NONE) and since Code::Blocks was showing these attributes… I got curious and looked into the code :slight_smile:

Also, some things are not clear for me in the documentation. I don’t understand for example what is the difference between stop(), setSpeed(0) and setPaused().

Actually I was trying to use stop() in order to avoid looping (since it was not working) and I was getting some strange behaviors so I started using setSpeed(0). If I still get this problem I’ll post it in its own thread.

Thanks again!
Nuno

yeah – it’s a work in progress and we are slow with the web right now. if you discover errors on the documentation, you can post them on the forum. also questions about usage…

setPaused(true) = setSpeed(0), except that when you unpause via setPaused(false) you should move back to your original speed.

stop() seems to have a bug – for play() to work again, it should be :

  
  
void ofVideoPlayer::play(){  
  
	//--------------------------------------  
	#ifdef OF_VIDEO_PLAYER_QUICKTIME  
	//--------------------------------------  
  
	if (!bStarted){  
	 	start();  
	}else {  
		// ------------ lower level "startMovie"  
		// ------------ use desired speed & time (-1,1,etc) to Preroll...  
		bPlaying = true;  
		TimeValue timeNow;  
	   	timeNow = GetMovieTime(moviePtr, nil);  
		PrerollMovie(moviePtr, timeNow, X2Fix(speed));  
		SetMovieRate(moviePtr,  X2Fix(speed));  
		MoviesTask(moviePtr, 0);  
		SetMovieActive (moviePtr, true);  
	}  
  
  

I added this - SetMovieActive (moviePtr, true); since stop() sets it non active. To be honest, I almost never stop movies, so I never saw this :slight_smile:

take care!
zach

I’m glad I’m helping you find some bugs. Since I’m still useless at solving other people’s problems at least I’m feeling useful as a beta tester :wink:

I’ll keep posting any bugs I find on the forum.

Nuno