Skip to content

Commit

Permalink
fix: Fixed the issue that video playback failed
Browse files Browse the repository at this point in the history
Fixed the issue that video playback failed

Log: Fixed the issue that video playback failed
  • Loading branch information
pengfeixx authored and deepin-bot[bot] committed Jan 22, 2025
1 parent 866275b commit b25f25b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
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

0 comments on commit b25f25b

Please sign in to comment.