Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
8e433a7e
Verified
Commit
8e433a7e
authored
3 years ago
by
Joe Donofry
Browse files
Options
Downloads
Patches
Plain Diff
PlayableMediaMessage fixes on macOS
parent
743a83c8
No related branches found
No related tags found
1 merge request
!15
Video player enhancements
Pipeline
#1979
failed
3 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ui/MxcMediaProxy.cpp
+31
-2
31 additions, 2 deletions
src/ui/MxcMediaProxy.cpp
with
31 additions
and
2 deletions
src/ui/MxcMediaProxy.cpp
+
31
−
2
View file @
8e433a7e
...
...
@@ -13,6 +13,11 @@
#include
<QStandardPaths>
#include
<QUrl>
#if defined(Q_OS_MACOS)
// TODO (red_sky): Remove for Qt6. See other ifdef below
#include
<QTemporaryFile>
#endif
#include
"EventAccessors.h"
#include
"Logging.h"
#include
"MatrixClient.h"
...
...
@@ -75,7 +80,7 @@ MxcMediaProxy::startDownload()
QPointer
<
MxcMediaProxy
>
self
=
this
;
auto
processBuffer
=
[
this
,
encryptionInfo
,
filename
,
self
](
QIODevice
&
device
)
{
auto
processBuffer
=
[
this
,
encryptionInfo
,
filename
,
self
,
suffix
](
QIODevice
&
device
)
{
if
(
!
self
)
return
;
...
...
@@ -90,10 +95,34 @@ MxcMediaProxy::startDownload()
buffer
.
open
(
QIODevice
::
ReadOnly
);
buffer
.
reset
();
QTimer
::
singleShot
(
0
,
this
,
[
this
,
filename
]
{
QTimer
::
singleShot
(
0
,
this
,
[
this
,
filename
,
suffix
,
encryptionInfo
]
{
#if defined(Q_OS_MACOS)
if
(
encryptionInfo
)
{
// macOS has issues reading from a buffer in setMedia for whatever reason.
// Instead, write the buffer to a temporary file and read from that.
// This should be fixed in Qt6, so update this when we do that!
// TODO: REMOVE IN QT6
QTemporaryFile
tempFile
;
tempFile
.
setFileTemplate
(
tempFile
.
fileTemplate
()
+
QLatin1Char
(
'.'
)
+
suffix
);
tempFile
.
open
();
tempFile
.
write
(
buffer
.
data
());
tempFile
.
close
();
nhlog
::
ui
()
->
debug
(
"Playing media from temp buffer file: {}. Remove in QT6!"
,
filename
.
filePath
().
toStdString
());
this
->
setMedia
(
QUrl
::
fromLocalFile
(
tempFile
.
fileName
()));
}
else
{
nhlog
::
ui
()
->
info
(
"Playing buffer with size: {}, {}"
,
buffer
.
bytesAvailable
(),
buffer
.
isOpen
());
this
->
setMedia
(
QUrl
::
fromLocalFile
(
filename
.
filePath
()));
}
#else
Q_UNSUED
(
suffix
)
Q_UNUSED
(
encryptionInfo
)
nhlog
::
ui
()
->
info
(
"Playing buffer with size: {}, {}"
,
buffer
.
bytesAvailable
(),
buffer
.
isOpen
());
this
->
setMedia
(
QMediaContent
(
filename
.
fileName
()),
&
buffer
);
#endif
emit
loadedChanged
();
});
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment