fix(android): allow chunk less preparation (#3913)

This commit is contained in:
Olivier Bouillet 2024-06-20 11:19:35 +02:00 committed by GitHub
parent 84bb910d10
commit 264b57aa2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 5 deletions

View File

@ -46,10 +46,10 @@ class Source {
/** http header list */
val headers: MutableMap<String, String> = 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) {

View File

@ -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())) {

View File

@ -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',

View File

@ -170,6 +170,8 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
cropStart: resolvedSource.cropStart || 0,
cropEnd: resolvedSource.cropEnd,
metadata: resolvedSource.metadata,
textTracksAllowChunklessPreparation:
resolvedSource.textTracksAllowChunklessPreparation,
};
}, [source]);