Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fixed the issue that video playback failed #2557

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Qt::Alignment VideoPreview::statusBarWidgetAlignment() const
void VideoPreview::play()
{
if (playerWidget && videoUrl.isValid()) {
playerWidget->play(videoUrl);
playerWidget->playFile(videoUrl);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,22 @@ QSize VideoWidget::sizeHint() const
return QSize(p->info.width, p->info.height).scaled(qMin(p->info.width, int(screen_size.width() * 0.5)), qMin(p->info.height, int(screen_size.height() * 0.5)), Qt::KeepAspectRatio);
}

void VideoWidget::playFile(const QUrl &url)
{
videoUrl = url;
}

void VideoWidget::mouseReleaseEvent(QMouseEvent *event)
{
p->pause();

dmr::PlayerWidget::mouseReleaseEvent(event);
}

void VideoWidget::showEvent(QShowEvent *event)
{
if (!videoUrl.isEmpty())
play(videoUrl);

return dmr::PlayerWidget::showEvent(event);
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,15 @@ class VideoWidget : public dmr::PlayerWidget

QSize sizeHint() const override;

void playFile(const QUrl &url);

void mouseReleaseEvent(QMouseEvent *event) override;

void showEvent(QShowEvent *event) override;

VideoPreview *p;
QLabel *title;
QUrl videoUrl;
};
}
#endif // PLAYERWIDGET_H
Loading