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

Feat/video adaptation #596

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open

Conversation

saravanans-github
Copy link
Contributor

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

@saravanans-github saravanans-github requested a review from a team as a code owner December 24, 2024 10:50
import { VideoAdaptationData, AdaptationConfig } from './adaptationConfig';

// Export config types from Adaptation module.
export { VideoAdaptationData, AdaptationConfig };
Copy link
Contributor

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.

Suggested change
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.

Copy link
Contributor

@zigavehovec zigavehovec left a 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
Copy link
Contributor

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
Copy link
Contributor

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?

Suggested change
- 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) {
Copy link
Contributor

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
Copy link
Contributor

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? {
Copy link
Contributor

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.
*/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

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.

3 participants