MpvQt is a libmpv wrapper for Qt Quick 2/Qml.
- Create a class extending
MpvAbstractItem
class MpvItem : public MpvAbstractItem
{
Q_OBJECT
QML_ELEMENT
// ...
}- Add the class to a qml module
qt_add_qml_module(videoplayer
URI com.example.mpvqt
QML_FILES
Main.qml
)
target_sources(videoplayer
PRIVATE
mpvitem.h mpvitem.cpp
)or
qt_add_qml_module(videoplayer
URI com.example.mpvqt
QML_FILES
Main.qml
SOURCES
mpvitem.h mpvitem.cpp
)- In your qml file import mpv
import com.example.mpvqt - Then create an instance
MpvItem {},MpvItemis the class name extending MpvAbstractItem, if you want to use another name replaceQML_ELEMENTwithQML_NAMED_ELEMENT(VideoPlayer)
MpvQt loads a config file located at <config_folder>/mpvqt/mpvqt.conf,
the file has to be manually created and is a regular mpv config file.
The settings apply to all applications using MpvQt,
applications can override the properties set in MpvQt's config file.