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

crash in exitEvent when using player argument to get info about the player that just exited #209

Open Gillissie opened 3 years ago

Gillissie commented 3 years ago

Issue Report

Description

The exitEvent callback takes two arguments: player and exit_status. If you call something like player.get_filename(), the program crashes with an OMXPlayerDeadError.

It seems to me that the player is cleaning everything up before calling the exitEvent, making the player argument pretty useless to find out info about what just exited.

Problem reproduction

from omxplayer.player import OMXPlayer

def video_exited(player, exit_status):
    print("video exited: {}, status: {}".format(player.get_filename(), exit_status))

VIDEO_PATH = "Your Video File Here.mov"

videoPlayer = OMXPlayer(VIDEO_PATH,
                  args="--win 0,0,1024,768 --layer 1",
                  dbus_name="org.mpris.MediaPlayer2.omxplayer1")

videoPlayer.exitEvent = video_exited

# Press return to force the video to exit before it ends naturally.
input("Press Enter to continue...")

videoPlayer.quit()

Environment details

Distributor ID: Raspbian Description: Raspbian GNU/Linux 10 (buster) Release: 10 Codename: buster

Software Version
python-omxplayer-wrapper 0.3.3
python-dbus (dpkg -s python-dbus) 1.2.8-3
python (python --version) 3.7.3
omxplayer (omxplayer --version) f543a0d