Skip to content

[android] Add httpEngine prop for configurable ExoPlayer data source#15

Closed
skidder wants to merge 2 commits into
5.2.1-discordfrom
skidder/http-engine
Closed

[android] Add httpEngine prop for configurable ExoPlayer data source#15
skidder wants to merge 2 commits into
5.2.1-discordfrom
skidder/http-engine

Conversation

@skidder
Copy link
Copy Markdown

@skidder skidder commented Feb 23, 2026

Summary

  • Add named data source factory registry to DataSourceUtil for per-instance HTTP engine selection
  • Add httpEngine prop to ReactExoplayerView / ReactExoplayerViewManager
  • When set to a registered name (e.g. "okhttp", "cronet"), the view uses the corresponding factory instead of the global default

Companion to discord/discord#261491 — extends configurable HTTP engine support to react-native-video consumers (e.g. Discord Quests video player).

Changes

DataSourceUtil.java

  • registerDataSourceFactory(name, factory) — register a named factory
  • getNamedDataSourceFactory(name) — look up by name, falls back to default

ReactExoplayerView.java

  • httpEngine field and setter
  • buildDataSourceFactory() checks for named factory before using default

ReactExoplayerViewManager.java

  • @ReactProp(name = "httpEngine") wired to view

Video.js

  • httpEngine: PropTypes.string added to prop types

Test plan

  • Build Android app with changes
  • Play video with httpEngine='default' — uses DefaultHttpDataSource
  • Play video with httpEngine='okhttp' — uses registered OkHttp factory
  • Play video with httpEngine='cronet' — uses registered Cronet factory
  • Play video without httpEngine prop — uses global default (no regression)
  • iOS unaffected (prop ignored)

skidder and others added 2 commits February 23, 2026 11:52
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>
@skidder skidder closed this Apr 30, 2026
@skidder skidder deleted the skidder/http-engine branch April 30, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant