-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Refactor exoplayer deprecations #1653
Refactor exoplayer deprecations #1653
Conversation
@danielmarino24i Man, it's really nice to see these deprecated functions going away. Nice work. I'm not sure what the easiest way to send you the code recommendations, so I'm pasting them inline: SingleSampleMediaSource
I tested this with some sideloaded subs and this code is working fine. AdaptiveTrackSelection.Factory
I don't believe the bandwidth meter is doing anything particularly important. |
Added your suggestions, bandwidth meter is now configured on the exoplayer instance |
Seems, if I didn't miss any, that all deprecations are gone now |
# Conflicts: # android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java
@kristerkari I am doing tests with But as it has AndroidX support, and they have migrated to androidx.compat, seems it will be released as 5.x |
Ok, thanks for the info! Then we have to get React Native updated to the latest version first before being able to fix the crash. |
I think update of RN is not required to test it. I mean, for real AndroidX support I think you have to, but to compile the app with libraries with androidX support you don't need to migrate to RN >=0.60 |
Oh that's great to hear, I was under the impression that updating to 5.x requires RN 0.60 |
I think it is recommended, but I am testing with |
DefaultLoadControl defaultLoadControl = defaultLoadControlBuilder.createDefaultLoadControl(); | ||
DefaultRenderersFactory renderersFactory = new DefaultRenderersFactory(getContext(), DefaultRenderersFactory.EXTENSION_RENDERER_MODE_OFF); | ||
// TODO: Add drmSessionManager to 5th param from: https://github.com/react-native-community/react-native-video/pull/1445 | ||
player = ExoPlayerFactory.newSimpleInstance(getContext(), renderersFactory, trackSelector, defaultLoadControl, null, BANDWIDTH_METER); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should also update how the bandwidth meter is created. Looks like new DefaultBandwidthMeter()
misses a lot of the smart defaults we get when using the builder that takes a context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sth like this?
SimpleExoPlayer player = ExoPlayerFactory.newSimpleInstance(context);
DataSource.Factory dataSourceFactory =
new DefaultDataSourceFactory(context, userAgent);
MediaSource mediaSource =
new DashMediaSource.Factory(dataSourceFactory)
.createMediaSource(uri);
player.prepare(mediaSource);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks right although it'd be nice to reuse the bandwidth meter between plays. I believe that's why it's currently a static variable.
Maybe outside the scope of this PR but what do you think about creating a ReactVideoPackageConfig
class that exposes the exoplayer configuration. There would be a default implementation that uses the exo defaults and each application could override the config by passing a config object when instantiating ReactVideoPackage
.
This was done in #1753! We'll release the change in a 5.1-alpha |
Please check carefully for possible breaking changes.
This PR removes exoplayer deprecations in order to be able to upgrade easier to exoplayer 2.10.
TODO (need help):