@strangerobot wrote:
I am writing a program where a thread passes over a flag and a path through a global variable
Part of the thread class
void play() { globalpath = path; cout <<"playing_"<<globalpath<<endl; playcheck = true; while(playcheck==true) { } //freezes the thread while video is playing }Part of ofApp.cpp
void ofApp::draw(){ if (playcheck == true ) { playvideo(globalpath); playcheck == false; }; } void ofApp::playvideo(string path) { player.load(path + ".mp4"); player.play(); while (player.getCurrentFrame() < player.getTotalNumFrames()) { player.nextFrame(); player.draw(0,0); } }When I execute the code, the display window is painfully slow and takes a lot of time to load the first frame, and then the window freezes ( crippling speed )
Is there a better way to execute the same?
I want to execute a video playback from the thread and wait till the playback is over
Posts: 1
Participants: 1