From 31cb8e2cbda321d2ddf8060e789b99ee683a3f83 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Thu, 12 May 2022 12:10:46 +1000 Subject: [PATCH] Fix direct stream not working in Safari (#2581) --- internal/manager/running_streams.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/manager/running_streams.go b/internal/manager/running_streams.go index 644680394..41c196462 100644 --- a/internal/manager/running_streams.go +++ b/internal/manager/running_streams.go @@ -58,8 +58,11 @@ func (s *SceneServer) StreamSceneDirect(scene *models.Scene, w http.ResponseWrit filepath := GetInstance().Paths.Scene.GetStreamPath(scene.Path, scene.GetHash(fileNamingAlgo)) streamRequestCtx := NewStreamRequestContext(w, r) - lockCtx := GetInstance().ReadLockManager.ReadLock(streamRequestCtx, filepath) - defer lockCtx.Cancel() + + // #2579 - hijacking and closing the connection here causes video playback to fail in Safari + // We trust that the request context will be closed, so we don't need to call Cancel on the + // returned context here. + _ = GetInstance().ReadLockManager.ReadLock(streamRequestCtx, filepath) http.ServeFile(w, r, filepath) }