jellyfin / jellyfin-mpv-shim

MPV Cast Client for Jellyfin
Other
1.5k stars 88 forks source link

Crash on startup with Display Mirroring #318

Open maaldheefee opened 1 year ago

maaldheefee commented 1 year ago

Describe the bug When display_mirroring is set to true, the application crashes with the following error.

Traceback (most recent call last):
  File "run.py", line 23, in <module>
  File "jellyfin_mpv_shim\mpv_shim.py", line 91, in main
  File "jellyfin_mpv_shim\display_mirror\__init__.py", line 69, in run
  File "webview\__init__.py", line 96, in start
  File "webview\guilib.py", line 98, in initialize
  File "webview\guilib.py", line 62, in try_import
  File "webview\guilib.py", line 52, in import_winforms
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "webview\platforms\winforms.py", line 34, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "clr.py", line 6, in <module>
  File "pythonnet\__init__.py", line 42, in load
TypeError: 'Assembly' object is not subscriptable

To Reproduce Steps to reproduce the behavior:

  1. Change display_mirroring to true via config menu or editing the file.
  2. Open Jellyfin MPV Shim and wait for server login
  3. See error

Desktop (please complete the following information):

Error Messages log.txt

iwalton3 commented 1 year ago

Try this build: https://github.com/jellyfin/jellyfin-mpv-shim/suites/11121728901/artifacts/566859664

maaldheefee commented 1 year ago

Client doesn't seem to get connected. It does not show in Cast to Device menu.

log.txt

iwalton3 commented 1 year ago

It looks like this has succumb to code rot and needs a lot of attention. The underlying pywebview renderer used to use Microsoft Edge but this is not available reliably anymore in Windows. I'm not willing to bundle chromium with this application for a feature that is not commonly used, so I will need to find a new solution later to offer this.

The pywebview integration does still work, so you can install python manually and pip install the application to use other webview backends. The most reliable one seems to be cef.

lowne commented 1 year ago

This also happens on flatpak/Linux:

[pywebview] QT cannot be loaded
Traceback (most recent call last):
  File "/app/lib/python3.10/site-packages/webview/guilib.py", line 29, in import_qt
    import webview.platforms.qt as guilib
  File "/app/lib/python3.10/site-packages/webview/platforms/qt.py", line 34, in <module>
    from qtpy import QtCore
ModuleNotFoundError: No module named 'qtpy'

then it also tries and fails with GTK, and eventually

Exception in thread Thread-14 (load_idle):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/app/lib/python3.10/site-packages/jellyfin_mpv_shim/display_mirror/__init__.py", line 137, in load_idle
    mirror.display_window.load_html(html)
  File "/app/lib/python3.10/site-packages/webview/window.py", line 31, in wrapper
    raise WebViewException('Main window failed to start')
webview.util.WebViewException: Main window failed to start

Perhaps an interim improvement could be to try/catch the whole display_mirror initialisation so at least the client can start (albeit without display mirroring enabled).