[android] Add httpEngine prop for configurable ExoPlayer data source#15
Closed
skidder wants to merge 2 commits into
Closed
[android] Add httpEngine prop for configurable ExoPlayer data source#15skidder wants to merge 2 commits into
skidder wants to merge 2 commits into
Conversation
Add a named data source factory registry to DataSourceUtil so host apps can register alternative factories (e.g. OkHttp, Cronet) and select them per Video instance via the new httpEngine prop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
setSrc() was calling DataSourceUtil.getDefaultDataSourceFactory() directly, bypassing the httpEngine check in buildDataSourceFactory(). Also, setHttpEngine() wasn't rebuilding the factory when a source was already set. Both paths now use buildDataSourceFactory() so the named factory is used regardless of prop ordering. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DataSourceUtilfor per-instance HTTP engine selectionhttpEngineprop toReactExoplayerView/ReactExoplayerViewManager"okhttp","cronet"), the view uses the corresponding factory instead of the global defaultCompanion to discord/discord#261491 — extends configurable HTTP engine support to react-native-video consumers (e.g. Discord Quests video player).
Changes
DataSourceUtil.javaregisterDataSourceFactory(name, factory)— register a named factorygetNamedDataSourceFactory(name)— look up by name, falls back to defaultReactExoplayerView.javahttpEnginefield and setterbuildDataSourceFactory()checks for named factory before using defaultReactExoplayerViewManager.java@ReactProp(name = "httpEngine")wired to viewVideo.jshttpEngine: PropTypes.stringadded to prop typesTest plan
httpEngine='default'— uses DefaultHttpDataSourcehttpEngine='okhttp'— uses registered OkHttp factoryhttpEngine='cronet'— uses registered Cronet factoryhttpEngineprop — uses global default (no regression)