Skip to content
Snippets Groups Projects
Commit 8adb4aa1 authored by Sébastien Blin's avatar Sébastien Blin Committed by Andreas Traczyk
Browse files

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
parent b41e5867
No related branches found
No related tags found
No related merge requests found
......@@ -326,9 +326,6 @@ parts:
- libdouble-conversion3
- libegl1
- libgbm1
- libgstreamer-gl1.0-0
- libgstreamer-plugins-base1.0-0
- libgstreamer1.0-0
- libgudev-1.0-0
- libjsoncpp1
- libllvm12
......
......@@ -759,3 +759,18 @@ UtilsAdapter::getOneline(const QString& input)
output.truncate(index);
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)},
};
}
......@@ -143,6 +143,8 @@ public:
Q_INVOKABLE QString getOneline(const QString& input);
Q_INVOKABLE QVariantMap getVideoPlayer(const QString& resource, const QString& bgColor);
Q_SIGNALS:
void debugMessageReceived(const QString& message);
void changeFontSize();
......
......@@ -72,35 +72,55 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter
width: Math.max(508, root.width - 100)
Rectangle {
Item {
Layout.alignment: Qt.AlignCenter | Qt.AlignTop
Layout.preferredWidth: JamiTheme.welcomeLogoWidth
Layout.preferredHeight: JamiTheme.welcomeLogoHeight
MediaPlayer {
id: mediaPlayer
source: JamiTheme.darkTheme ? JamiResources.logo_dark_webm : JamiResources.logo_light_webm
videoOutput: videoOutput
loops: MediaPlayer.Infinite
}
Loader {
id: videoPlayer
VideoOutput {
id: videoOutput
property var mediaInfo: UtilsAdapter.getVideoPlayer(JamiTheme.darkTheme ? JamiResources.logo_dark_webm : JamiResources.logo_light_webm, JamiTheme.secondaryBackgroundColor)
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
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment