Closed JonnyAlpha closed 6 years ago
Hi @JonnyAlpha Aha...Mr. Hammerstein... that's a long time ago I saw his videos; can't remember when or where :-)
Currently Will's wrapper isn't able to play multiple omxplayers. It will be when @willprice pulls in @longagofaraway pull-request #89.
The pull request surprised Will on the wrapper not initially pausing the video :-) So you need to add the pause=True
argument for the time being.
Also it is good to realize that once the playing of vid2 is finished, there is no vid2 (real) omxplayer any more. Sending commands to vid2 will fail!
So I guess it is better to do in the motion_detected
function the creation of vid2 and use play_sync
to run video2 until it is completed, and continue with resuming the video1 playing. You can start video1 in the no_motion
function, but until the PIR gives the event when_no_motion
the video1 stays in the paused state -a freezing video1-.
PIR events... I can only agree on MrYsLab's comment on the Raspberry Pi Forum. I have a PIR so I can have a look at that too.
Attached my version of your code. The PIR is simulated by the keyboard; pressing the 'm' -key will simulate the when_motion_detected
(and the 'n'-key the when_no_motion
event, but that one I don't use). Use the 'ESC' or 'q'-key to quit the program.
Again it only works with longagofaraway pull request.
JonnyAlpha-Mr-Hammerstein-20170930A.zip; can add the videos for other users if you allow me to do so.
I made a small video of the running program which I can post to you if you are interested.
Thought I might be able to have time this weekend to have a look at this stuff, but that didn't happen. I'll try and make time this week to have a fiddle and merge the changes in after I've been able to verify that the changes don't break backwards compatibility :)
My apologies to both of you. I saw these responses but have just not had the time to look at anything until today :-( I have just installed the lastest python-omxplayer-wrapper and will be having a play. @jehutting thanks for taking the time to look at my code. I didn't realise I needed so many amendments - or the addition of a dbus name. Here is the link to some of the videos I have made that I am trying to use in my application: https://www.dropbox.com/sh/kbbsta5l9mnx0so/AACBJD6bibq38bgASUHwOLF6a?dl=0
Can we continue to discuss on here or should we deal with this via email separately?
I have just run your code and after amending the directory path the Vid_Wait_Loop is playing (although I am running the Pi Headless in a Hotel so can only hear the sound via a plugged in speaker). When I press 'm' Vid_Wait_Loop' seems to pause OK or at least stops and 'Vid_Name_Hammerstein' plays. I will now try and incorporate it with the PIR when I get home.
I'll keep you posted.
Oh and yes Hammerstein was one of the ABC Warrior Robots from the comic 2000AD. Also appeared in the 1995 version of 'Judge Dredd' with Sylvester Stalone. I am building a 'virtual' robot with a visual front end.
@JonnyAlpha So I assume it is working as in the notification I got you are saying you had a frozen window?
Didn't now about Judge Dredd. I looked it up, but my Mr. Hammerstein videos are dated '27-januari-2015'.
We can continue discussing here -as I got a notification of posted messages, or by mail; whatever you like.
@jehutting Yes it is working fine, I amended the post but initially I reported that the terminal froze after running the program but the second time it worked fine. The videos were made in 2015 when I first came up with the idea.
If you can provide an example that I can run without having to build a robot I'll have a look into it, but until then I'll close this as I cannot reproduce.
Issue Report
Description
I am trying to build a visual front end for a robot. When nothing is happening a video should loop and when motion is detected a second video starts. Issue: Both videos in my script play automatically before they are called. Once they have both completed the first video which is on a loop carries on ok but when trying to play the second video it will not play and just remains frozen for the duration. Once it has finished playing (frozen) the loop video continues. If I make both videos loop they both just keep playing?
Reproduction
Here is my code. First video should loop and when motion is detected it should pause and the second video should play.
Environment
Distributor ID: Raspbian Description: Raspbian GNU/Linux 8.0 (jessie) Release: 8.0 Codename: jessie