From 6625c6d8a0df8bc9fa715736a45e0c489c00bc45 Mon Sep 17 00:00:00 2001 From: Alexander Pankratov Date: Sat, 2 Sep 2023 22:22:09 +0200 Subject: [PATCH] Fix: safari --- src/MTProtoTools/ResponseInfo.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/MTProtoTools/ResponseInfo.php b/src/MTProtoTools/ResponseInfo.php index f1b795753..d86ba1755 100644 --- a/src/MTProtoTools/ResponseInfo.php +++ b/src/MTProtoTools/ResponseInfo.php @@ -106,14 +106,15 @@ final class ResponseInfo } $seek_start = empty($seek_start) ? 0 : \abs(\intval($seek_start)); - /*if ($range !== '') { + $isSafari = !empty($headers['user-agent']) && preg_match('/^((?!chrome|android).)*safari/i', $headers['user-agent']); + if ($range !== '' && $isSafari) { //Safari video streaming fix $length = ($seek_end - $seek_start + 1); $maxChunkSize = 10 * 1024 ** 2; if ($length > $maxChunkSize) { $seek_end = $seek_start + $maxChunkSize - 1; } - }*/ + } $this->serve = $method !== 'HEAD'; if ($seek_start > 0 || $seek_end < $size - 1) {