Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: API for providing HttpDataSource #86

Closed
ZacSweers opened this issue Feb 4, 2016 · 12 comments
Closed

Proposal: API for providing HttpDataSource #86

ZacSweers opened this issue Feb 4, 2016 · 12 comments
Milestone

Comments

@ZacSweers
Copy link
Contributor

ExoPlayer allows for providing a custom HttpDataSource. One such use would be providing your own, more up-to-date OkHttpClient instance rather than relying on the older one in the Android framework. It's also useful if you have custom logging in your HttpClient implementation that you'd like to track in the video.

@brianwernick
Copy link
Owner

I like this idea however it will have to wait until a 3.x version

@se-bastiaan
Copy link
Contributor

You can provide your own RenderBuilder by using setVideoURI(Uri uri, RenderBuilder renderBuilder) in which you use a different DataSource. Bit more work than just providing a DataSource, but it's possible.

@ZacSweers
Copy link
Contributor Author

RenderBuilder doesn't provide the option for specifying your own DataSource as far as I can see? Unless you mean overriding buildRenderers

@brianwernick
Copy link
Owner

@hzsweers You would need to create your own RenderBuilder and specify a DataSource of your own. See RenderBuilder-Line#79

@brianwernick brianwernick added this to the 3.0.0 milestone Feb 17, 2016
@brianwernick brianwernick modified the milestones: 3.x, 3.0.0 Mar 24, 2016
@brianwernick
Copy link
Owner

Because this isn't a major issue and the ability to specify the DataSource via the RenderBuilders already exists, I'm moving a more simplified solution to a later 3.x release

@ZacSweers
Copy link
Contributor Author

I would argue this is a significant issue and specifying via datarenderers isn't simple, but I suppose it's down to the consumer. At the very least, a sample or wiki example would be good to have in the meantime.

@MrArca9
Copy link

MrArca9 commented Aug 29, 2016

Any updates on this?

I would love to be able to set HTTPHeaders for HLS Requests.

@brianwernick
Copy link
Owner

No, It's a low-priority issue as you can specify you own DataSource via the RenderBuilders currently

@MrArca9
Copy link

MrArca9 commented Sep 1, 2016

Alright, i actually just removed exomedia and used the demo exoPlayer as it was easier to set it that way.

@brianwernick
Copy link
Owner

I'm not sure why that is easier than just specifying your own RenderBuilder but I'm happy it works for you

@SalmanTKhan
Copy link

SalmanTKhan commented Oct 10, 2016

Where do you supply your own RenderBuilder? I guess that was a dumb question but during setVideoURI

/**
* Sets the Uri location for the video to play
*
* @param uri The video's Uri
* @param renderBuilder RenderBuilder that should be used
*/
public void setVideoURI(@nullable Uri uri, @nullable RenderBuilder renderBuilder)

@brianwernick
Copy link
Owner

This functionality has been added to the working 4.0.0 branch. The Demo's App.java has an example, but for posterity I'm reproducing it here as well.

// Registers the media sources to use the OkHttp client instead of the standard Apache one
// Note: the OkHttpDataSourceFactory can be found in the ExoPlayer extension library `extension-okhttp`
ExoMedia.setHttpDataSourceFactoryProvider(new ExoMedia.HttpDataSourceFactoryProvider() {
    @Override
    public HttpDataSource.BaseFactory provide(@NonNull String userAgent, @Nullable TransferListener<? super DataSource> listener) {
        return new OkHttpDataSourceFactory(new OkHttpClient(), userAgent, listener);
    }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants