-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
threading-related crash after multiple video playbacks #88
Comments
Do you really need to create another MPV instance every call? If that is really needed, try |
I tried out a bit and for me this works best: def play_demo_video(self, video_file_name):
video_player = mpv.MPV(input_default_bindings=True, input_vo_keyboard=True)
# When the video plays we want to disable gamepad input for the game
self._disable_input_for_video = True
# In order to quit the mpv on any button press, we use "antimicro" to map controller input to the q button
# on demand and exit mpv that way. Don't know if there's a better option or not
antimicro = subprocess.Popen(["antimicro", "-d", "--hidden", "--profile", "controller_q_map.gamecontroller.amgp"])
def cleanup_mpv():
# Clean up the helpers
self._disable_input_for_video = False
self.get_screen()._last_action_timestamp = datetime.now()
# make pygame grab the focus again
subprocess.call(["wmctrl", "-a", PROGRAM_NAME])
@video_player.on_key_press('q')
def my_q_binding():
video_player.quit()
cleanup_mpv()
@video_player.event_callback('END_FILE')
def video_finished_handler(event):
video_player.terminate()
cleanup_mpv()
... With the quit for when we press q and the terminate for when the file ended. Most other combinations lead to Core Dump crashes... |
If you use mpv to play videos (since I assume normal human cannot watch more than one video at the same time), why don't you keep an MPV instance as a variable in the scope of the game that call it, or a attribute of the class if you're doing OO? |
I want to go back to the game when no video is playing. |
You can try to |
What might work is providing mpv with a window to draw into using the |
I have a program where mpv is called multiple times, like, every minute, but the previous playback is always done before a new one is started.
After about 16 times I get the following crash:
Unfortunately I have no idea how to deal with this crash :/
The code that invokes mpv looks like this (part of a game made with pygame):
Any advice would be appreciated.
The text was updated successfully, but these errors were encountered: