I am trying to change the http headers sent when using HLS. This is what my current code looks like:
private MediaSource buildMediaStore(String streamUrl) {
Uri streamUri = Uri.parse(streamUrl);
HttpDataSource.Factory dataSourceFactory = new DefaultHttpDataSourceFactory("custom_player", defaultBandwidthMeter);
return new HlsMediaSource.Factory(dataSourceFactory).setExtractorFactory(new DefaultHlsExtractorFactory()).createMediaSource(streamUri);
}
How would I do it? I thought about using the built HttpDataSource but I couldn't pass it into HlsMediaSource or HlsMediaSource.Factory from my knowledge.
As far as I'm aware, it should be
dataSourceFactory.getDefaultRequestProperties().set("Some Header Key", "Header Value");
I will edit this with something to back me up if I can find it
You can use getDefaultRequestProperties on DataSource.Factory or HttpDataSource.Factory