I recently encountered an issue in ReactExoplayerView
where android build was crashing with mentioned error. Here's the fix that resolved the problem:
Original Code (Using a Switch Expression):
float speed = switch (which) {
case 0 -> 0.5f;
case 2 -> 1.5f;
case 3 -> 2.0f;
default -> 1.0f;
};
Updated Code (Using a Traditional Switch Statement):
switch (which) {
case 0:
speed = 0.5f;
break;
case 2:
speed = 1.5f;
break;
case 3:
speed = 2.0f;
break;
default:
speed = 1.0f;
break;
}
The issue was caused by the switch
expression, which I replaced with a traditional switch
statement. After making this change, the playback speeds worked correctly.
Final Step:
After making the code change, I used patch-package
to ensure the fix was preserved:
npx patch-package react-native-video
This fixed the bug and ensured smooth playback speed transitions in my React Native app.
Top comments (0)