-
Notifications
You must be signed in to change notification settings - Fork 13
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
Expose TweaksConfig.forceReuseVideoCodecReasons
from Android
#561
Expose TweaksConfig.forceReuseVideoCodecReasons
from Android
#561
Conversation
…eVideoCodecReasons
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 didn't test the PR, just reviewed the code change.
val mutableSet = mutableSetOf<ForceReuseVideoCodecReason>() | ||
for (item in it) { | ||
val reason = item?.forceReuseVideoCodecReason() | ||
if (reason != null) { | ||
mutableSet.add(reason) | ||
} | ||
} | ||
forceReuseVideoCodecReasons = mutableSet | ||
} |
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.
val mutableSet = mutableSetOf<ForceReuseVideoCodecReason>() | |
for (item in it) { | |
val reason = item?.forceReuseVideoCodecReason() | |
if (reason != null) { | |
mutableSet.add(reason) | |
} | |
} | |
forceReuseVideoCodecReasons = mutableSet | |
} | |
forceReuseVideoCodecReasons = it.mapNotNull(String::toForceReuseVideoCodecReason).toSet() |
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.
Probably also a toSet()
needs to be added.
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.
/** | ||
* When switching between video formats (eg: adapting between video qualities) the codec might be recreated due to several reasons. | ||
* This behaviour can cause brief black screens when switching between video qualities as codec recreation can be slow. | ||
* |
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.
Documentation was incomplete.
* | |
* | |
* If a device is know to support video format changes and keep the current decoder without issues, | |
* this set can be filled with multiple `ForceReuseVideoCodecReason` and avoid the black screen. | |
* |
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.
/** | ||
* Converts any JS string into an `AdSourceType` enum value. | ||
*/ | ||
private fun String.forceReuseVideoCodecReason(): ForceReuseVideoCodecReason? = when (this) { |
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.
Conversion function are prefixed by to
:
private fun String.forceReuseVideoCodecReason(): ForceReuseVideoCodecReason? = when (this) { | |
private fun String.toForceReuseVideoCodecReason(): ForceReuseVideoCodecReason? = when (this) { |
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.
@@ -167,6 +168,16 @@ fun ReadableMap.toStyleConfig(): StyleConfig = StyleConfig().apply { | |||
withString("scalingMode") { scalingMode = ScalingMode.valueOf(it) } | |||
} | |||
|
|||
/** | |||
* Converts any JS string into an `AdSourceType` enum value. |
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.
* Converts any JS string into an `AdSourceType` enum value. | |
* Converts any JS string into an `ForceReuseVideoCodecReason` enum value. |
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.
android/src/main/java/com/bitmovin/player/reactnative/converter/JsonConverter.kt
Outdated
Show resolved
Hide resolved
val mutableSet = mutableSetOf<ForceReuseVideoCodecReason>() | ||
for (item in it) { | ||
val reason = item?.forceReuseVideoCodecReason() | ||
if (reason != null) { | ||
mutableSet.add(reason) | ||
} | ||
} | ||
forceReuseVideoCodecReasons = mutableSet | ||
} |
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.
Probably also a toSet()
needs to be added.
TweaksConfig.forceReuseVideoCodecReasons
from Android
Thanks for the reviews, I'll pick this up tomorrow. |
…-tweaksConfig-forceReuseVideoCodecReasons
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.
@strangesource Please revisit the Changelog entry
Co-authored-by: Matthias Tamegger <[email protected]>
Description
Expose Android SDKs TweaksConfig.forceReuseVideoCodecReasons
Changes
Checklist
CHANGELOG
entry