From 264b57aa2ed01b52c09b2992d5ca61e33871315b Mon Sep 17 00:00:00 2001 From: Olivier Bouillet <62574056+freeboub@users.noreply.github.com> Date: Thu, 20 Jun 2024 11:19:35 +0200 Subject: [PATCH] fix(android): allow chunk less preparation (#3913) --- android/src/main/java/com/brentvatne/common/api/Source.kt | 8 ++++---- .../java/com/brentvatne/exoplayer/ReactExoplayerView.java | 2 +- examples/basic/src/VideoPlayer.tsx | 1 + src/Video.tsx | 2 ++ 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/android/src/main/java/com/brentvatne/common/api/Source.kt b/android/src/main/java/com/brentvatne/common/api/Source.kt index 75a8b85f..b19fa8d9 100644 --- a/android/src/main/java/com/brentvatne/common/api/Source.kt +++ b/android/src/main/java/com/brentvatne/common/api/Source.kt @@ -46,10 +46,10 @@ class Source { /** http header list */ val headers: MutableMap = HashMap() - /** enable chunckless preparation for HLS + /** enable chunkless preparation for HLS * see: */ - var textTracksAllowChuncklessPreparation: Boolean = false + var textTracksAllowChunklessPreparation: Boolean = false override fun hashCode(): Int = Objects.hash(uriString, uri, startPositionMs, cropStartMs, cropEndMs, extension, metadata, headers) @@ -123,7 +123,7 @@ class Source { private const val PROP_SRC_TYPE = "type" private const val PROP_SRC_METADATA = "metadata" private const val PROP_SRC_HEADERS = "requestHeaders" - private const val PROP_SRC_TEXT_TRACKS_ALLOW_CHUNCKLESS_PREPARATION = "textTracksAllowChunklessPreparation" + private const val PROP_SRC_TEXT_TRACKS_ALLOW_CHUNKLESS_PREPARATION = "textTracksAllowChunklessPreparation" @SuppressLint("DiscouragedApi") private fun getUriFromAssetId(context: Context, uriString: String): Uri? { @@ -180,7 +180,7 @@ class Source { source.cropStartMs = safeGetInt(src, PROP_SRC_CROP_START, -1) source.cropEndMs = safeGetInt(src, PROP_SRC_CROP_END, -1) source.extension = safeGetString(src, PROP_SRC_TYPE, null) - source.textTracksAllowChuncklessPreparation = safeGetBool(src, PROP_SRC_TEXT_TRACKS_ALLOW_CHUNCKLESS_PREPARATION, true) + source.textTracksAllowChunklessPreparation = safeGetBool(src, PROP_SRC_TEXT_TRACKS_ALLOW_CHUNKLESS_PREPARATION, true) val propSrcHeadersArray = safeGetArray(src, PROP_SRC_HEADERS) if (propSrcHeadersArray != null) { diff --git a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java index b306dcf3..0d6934f1 100644 --- a/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java +++ b/android/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java @@ -1046,7 +1046,7 @@ public class ReactExoplayerView extends FrameLayout implements mediaSourceFactory = new HlsMediaSource.Factory( mediaDataSourceFactory - ).setAllowChunklessPreparation(source.getTextTracksAllowChuncklessPreparation()); + ).setAllowChunklessPreparation(source.getTextTracksAllowChunklessPreparation()); break; case CONTENT_TYPE_OTHER: if ("asset".equals(uri.getScheme())) { diff --git a/examples/basic/src/VideoPlayer.tsx b/examples/basic/src/VideoPlayer.tsx index 3b4b9a00..ba12f403 100644 --- a/examples/basic/src/VideoPlayer.tsx +++ b/examples/basic/src/VideoPlayer.tsx @@ -150,6 +150,7 @@ class VideoPlayer extends Component { }, { description: '(hls|live) red bull tv', + textTracksAllowChunklessPreparation: false, uri: 'https://rbmn-live.akamaized.net/hls/live/590964/BoRB-AT/master_928.m3u8', metadata: { title: 'Custom Title', diff --git a/src/Video.tsx b/src/Video.tsx index a7bcfc19..627c9930 100644 --- a/src/Video.tsx +++ b/src/Video.tsx @@ -170,6 +170,8 @@ const Video = forwardRef( cropStart: resolvedSource.cropStart || 0, cropEnd: resolvedSource.cropEnd, metadata: resolvedSource.metadata, + textTracksAllowChunklessPreparation: + resolvedSource.textTracksAllowChunklessPreparation, }; }, [source]);