恢复无 cookie 拉流修复:iPhone 原生播放器(AVPlayer/夸克系统解码)不携带 cookie 时媒体资产可凭会话 ID 拉流,纯 HTTP 生效;新增拉流拒绝诊断日志

This commit is contained in:
yvan
2026-09-18 12:09:28 +08:00
parent 53c87872fc
commit f2802dcc5f
4 changed files with 37 additions and 2 deletions
+11
View File
@@ -94,6 +94,17 @@ func (app *UIApp) registerPlaybackRoutes(mux *http.ServeMux) {
mux.HandleFunc("/api/ui/playback/progress", app.handlePlaybackProgress)
}
// recordPlaybackAssetDenial 记录媒体资产请求被拒的情况,便于诊断
// iOS/WebKit 原生媒体管线的拉流失败(区分会话失效与观看者不匹配)。
func (app *UIApp) recordPlaybackAssetDenial(request *http.Request, reason string) {
agent := request.UserAgent()
if len(agent) > 120 {
agent = agent[:120]
}
app.downloader.recordDiagnostic(diagnosticEvent{Level: "warn", Event: "playback.asset.denied",
HTTPStatus: http.StatusGone, Message: reason + " ua=" + agent})
}
func playbackRequestAllowed(writer http.ResponseWriter, request *http.Request, method string) bool {
writer.Header().Set("Cache-Control", "private, no-store, no-transform")
writer.Header().Set("X-Accel-Buffering", "no")