This content originally appeared on DEV Community and was authored by Ajmal Hasan
I recently encountered an issue in ReactExoplayerView
where playback speed adjustments weren't working as expected. 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.
This content originally appeared on DEV Community and was authored by Ajmal Hasan
Ajmal Hasan | Sciencx (2024-10-26T20:09:28+00:00) Solution: compileDebugJavaWithJavac because error: switch expressions are not supported in -source 11. Retrieved from https://www.scien.cx/2024/10/26/solution-compiledebugjavawithjavac-because-error-switch-expressions-are-not-supported-in-source-11/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.