mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-03 14:25:38 +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:
parent
b41e5867c6
commit
8adb4aa117
4 changed files with 57 additions and 23 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue