//
I tried this sample code to mac,
to play video frame by frame,
and sometimes it works, and sometimes it is not working,
i get “pip” messagess writen in console, but, frames not changing, sometimes
-on space video plays
-but using 1, 2 frame by frame sometimes work sometimes now working.
i am some-how new learning oF,
inspired, used code from video tutorial at
//my .h file
#pragma once
#include “ofMain.h”
class ofApp : public ofBaseApp{
public:
void setup();
void update();
void draw();
void keyPressed(int key);
void keyReleased(int key);
void mouseMoved(int x, int y );
void mouseDragged(int x, int y, int button);
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
void mouseEntered(int x, int y);
void mouseExited(int x, int y);
void windowResized(int w, int h);
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
//my
ofVideoPlayer video_player_a;
//end my
};
//my .cpp file
#include “ofApp.h”
//--------------------------------------------------------------
void ofApp::setup(){
//my
video_player_a.loadMovie(“a.mp4”);
//video_player_a.load(“a.mp4”);
//end my
}
//--------------------------------------------------------------
void ofApp::update(){
video_player_a.update();
}
//--------------------------------------------------------------
void ofApp::draw(){
video_player_a.draw(200, 200, 300, 300);
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
switch (key) {
case ’ ':
{
video_player_a.play();
//video_player_a.update();
break;
}
case '1'://OF_KEY_LEFT:
{
video_player_a.previousFrame();
//video_player_a.update();
printf("pip A 5");
break;
}
case'2':// OF_KEY_RIGHT:
{
video_player_a.nextFrame();
//video_player_a.update();
printf("pip B 5");
break;
}
}
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}