Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ofVideoPlayer ‘pausing’ behaviour discrepancy between platforms (Windows seems problematic) #8103

Open
timka418 opened this issue Sep 2, 2024 · 0 comments

Comments

@timka418
Copy link

timka418 commented Sep 2, 2024

Hi guys,

I just started building with oF a few months ago, but already made some great progress in my project thanks to the amazing framework and communtiy - so thank you all very much!

My goal is to build an app for Windows that loads multiple videos and plays them back on external triggers. I found to get the best performance when loading each video in a separate ofVideoPlayer instance. Everytime a trigger is detected the corresponding videoplayer starts playback. On a stop trigger the playback is paused and the videoPlayer is reset using firstFrame(). This basically works but I noticed that when I trigger a video for the second time it displays the frame it was at when it was stopped for a splitsecond. This happens despite the fact that firstFrame was called.

In order to troubleshoot the issue I boiled the project down to the most basic setup and also tried using the lastest version of_v20240901 and different video formats.

Expectation:

  • Video starts playback on keypress
  • Video playback is paused on keyrelease
  • Video resets to the first frame on keyrelease which is then drawn
  • Triggering playback for the second time starts with the first frame

Problem:
After calling firstFrame() the currentFrame is 0 when printing vp.getCurrentFrame() but the first frame is not drawn. Triggering playback for the second time shows the last drawn frame of the previous playback sequence before jumping to the first frame of the video.

Environment:

  • Windows 10 Pro 22H2
  • openFrameworks 0.12 release & v20240901
  • Visual Studio Community 2022 17.11.2

I'm happy about any input on this behaviour! Am I doing it wrong?
Best regards!

#include "ofApp.h"

ofVideoPlayer vp;

//--------------------------------------------------------------
void ofApp::setup(){
	vp.load("data\\video1.mov");
	vp.play();
	vp.setPaused(true);
}

//--------------------------------------------------------------
void ofApp::update(){
	vp.update();
}

//--------------------------------------------------------------
void ofApp::draw(){
	vp.draw(0, 0, ofGetWidth(), ofGetHeight());
}

//--------------------------------------------------------------
void ofApp::keyPressed(int key){
	vp.setPaused(false);
}

//--------------------------------------------------------------
void ofApp::keyReleased(int key){
	vp.setPaused(true);
	vp.firstFrame();
}

Edit: In the meantime I had a nice conversation with burton on the oF Forum and he tested the code on Mac where he found it to work as expected. There seems to be a discrepancy in the behaviour of the video player being paused on different platforms. On Mac the App starts with drawing the first frame on startup whereas on windows the app starts with a black screen until the first playback trigger appears.
Link to the thread: https://forum.openframeworks.cc/t/videoplayer-not-resetting-to-first-frame/24628/4

@timka418 timka418 changed the title ofVideoPlayer.firstFrame() resets currentFrame but the first frame is not drawn ofVideoPlayer ‘pausing’ behaviour discrepancy between platforms (Windows seems problematic) Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant