feat: Add video preview on cover hover for desktop app#2334
Open
stephen-zeng wants to merge 5 commits into
Open
feat: Add video preview on cover hover for desktop app#2334stephen-zeng wants to merge 5 commits into
stephen-zeng wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a desktop-only “hover to preview video cover” feature with user-configurable delay, and threads an optional Account through relevant HTTP requests to support account-aware fetching.
Changes:
- Added new settings keys/prefs for enabling cover hover preview and configuring preview trigger delay.
- Introduced a
VideoCoverPreviewwidget + global controller backed bymedia_kitfor hover playback. - Updated
VideoHttp.videoUrlandSearchHttp.ab2cWithDimensionto accept an optionalAccountand pass it via request options.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/utils/storage_pref.dart | Adds new preference getters for preview enablement and delay. |
| lib/utils/storage_key.dart | Adds new persistent setting keys for the preview feature. |
| lib/pages/setting/models/play_settings.dart | Adds desktop setting row + delay configuration dialog. |
| lib/http/video.dart | Adds optional Account param and forwards it via request options. |
| lib/http/search.dart | Adds optional Account param and forwards it via request options. |
| lib/common/widgets/video_card/video_cover_preview_controller.dart | Adds singleton controller managing a shared media_kit player instance. |
| lib/common/widgets/video_card/video_cover_preview.dart | Adds hover-driven preview widget that resolves and plays a low-quality stream. |
| lib/common/widgets/video_card/video_card_v.dart | Replaces static cover image with hover-preview-enabled cover widget (vertical cards). |
| lib/common/widgets/video_card/video_card_h.dart | Replaces static cover image with hover-preview-enabled cover widget (horizontal cards). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+334
to
+340
| builder: (context, setDialogState) => Column( | ||
| spacing: 20, | ||
| mainAxisSize: MainAxisSize.min, | ||
| children: [ | ||
| Slider( | ||
| padding: .zero, | ||
| value: delay, |
Comment on lines
+23
to
+27
| Future<void> play(Object owner, String url) async { | ||
| final sessionId = ++_sessionId; | ||
| await _ensurePlayer(); | ||
| final player = _player; | ||
| if (player == null || sessionId != _sessionId) return; |
Comment on lines
+125
to
+134
| Future<void> _startPreview(int requestId) async { | ||
| if (!_isCurrentRequest(requestId) || _loading) return; | ||
| setState(() => _loading = true); | ||
|
|
||
| final preview = await _resolvePreview(); | ||
| if (!_isCurrentRequest(requestId)) return; | ||
|
|
||
| if (preview == null) { | ||
| setState(() => _loading = false); | ||
| return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
本 PR 为桌面端通用视频卡片新增“封面悬停预览”能力:鼠标悬停在视频封面超过配置时长后,自动以静音、最低画质播放视频预览,鼠标移出后恢复封面。模仿B站网页端和YouTube网页端首页的效果。
目前接入复用通用卡片的页面有推荐、搜索、热门、排行、相关视频。
主要改动
取流与账号
音频与系统媒体隔离
全局设置
在桌面端“播放器设置”中新增“封面悬停预览”设置项:
预览显示效果
Screen.Recording.2026-06-06.at.5.33.57.PM.webm