Repository: pyinstaller/pyinstaller

Issue:
Required QtMultimedia plugin not packed
<!--
Welcome to the PyInstaller issue tracker! Before creating an issue, please heed the following:

1. This tracker should only be used to report bugs and request features / enhancements to PyInstaller
    - For questions and general support, use the discussions forum.
2. Use the search function before creating a new issue. Duplicates will be closed and directed to
   the original discussion.
3. When making a bug report, make sure you provide all required information. The easier it is for
   maintainers to reproduce, the faster it'll be fixed.
-->

<!-- +++ ONLY TEXT +++ DO NOT POST IMAGES +++ -->

## Description of the issue
A Qt app using QtMultimedia crashes on startup because of missing plugin dll.

### Context information (for bug reports)

* Output of `pyinstaller --version`: ```5.7.0```
* Version of Python: 3.11
* Platform: Windows
* How you installed Python: python.org/downloads
* Did you also try this on another platform? No


* try the latest development version, using the following command:

```shell
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
```

* follow *all* the instructions in our "If Things Go Wrong" Guide
  (https://github.com/pyinstaller/pyinstaller/wiki/If-Things-Go-Wrong) and

### Make sure [everything is packaged correctly](https://github.com/pyinstaller/pyinstaller/wiki/How-to-Report-Bugs#make-sure-everything-is-packaged-correctly)

  * [X] start with clean installation
  * [X] use the latest development version
  * [X] Run your frozen program **from a command window (shell)** — instead of double-clicking on it
  * [X] Package your program in **--onedir mode**
  * [X] Package **without UPX**, say: use the option `--noupx` or set `upx=False` in your .spec-file
  * [X] Repackage you application in **verbose/debug mode**. For this, pass the option `--debug` to `pyi-makespec` or `pyinstaller` or use `EXE(..., debug=1, ...)` in your .spec file.


### A minimal example program which shows the error

```py
from PySide6 import QtMultimedia, QtCore

app = QtCore.QCoreApplication()
player = QtMultimedia.QMediaPlayer(app)
```

### Stacktrace / full error message
Qt logs
```
19:22:08 | <Qt> | WARNING | could not load multimedia backend ""
19:22:08 | <Qt> |   ERROR | QtMultimedia is not currently supported on this platform or compiler.
```

Copying `multimedia/windowsmediaplugin.dll` into PySide6 plugins seems to fix the issue



Discussion:

Resolving patch:
diff --git a/PyInstaller/utils/hooks/qt/_modules_info.py b/PyInstaller/utils/hooks/qt/_modules_info.py
--- a/PyInstaller/utils/hooks/qt/_modules_info.py
+++ b/PyInstaller/utils/hooks/qt/_modules_info.py
@@ -285,7 +285,9 @@ def __init__(self, module, shared_lib=None, translation=None, plugins=None, bind
         "QtMultimedia",
         shared_lib="Multimedia",
         translation="qtmultimedia",
-        plugins=["video/gstvideorenderer", "video/videonode"],
+        # `multimedia` plugins are available as of Qt6 >= 6.4.0; earlier versions had `video/gstvideorenderer` and
+        # `video/videonode` plugins.
+        plugins=["multimedia", "video/gstvideorenderer", "video/videonode"],
         bindings=["PySide6", "PyQt6"]
     ),
     _QtModuleDef("QtMultimediaWidgets", shared_lib="MultimediaWidgets"),


Test patch:
diff --git a/tests/functional/test_qt.py b/tests/functional/test_qt.py
--- a/tests/functional/test_qt.py
+++ b/tests/functional/test_qt.py
@@ -468,6 +468,21 @@ def test_Qt_QtWebEngineQuick_PySide6(pyi_builder):
     _test_Qt_QtWebEngineQuick(pyi_builder, 'PySide6')
 
 
+# QtMultimedia test that triggers error when the module's plugins are missing (#7352).
+@QtPyLibs
+def test_Qt_QtMultimedia_player_init(pyi_builder, QtPyLib):
+    pyi_builder.test_source(
+        """
+        import sys
+
+        from {0} import QtCore, QtMultimedia
+
+        app = QtCore.QCoreApplication(sys.argv)
+        player = QtMultimedia.QMediaPlayer(app)
+        """.format(QtPyLib), **USE_WINDOWED_KWARG
+    )
+
+
 # QtMultimedia test that also uses PySide's true_property, which triggers hidden dependency on QtMultimediaWidgets
 # python module.
 # See: