-
Notifications
You must be signed in to change notification settings - Fork 248
Open
Open
Copy link
Labels
area-playerRelated to the audio playback engine.Related to the audio playback engine.platform-androidRelated to the Android specific integrationsRelated to the Android specific integrationsstate-acceptedThis is a valid topic to work on.This is a valid topic to work on.
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
On Android I am seeing a crash with IllegalArgumentException: "Animation duration cannot be negative". When playback is running and the beat cursor moves, or when the user interacts with the score (scrolling playback fragment to off-screen) and alphaTab triggers cursor scroll/animation, the app sometimes crashes with:
java.lang.IllegalArgumentException: Animation duration cannot be negative
at android.view.animation.Animation.setDuration(Animation.java:466)
at alphaTab.platform.android.AndroidViewContainer.transitionToX$lambda$0(AndroidViewContainer.kt:182)
at alphaTab.platform.android.AndroidViewContainer$$ExternalSyntheticLambda1.invoke(D8$$SyntheticClass:0)
at alphaTab.platform.android.AndroidUiFacade.beginInvoke$lambda$0(AndroidUiFacade.kt:348)
at alphaTab.platform.android.AndroidUiFacade$$ExternalSyntheticLambda5.run(D8$$SyntheticClass:0)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.app.ActivityThread.main(ActivityThread.java:8810)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Expected Behavior
Even if alphaTab computes a negative duration, the android view should not crash. The animation duration probably should be clamped to non‑negative values.
Steps To Reproduce
- Create a simple Android app screen that hosts alphaTab
- Enable user interaction and cursor in settings, similar to:
val settings = alphaTab.Settings().apply {
player.playerMode = PlayerMode.EnabledAutomatic
player.enableCursor = true
player.enableAnimatedBeatCursor = true
player.enableUserInteraction = true
player.scrollMode = ScrollMode.OffScreen
display.scale = 0.8
}
- Load a MusicXML score
- Start playback
- Scroll the score's playing fragment to off-screen
Link to jsFiddle, CodePen, Project
No response
Version and Environment
1. alphaTab version: 1.8.1
2. Platform: Android (Kotlin)
3. Devices: Android 14/16 tablet and phonePlatform
Android (Native)
Anything else?
Possible Fix:
In my fork I fixed this by clamping the duration to at least 0 on the Android side AndreiGorelov@56cfdef
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-playerRelated to the audio playback engine.Related to the audio playback engine.platform-androidRelated to the Android specific integrationsRelated to the Android specific integrationsstate-acceptedThis is a valid topic to work on.This is a valid topic to work on.
Type
Projects
Status
No status