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

AlphaTabApi does not work on Android OS <= 28 #871

Closed
1 task done
kiketen opened this issue May 24, 2022 · 6 comments
Closed
1 task done

AlphaTabApi does not work on Android OS <= 28 #871

kiketen opened this issue May 24, 2022 · 6 comments

Comments

@kiketen
Copy link

kiketen commented May 24, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

After updating alphatab to the last stable version (1.2.2), the score sheet is not loaded anymore for all the android devices with a OS <= 28.

When we call to new alphaTab.AlphaTabApi(element, options) we are getting this error: Uncaught TypeError: alphaTab.alphaTabApi is not a constructor.

Another error that we are getting for this OS that we are seeing on above OS' is this one: "Uncaught ReferenceError: globalThis is not defined", source: file:///android_asset/alphatab/alphaTab.min.js (17), maybe this could help for seeing where the problem.

Whatever you need to see where the problem is, I'll help to :)

Expected Behavior

new alphaTab.AlphaTabApi(element, options) call should work for OS <= 28 as it was working on version 0.9.8 (it was the version that we were using before the update).

Steps To Reproduce

Make the call to AlphaTabApi with an android device with an OS <= 28 (I've used the Pixel 2 from Android Studio )

Link to jsFiddle, CodePen, Project

No response

Found in Version

1.2

Platform

Android (WebView)

Environment

- **OS**:Android 28
- **Browser**:
- **.net Version**:

Anything else?

No response

@kiketen
Copy link
Author

kiketen commented May 24, 2022

To give more context to the problem, rolling back to version 1.1.0 the problem disappears. So I could say that this bug was introduced in the version 1.2.0

@Danielku15
Copy link
Member

There is a lot that can go wrong in such cases. Can you please provide an example project showing the issue?
It is crucial to know what exact browser version you are using. Even with the WebView there are specifics to it (it's updated through play store in some cases). It is also important to know how you have configured the WebView.

The globalThis is definitly the root cause for the next issues.
https://chromestatus.com/feature/6571514765770752
https://caniuse.com/?search=globalthis

But there is a error handling around the globalThis access, so I am still wondering where exactly this might be caused: https://github.com/CoderLine/alphaTab/blob/v1.2.2/src/Environment.ts#L163

Also please name the exact image you use for testing to be sure I can reproduce it. At the time when I was working on version 1.2 I was owning a real Pixel 2 XL and was testing with it. So it is unlikely a general issue.

@kiketen
Copy link
Author

kiketen commented May 27, 2022

Hi @Danielku15! The project where I'm using AlphaTab is Fretello. The issue it is not in production, so you'll cannot see it anyway.

As you have said, we are using a WebView for displaying alphaTab in our app. This is the configuration used in our app for the WebView (NotesViewClient extends WebViewClient):
image

The exact image was a Pixel 2 but with an Android OS 28, i.e., Android 9. I think that you are going to be capable of reproducing the issue with any device or virtual machine with an OS from 9 to below

@Danielku15
Copy link
Member

I might have a look, but it likely takes time to setup a project similar to how Fretello uses alphaTab.

@Danielku15
Copy link
Member

Danielku15 commented Jun 12, 2022

@kiketen The problem seems to be already fixed in 1.3. This line is to blame in 1.2.2
https://github.com/CoderLine/alphaTab/blob/v1.2.2/src/Environment.ts#L460

It would have been fixed as part of #570 but when backporting to 1.2.1 in d9c7834
The affected code was not fully updated. I will fix it in 1.2.3. Until then you could patch the alphaTab file locally.

The unminimized file has the related code in line 36356 (change globalThis to Environment.globalThis)
image

The minimized file has the related code around offset 611412
image

@Danielku15
Copy link
Member

I will mark this issue as closed as it is fixed in 1.3. Will try to get this also fixed in 1.2.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants