1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-05 23:35:50 +02:00

wizardview: use videopreview if webengine

MediaPlayer is crashing on snap for an unknown reason. For now,
the easiest thing is to use the webengine component as it's already
used pretty everywhere and snap is built with.

GitLab: #1037
Change-Id: Ida24f0401bbd5c6a861a7229fb51135652722561
This commit is contained in:
Sébastien Blin 2023-03-22 12:06:51 -04:00 committed by Andreas Traczyk
parent b41e5867c6
commit 8adb4aa117
4 changed files with 57 additions and 23 deletions

View file

@ -326,9 +326,6 @@ parts:
- libdouble-conversion3 - libdouble-conversion3
- libegl1 - libegl1
- libgbm1 - libgbm1
- libgstreamer-gl1.0-0
- libgstreamer-plugins-base1.0-0
- libgstreamer1.0-0
- libgudev-1.0-0 - libgudev-1.0-0
- libjsoncpp1 - libjsoncpp1
- libllvm12 - libllvm12

View file

@ -759,3 +759,18 @@ UtilsAdapter::getOneline(const QString& input)
output.truncate(index); output.truncate(index);
return output; return output;
} }
QVariantMap
UtilsAdapter::getVideoPlayer(const QString& resource, const QString& bgColor)
{
static const QString htmlVideo
= "<body style='margin:0;padding:0;'>"
"<video autoplay muted loop "
"style='width:100%;height:100%;outline:none;background-color:%2;"
"object-fit:cover;' "
"src='%1' type='video/webm'/></body>";
return {
{"isVideo", true},
{"html", htmlVideo.arg(resource, bgColor)},
};
}

View file

@ -143,6 +143,8 @@ public:
Q_INVOKABLE QString getOneline(const QString& input); Q_INVOKABLE QString getOneline(const QString& input);
Q_INVOKABLE QVariantMap getVideoPlayer(const QString& resource, const QString& bgColor);
Q_SIGNALS: Q_SIGNALS:
void debugMessageReceived(const QString& message); void debugMessageReceived(const QString& message);
void changeFontSize(); void changeFontSize();

View file

@ -72,35 +72,55 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: Math.max(508, root.width - 100) width: Math.max(508, root.width - 100)
Rectangle { Item {
Layout.alignment: Qt.AlignCenter | Qt.AlignTop Layout.alignment: Qt.AlignCenter | Qt.AlignTop
Layout.preferredWidth: JamiTheme.welcomeLogoWidth Layout.preferredWidth: JamiTheme.welcomeLogoWidth
Layout.preferredHeight: JamiTheme.welcomeLogoHeight Layout.preferredHeight: JamiTheme.welcomeLogoHeight
MediaPlayer { Loader {
id: mediaPlayer id: videoPlayer
source: JamiTheme.darkTheme ? JamiResources.logo_dark_webm : JamiResources.logo_light_webm
videoOutput: videoOutput
loops: MediaPlayer.Infinite
}
VideoOutput { property var mediaInfo: UtilsAdapter.getVideoPlayer(JamiTheme.darkTheme ? JamiResources.logo_dark_webm : JamiResources.logo_light_webm, JamiTheme.secondaryBackgroundColor)
id: videoOutput
anchors.fill: parent anchors.fill: parent
anchors.margins: 2
sourceComponent: WITH_WEBENGINE? avMediaComp : basicPlayer
Component {
id: avMediaComp
Loader {
Component.onCompleted: {
var qml = "qrc:/webengine/VideoPreview.qml"
setSource( qml, { isVideo: mediaInfo.isVideo, html:mediaInfo.html } )
}
}
}
Component {
id: basicPlayer
Item {
// NOTE: Seems to crash on snap for whatever reason. For now use VideoPreview in priority
MediaPlayer {
id: mediaPlayer
source: JamiTheme.darkTheme ? JamiResources.logo_dark_webm : JamiResources.logo_light_webm
videoOutput: videoOutput
loops: MediaPlayer.Infinite
}
VideoOutput {
id: videoOutput
anchors.fill: parent
}
Component.onCompleted: {
mediaPlayer.play()
}
}
}
} }
Component.onCompleted: {
mediaPlayer.play()
}
Behavior on opacity { NumberAnimation { duration: 150 } }
layer.enabled: opacity
layer.effect: FastBlur {
source: videoOutput
radius: (1. - opacity) * 100
}
} }