Merge pull request #523 from Jedi18/master

Fix windows video bug
This commit is contained in:
DeepBlueV7.X 2021-03-15 15:51:10 +00:00 committed by GitHub
commit 6548b84e29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -114,6 +114,13 @@ with [homebrew](https://brew.sh/):
```sh ```sh
brew install --cask nheko brew install --cask nheko
``` ```
### FAQ
##
**Q:** Why don't videos run for me on Windows?
**A:** You're probably missing the required video codecs, download [K-Lite Codec Pack](https://codecguide.com/download_kl.htm).
##
### Build Requirements ### Build Requirements

View File

@ -185,7 +185,7 @@ Rectangle {
target: TimelineManager.timeline target: TimelineManager.timeline
onMediaCached: { onMediaCached: {
if (mxcUrl == model.data.url) { if (mxcUrl == model.data.url) {
media.source = "file://" + cacheUrl; media.source = cacheUrl;
button.state = "stopped"; button.state = "stopped";
console.log("media loaded: " + mxcUrl + " at " + cacheUrl); console.log("media loaded: " + mxcUrl + " at " + cacheUrl);
} }

View File

@ -1246,7 +1246,11 @@ TimelineModel::cacheMedia(QString eventId, std::function<void(const QString)> ca
QDir().mkpath(filename.path()); QDir().mkpath(filename.path());
if (filename.isReadable()) { if (filename.isReadable()) {
#if defined(Q_OS_WIN)
emit mediaCached(mxcUrl, filename.filePath()); emit mediaCached(mxcUrl, filename.filePath());
#else
emit mediaCached(mxcUrl, "file://" + filename.filePath());
#endif
if (callback) { if (callback) {
callback(filename.filePath()); callback(filename.filePath());
} }
@ -1288,7 +1292,11 @@ TimelineModel::cacheMedia(QString eventId, std::function<void(const QString)> ca
nhlog::ui()->warn("Error while saving file to: {}", e.what()); nhlog::ui()->warn("Error while saving file to: {}", e.what());
} }
#if defined(Q_OS_WIN)
emit mediaCached(mxcUrl, filename.filePath()); emit mediaCached(mxcUrl, filename.filePath());
#else
emit mediaCached(mxcUrl, "file://" + filename.filePath());
#endif
}); });
} }