-
Notifications
You must be signed in to change notification settings - Fork 14
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
Feat/video adaptation #596
base: development
Are you sure you want to change the base?
Conversation
import { VideoAdaptationData, AdaptationConfig } from './adaptationConfig'; | ||
|
||
// Export config types from Adaptation module. | ||
export { VideoAdaptationData, AdaptationConfig }; |
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.
Hi @saravanans-github!
To fix the documentation error, and possibly a potential integration error regarding imports, please replace this line here with the suggestion.
export { VideoAdaptationData, AdaptationConfig }; | |
export * from './adaptationConfig'; |
The reason is that all exported types should be re-exported on the top-level and now this is not the case.
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.
Nice work! Mostly nitpicks from me 👍
@@ -2,6 +2,14 @@ | |||
|
|||
## [Unreleased] | |||
|
|||
### Changed | |||
|
|||
- Android: Refactored AdaptationConfig to enable the `onVideoAdaptation` callback |
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.
I think this changelog isn't necessary, as the existing api's can be called the same way as before, or am I missing something?
|
||
### Added | ||
|
||
- Android: Added support for the `onVideoAdaptation` callback |
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.
What do you think about this?
- Android: Added support for the `onVideoAdaptation` callback | |
- Android: Added `AdaptationConfig.videoAdaptation` to customize the player's adaptation logic |
} | ||
} | ||
|
||
private fun initConfigBlocks(nativeId: String, config: ReadableMap) { |
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.
I would just directly call initVideoAdaptationData
from initWithConfig
. I guess this pattern comes form NetworkModule, where there were multiple init blocks to trigger.
adaptationConfig.videoAdaptation = VideoAdaptation { data -> | ||
val future = onVideoAdaptationFromJS(nativeId, data) | ||
try { | ||
val callbackValue = future.get(1, TimeUnit.SECONDS) // set timeout to mimize playback performance impact |
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.
Have you seen problems with the promise taking longer to resolve? Is this really needed, I don't see a reason why this could take more than a second, do we really need this?
If so, we might want to consider if we need this also in other similar APIs like preprocessHttpResponseCallback
and preprocessHttpRequestCallback
in the NetworkModule - not a part of this PR of course.
withInt("maxSelectableBitrate") { maxSelectableVideoBitrate = it } | ||
withInt("initialBandwidthEstimateOverride") { initialBandwidthEstimateOverride = it.toLong(); } | ||
} | ||
|
||
fun ReadableMap.toVideoAdaptationData(): VideoAdaptationData? { |
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.
This is not used, do is it a leftover or are we missing something?
* @param requestId Passed through to identify the completion handler of the request on native. | ||
* @param data The quality according to VideoQuality.id that is returned will be downloaded next. | ||
*/ | ||
|
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.
Description
Added support for Android onVideoAdaptation callback.
Changes
In a similar design to the NetworkConfig I abstracted the AdaptationConfig to an AdaptationModule to support the callback
Checklist
CHANGELOG
entry