Skip to content

Commit

Permalink
fix(android): allow chunk less preparation (#3913)
Browse files Browse the repository at this point in the history
  • Loading branch information
freeboub authored Jun 20, 2024
1 parent 84bb910 commit 264b57a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions android/src/main/java/com/brentvatne/common/api/Source.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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? {
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,7 @@ private MediaSource buildMediaSource(Uri uri, String overrideExtension, DrmSessi

mediaSourceFactory = new HlsMediaSource.Factory(
mediaDataSourceFactory
).setAllowChunklessPreparation(source.getTextTracksAllowChuncklessPreparation());
).setAllowChunklessPreparation(source.getTextTracksAllowChunklessPreparation());
break;
case CONTENT_TYPE_OTHER:
if ("asset".equals(uri.getScheme())) {
Expand Down
1 change: 1 addition & 0 deletions examples/basic/src/VideoPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions src/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
cropStart: resolvedSource.cropStart || 0,
cropEnd: resolvedSource.cropEnd,
metadata: resolvedSource.metadata,
textTracksAllowChunklessPreparation:
resolvedSource.textTracksAllowChunklessPreparation,
};
}, [source]);

Expand Down

0 comments on commit 264b57a

Please sign in to comment.