Repository navigation
Conversation
…me sources
playbackMediaType() returned video/quicktime for .mov, but browsers'
canPlayType('video/quicktime') returns an empty string, which makes the web
frontend treat the only (original) playback source as unsupported and show
"browser cannot play this video", even though Chrome/Edge can decode
H.264/AAC .mov.
Map .mov to video/mp4 (consistent with the existing .m4v case) so the
original source is not rejected. Genuinely unsupported containers (mkv/avi)
still return "" and fall back to transcoded/HLS.
Adds a case to TestPlaybackMediaTypeDescribesSelectedResource.
Owner
|
比起把 |
nianzhibai
added a commit
that referenced
this pull request
Nov 24, 2026
## Why
Browsers answer `canPlayType("video/quicktime")` with an empty string even
though most `.mov` files carry H.264/AAC they can decode. Advertising that
media type made players reject the original source upfront and fall back to
compatible playback or fail outright.
## What changed
- `playbackMediaType` no longer maps `.mov` to `video/quicktime`, leaving the
source untyped so players attempt it and recover on actual decode errors.
- Cover `.mov` in `TestPlaybackMediaTypeDescribesSelectedResource`.
## Testing
- `go test ./internal/api/`
Refs #126
Co-authored-by: rehack <rehack@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
问题
.mov视频在 Chrome/Edge 显示「浏览器无法播放当前视频」,.mp4正常。库内.mov占比很大,表现为“很多视频无法播放”。根因
playbackMediaType()对.mov返回video/quicktime(backend/internal/api/api.go),而浏览器的canPlayType('video/quicktime')返回空字符串""。前端videoSource用canPlayType(mediaType)===''判断“不支持”并跳过源,导致唯一可用的原画源被拦截;但浏览器其实能直接解码 H.264/AAC 的
.mov(实测<video src>可canplaythrough)。改动
.mov的mediaType统一为video/mp4(与本仓库.m4v现有行为一致)。.mkv/.avi等浏览器确实不支持的类型仍返回"",继续走 transcoded/HLS 兜底,行为不变。TestPlaybackMediaTypeDescribesSelectedResource增加.mov -> video/mp4用例。说明
根因也可在独立前端仓库
91-web/91-web-nostalgic里进一步加固(不要仅凭canPlayType硬拒绝file源,交给<video>实际尝试并按 error 回退)。本后端改动即可让现有前端恢复正常播放。