Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2577470
Video.qml
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
Video.qml
View Options
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2020-2023 tusooa <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import
QtQuick
2.15
import
QtQuick
.
Layouts
1.15
import
QtQuick
.
Controls
2.15
import
moe
.
kazv
.
mxc
.
kazv
0.0
as
MK
import
QtMultimedia
5.15
import
org
.
kde
.
kirigami
2.13
as
Kirigami
import
'.'
as
Types
import
'..'
as
Kazv
Simple
{
id: upper
property
var
gender:
'neutral'
property
var
body:
event
.
content
.
body
property
var
mxcUri:
event
.
content
.
url
property
var
videoUri:
matrixSdk
.
mxcUriToHttp
(
mxcUri
)
property
var
videoInfo:
event
.
content
.
info
||
{}
property
var
videoResolution:
video
.
metaData
.
resolution
property
var
videoWidth:
videoResolution
&&
videoResolution
.
width
||
(
videoInfo
.
w
||
1
)
property
var
videoHeight:
videoResolution
&&
videoResolution
.
height
||
(
videoInfo
.
h
||
1
)
property
var
thumbnailInfo:
videoInfo
.
thumbnail_info
||
{}
property
var
thumbnailMxcUri:
videoInfo
.
thumbnail_url
property
var
thumbnailUri:
matrixSdk
.
mxcUriToHttp
(
thumbnailMxcUri
)
property
var
hasThumbnail:
!!
thumbnailMxcUri
property
var
innerContentWidth:
upper
.
contentMaxWidth
-
bubble
.
bubbleSpacing
Types
.
MediaBubble
{
id: bubble
Layout.fillWidth:
true
eventContent:
event
.
content
ColumnLayout
{
id: layout
property
var
label:
Kazv
.
SelectableText
{
Layout.fillWidth:
true
wrapMode:
Text
.
Wrap
text:
l10n
.
get
(
'event-message-video-sent'
,
{
gender
,
body
})
}
property
var
video:
Video
{
id: video
source:
videoUri
loops:
MediaPlayer
.
Infinite
Layout.minimumHeight:
Kirigami
.
Units
.
gridUnit
*
10
Layout.minimumWidth:
Kirigami
.
Units
.
gridUnit
*
10
Layout.maximumWidth:
innerContentWidth
Layout.preferredWidth:
videoWidth
Layout.preferredHeight:
videoHeight
/
videoWidth
*
width
fillMode:
VideoOutput
.
PreserveAspectFit
TapHandler
{
onSingleTapped:
{
video
.
playOrPause
();
}
}
Image
{
anchors.fill:
parent
source:
thumbnailUri
visible:
video
.
playbackState
==
MediaPlayer
.
StoppedState
&&
hasThumbnail
fillMode:
Image
.
PreserveAspectFit
data:
[
bubble
.
mediaFileMenu
]
}
Rectangle
{
anchors.fill:
parent
color:
Kirigami
.
Theme
.
negativeBackgroundColor
//Kirigami.ColorUtils.tintWithAlpha(color, Kirigami.Theme.textColor, 0.15)
visible:
{
video
.
playbackState
==
MediaPlayer
.
StoppedState
&&
!
hasThumbnail
}
}
function
playOrPause
()
{
console
.
log
(
'playback state =='
,
video
.
playbackState
);
if
(
video
.
playbackState
==
MediaPlayer
.
PlayingState
)
{
video
.
pause
();
}
else
{
if
(
video
.
playbackState
==
MediaPlayer
.
StoppedState
)
{
video
.
seek
(
0
);
}
video
.
play
();
}
}
}
data:
[
label
,
video
,
bubble
.
progressBar
]
}
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jun 24, 7:57 AM (1 d, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
234557
Default Alt Text
Video.qml (2 KB)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment