Avatar ·

Raspberry Pi + OMXPLAYER -WRAPER - starting video files in the right order by pressing buttons

📁 функция, python, пример, боты, ии, работа

Trying to launch video files with Raspberry Pi from a python. To do this, I use Omxplayer-Wrapper.

n

I try to implement the following algorithm:

n
    n
  1. At the beginning of the program, the a.mp4
  2. n
  3. when clicking button 1, A.MP4 stops and is tued on B.MP4. When it ends, an.mp4
  4. n
  5. is tued on again when the button is pressed, the.mp4 stops and tus on C.mp4. When it ends, an.mp4
  6. n n

    algorithm works again, but the following shortcomings are observed:

    n
      n
    1. after the B.MP4 file is finished before starting the A.MP4, the desktop is visible (approximately 1 second)
    2. n
    3. after the C.mp4 file is being lost to be lost. The launch of a.mp4 is visible the desktop for more time (approximately 10-12 seconds)
    4. n n

      how to carry out this task correctly?

      n

      I give a sketch of the code:

      n
         fromxplayer  Import  omxplaye  from  time  'path/to/a.mp4' , args = [ ''-b ', ' '-look' ]) nplayerb = Omxplayer ( 'path/to/b.mp4' , args = [ ''-b ']) nplayerc = omxplayer ( 'Path/to/C.mp4' , args = [ '-b' ]) nplayera.play () n  when>  true : n  if  button1pressedflag ==  true : #set in interrupt  n Button1pressedflag =  false  n playera.pause () n plasyerb.play () n  0.2 ) n Playerb.quit () n playera.play () n  if  button2pressedflag ==  true : #set in interrupt  n button2pressedflag =  false  n playera.pause () n playerc.play () n  blasses> when  Playerc tin. 
      is_playing either works, then does not work.
      where the is_playing () does not work, the function of playback_status (), although it is used in is_playing () ..
      quit () either kills the process, then no.
      stop () either stops the player, then kills the process of terrible porridge ..
      solved the problem of dirty Street:
      1. I am letting the video
      2. I take its duration and insert it into Sleep ()

      3. After the slip, I kill the video
      If you need to switch the video, then switching occurs in the interruption from the button.
      It seems to work ... but not beautiful somehow ...: (