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 71 forks source link

.pause() stops audio playback on all running inscances #124

Closed sevildevil1990 closed 5 years ago

sevildevil1990 commented 6 years ago

Description

Hi, I currently try to make the playback of multiple videos more seamless by starting a second player instance just ahead of the end of the first video, pausing it right away and eventually start the playback as soon as the first video finishes. This works well for the video part! The audio however stops on both players, as soon as the second player is paused – the video keeps playing though.

Problem reproduction

#!/usr/bin/env python3
import time
from omxplayer.player import OMXPlayer

print("start player1")
player1 = OMXPlayer("/home/pi/Videos/video1.mp4", args=['--layer','2'], dbus_name="org.mpris.MediaPlayer2.omxplayer1")
time.sleep(2)

print("load player2")
player2 = OMXPlayer("/home/pi/Videos/video2.mp4", args=['--layer','1'], dbus_name="org.mpris.MediaPlayer2.omxplayer2")
player2.pause()
# Audio cuts off for both right here

time.sleep(2)
player1.stop()
player2.stop()

I tried multiple scenarios now:

Environment details

Software Version
python-omxplayer-wrapper 0.2.5
python-dbus (dpkg -s python-dbus) 1.2.0
python (python --version) 2.7.13/3.5.3
omxplayer (omxplayer --version) 5a25a57
willprice commented 5 years ago

I think this is an issue with omxplayer itself, I can't run two instances of omxplayer and pause one without pausing the other either. Try running in two terminal windows and running the two commands:

# terminal 1
$ omxplayer tests/media/test_media_1.mp4 --layer 1 --dbus_name org.mpris.MediaPlayer2.omxplayer1 --win '0 0  200 200'

# terminal 2
$ omxplayer tests/media/test_media_1.mp4 --layer 2 --dbus_name org.mpris.MediaPlayer2.omxplayer2 --win '200 0  400 200'

When I pause one it pauses the other player.

Closing as I can't fix this, it's an issue with omxplayer itself, sorry about that.

Eskimon commented 5 years ago

Hello and thanks for the great work.

I just want to give some input there. I think the problem is rather on the dbus side. If you play an omxplayer instance in two different terminals, and play/pause with the 'p' key it's working just fine, you can control any of the omxplayer instance independently.

juanmartin commented 5 years ago

You should rename the DBUS process in order to be able to control them independently Like so:

player = OMXPlayer(video, args=yourArgs, dbus_name=org.mpris.MediaPlayer2.omxplayer1)
player2 = OMXPlayer(video2, args=yourArgs, dbus_name=org.mpris.MediaPlayer2.omxplayer2)

Hope it helps.