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

videoPlayer GST isPaused isPlaying fix #6987

Merged
merged 2 commits into from
May 25, 2022

Conversation

dimitre
Copy link
Member

@dimitre dimitre commented May 20, 2022

Changes in isPlaying() and isPaused() for uniformity in different platforms, as discussed here

Hey @ofTheo here is the PR for GStreamer Linux
I don't have my linux box working to test it so it would be great if somebody else could review and test the changes.

@dimitre
Copy link
Member Author

dimitre commented May 23, 2022

If anybody has Linux and a little time to test this PR here is one sample test:
press key:
a to play,
s to pause,
d to stop

if everything is OK the program should print the result of isplaying is paused
1, 0 for play
0, 1 for pause
0, 0 for stop.

#pragma once
#include "ofMain.h"

class ofApp : public ofBaseApp{
	public:

	ofVideoPlayer video;
	ofRectangle rect;

	void setup(){
		video.load("/Users/z/Desktop/WERK2022/Elka/Elka.mov");
		video.play();
	}

	void update(){
		if (video.isLoaded()) {
			video.update();
		}
	}

	void draw(){
		if (video.isLoaded()) {
			ofSetColor(255);
			video.draw(0,0,video.getWidth() * .5, video.getHeight() * .5);
			string msg;
			msg += "isPlaying() " + ofToString(video.isPlaying()) + "\n";
			msg += "isPaused() " + ofToString(video.isPaused());
			ofDrawBitmapString(msg, 40,40);
		}
	}

	void keyPressed(int key) {
		if (key == 'a') {
			video.play();
		}
		
		if (key == 's') {
			video.setPaused(true);
		}
		if (key == 'd') {
			video.stop();
		}
	}
};

@NickHardeman
Copy link
Contributor

Hello, I just tested on Ubuntu 20.04. There is a typo here
https://github.com/openframeworks/openFrameworks/pull/6987/files
pPaused should be bPaused on line 353.
Once that was corrected it functioned as expected.

  • play(): isPlaying(): true isPaused(): false
  • setPaused(true): isPlaying(): false isPaused(): true
  • stop(): isPlaying(): false isPaused(): false

@dimitre
Copy link
Member Author

dimitre commented May 24, 2022

Thanks @NickHardeman I've just fixed the typo.
After this merge we can close #6527

@ofTheo ofTheo merged commit d67b04a into openframeworks:master May 25, 2022
@ofTheo
Copy link
Member

ofTheo commented May 25, 2022

Thanks @dimitre @NickHardeman !!!🤘

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

Successfully merging this pull request may close these issues.

3 participants