willprice / python-omxplayer-wrapper

:tv: Control OMXPlayer, the Raspberry Pi media player, from Python
http://python-omxplayer-wrapper.readthedocs.io
GNU Lesser General Public License v3.0
253 stars 72 forks source link

Can't load two players at the same time, even with dbus_name included #202

Closed BenBetts24 closed 4 years ago

BenBetts24 commented 4 years ago

Issue Report

Description

Unable to create two players at the same time despite instructions in the main README. I need to be able to start one player, then pre-load and pause the second to prepare for an instant switch to the second player later on in the program.

I was previously getting a DBus noreply error, but now am getting this whenever I try to load the second player (with video paths replaced, args and dbus name in reproduction below):

Traceback (most recent call last):
  File "test.py", line 8, in <module>
    playerTwo = OMXPlayer(path, args, dbus_name='', pause=True)
  File "/home/pi/.local/lib/python3.7/site-packages/omxplayer/player.py", line 154, in __init__
    self.load(source, pause=pause)
  File "/home/pi/.local/lib/python3.7/site-packages/omxplayer/player.py", line 240, in load
    self.pause()
  File "</home/pi/.local/lib/python3.7/site-packages/decorator.py:decorator-gen-56>", line 2, in pause
  File "/home/pi/.local/lib/python3.7/site-packages/omxplayer/player.py", line 50, in wrapped
    raise OMXPlayerDeadError('Process is no longer alive, can\'t run command')
omxplayer.player.OMXPlayerDeadError: Process is no longer alive, can't run command

Problem reproduction

playerOne = OMXPlayer('videopath1', args='--loop --no-osd -n -1', dbus_name='org.mpris.MediaPlayer2.omxplayer1')
input("Press enter to load second player")
playerTwo = OMXPlayer('videopath2', args='--no-osd -n -1', dbus_name='org.mpris.MediaPlayer2.omxplayer2', pause=True)

UPDATE: I've realized that if I just switch the video paths between the two players, I now get the NoReply error

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying

Environment details

Software Version
python-omxplayer-wrapper 0.1.0
python-dbus (dpkg -s python-dbus) 1.2.8-3
python (python --version) 3.7.4
omxplayer (omxplayer --version) f543a0d
BenBetts24 commented 4 years ago

Figured it out. Hadn't dedicated enough memory to the GPU of the PI Zero I was using.