Hey all,
I’m getting some strange video artefacts when switching between pointers to ofVideoPlayers. It’s usually a few frames from another video file, but can be garbage, which makes me think they are briefly pointing at the wrong place. This doesn’t happen when looping a single video.
This is happening both on OS X and Linux, the videos are H.264 mp4 files.
Class.h
vector<string> mFiles;
vector<ofVideoPlayer*> mPlayers;
ofVideoPlayer* mPlayer;
int mFileIndex;
Class.cpp
void setup() {
mFileIndex = 0;
mPlayer = NULL;
ofDirectory dir(VIDEO_PATH);
if (dir.exists()) {
dir.allowExt("mp4");
dir.listDir();
dir.sort();
for(int i = 0; i < dir.numFiles(); ++i) {
mFiles.push_back(dir.getPath(i);
mPlayers.push_back(new ofVideoPlayer());
mPlayers.back()->loadMovie(mFiles.back();
mPlayers.back()->setLoopState(OF_LOOP_NONE);
}
}
dir.close();
mPlayer = mPlayers.at(mFileIndex);
}
void update() {
if (mPlayer && mPlayer->isLoaded()) {
mPlayer->update();
if (mPlayer->getIsMovieDone()) {
mFileIndex = (mFileIndex + 1) % mFiles.size();
mPlayer = mPlayers.at(mFileIndex);
mPlayer->play();
}
}
}
Any thoughts much appreciated,
Arthur C