From 97beb6eb65adaaa84c81add62a58403e3196c0e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Fri, 26 Apr 2024 08:34:04 +0200 Subject: [PATCH] fix: call to load in MediaElement using src= in HLS Safari (#6478) Fixes https://github.com/shaka-project/shaka-player/issues/6447 --- lib/player.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/player.js b/lib/player.js index 992589610b..d0fbd47a8b 100644 --- a/lib/player.js +++ b/lib/player.js @@ -2334,6 +2334,15 @@ shaka.Player = class extends shaka.util.FakeEventTarget { mediaElement.load(); } + // In Safari using HLS won't load anything unless you call load() + // explicitly, no matter the value of the preload attribute. + // Note: this only happens when there are not autoplay. + if (mediaElement.preload != 'none' && !mediaElement.autoplay && + shaka.util.MimeUtils.isHlsType(mimeType) && + shaka.util.Platform.safariVersion()) { + mediaElement.load(); + } + // Set the load mode last so that we know that all our components are // initialized. this.loadMode_ = shaka.Player.LoadMode.SRC_EQUALS;