alphaTab icon indicating copy to clipboard operation
alphaTab copied to clipboard

When will there be support for Android and iOS?

Open Ltty opened this issue 10 years ago • 11 comments

Hi,

do you have a concrete roadmap when Android and iOS will be supported?

Best, Florian

Ltty avatar Dec 15 '15 12:12 Ltty

Hi Florian. No, currently I don't have a concrete roadmap but Android will be definitly the first platform I will support. I started to investigate in possible compilers to translate the C# codebase to other languages like Java and C++ but I cannot tell how long it will take to create such a port.

For now there are only 3 solutions to bring alphaTab to those platforms:

  • Use Xamarin
  • Use a Browser component and use the JavaScript version
  • Use a JavaScript engine to use alphaTab in the background (render SVG and access model details).

I will do my best to support those platforms as a native library but currently I am struggling with the open features for 1.0.0 release.

Danielku15 avatar Dec 28 '15 12:12 Danielku15

Hi,Danielku How about the progress on Android and iOS,and i saw that there are plans to support MusicXML,do you have a concrete roadmap?

jason0539 avatar Aug 13 '16 07:08 jason0539

No, there is currently no concrete roadmap when this will be available.

Danielku15 avatar Aug 16 '16 18:08 Danielku15

For those who want to use AlphaTab on iOS (a similar solution exists for Android) and run everything locally with no connection, use a UIWebView and import the needed javascript files, font files, and any css you want. Your project directory should look like this:

screen shot 2017-01-20 at 11 10 16

Also make sure all of your files in the alphatab folder are copied over to your app under Build Phases > Copy Bundle Resources:

screen shot 2017-01-20 at 11 11 22

Then in your html file, make sure to put relative paths to all of the files so they can be loaded from the bundle. Here's a barebones example HTML:

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">

  <script type="text/javascript" src="js/jquery.min.js"></script>
  <script type="text/javascript" src="js/AlphaTab.min.js"></script>
  <script type="text/javascript" src="js/jquery.alphaTab.js"></script>

  <script type='text/javascript'>
    $(window).on('load', function() {
        $('#alphaTab').alphaTab(); 
    }); 
  </script>
</head>
<body>
  <h2>AlphaTab Test</h2>
  <div id="alphaTab" data-tex="true">
    \title "The Greatest Song In The World"
    \artist "Greg Burlet"
    \tempo 90
    .
    :4 2.3 4.4 2.2 3.4
  </div>
</body>
</html>

Then in your ViewController:

@IBOutlet weak var webView: UIWebView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let alphaTabURL = Bundle.main.url(forResource: "alphatab", withExtension: "html", subdirectory: "alphatab")
        let request = URLRequest(url: alphaTabURL!)
        webView.loadRequest(request)
    }

The result: screen shot 2017-01-20 at 11 14 55

Note that this doesn't open up the page in an installed web browser on the phone (eg., Safari, Chrome) but renders right in your app.

Maybe @Danielku15 has a different or better approach, but this seems to be working well for me. Hopefully that helps someone out there!

gburlet avatar Jan 20 '17 18:01 gburlet

Thanks for the more concrete example @gburlet . Using a WebView directly is one way how to use alphaTab. I mentioned it before but another solution would be to use directly a JavaScript engine (like JavaScriptCore ) to let alphaTab generate the SVG. The SVG could then be rendered separately in a native way using libraries like SVGKit. Same goes for the MidiGeneration, you can let alphaTab generate the midi binary and use then a native library for playback.

Native library support is likely not achievable in mid-term since there is no cross-compiler available like for JavaScript. I plan to create a simple wrapper over a JavaScript engine and use the JavaScript version internally. It will therefore has less access to internals but might be sufficient to add rendering to iOS and Android applications.

Currently I am finalizing some rendering related features on alphaTab and also MusicXML is a big topic which keeps me busy for the next stable release. Providing a native lib that is usable in Android and iOS is definitly still on my list (iOS might be a bit tricky to test since I do not own a Mac).

Danielku15 avatar Jan 20 '17 18:01 Danielku15

Sounds like a good plan. I agree that rendering related tasks and MusicXML parsing is higher priority than native iOS & Android libraries, especially since there are good workarounds to use in the meantime on these devices. You can always run OS X in a virtual machine to test. It's sort of a pain to set up but works great.

gburlet avatar Jan 20 '17 19:01 gburlet

I just found a very interesting library for iOS and Android which does basically exactly what I explained many times: It wraps native JavaScript engines (JavaScript Core / V8) and extends it by a special canvas API that does native drawing on views. https://github.com/phoboslab/Ejecta https://github.com/godmodelabs/ejecta-v8/

It might require direct usage of the ScoreRenderer since the normal JavaScript API of alphaTab relies on a DOM.

Danielku15 avatar Jan 21 '17 07:01 Danielku15

[AlphaTab][undefined] An unexpected error occurred when I load using webview in android image

WNervous avatar Jul 30 '18 03:07 WNervous

Its been a while since there was an update on the native Android and iOS version. Beside some minor open issues I am now able to compile alphaTab to Kotlin which will hopefully allow native Android and iOS apps soon.

As you can see there is a simple Android App with an "alphaTab Control" embedded using native Kotlin code. (Open the Gif in a new window for better quality) Screencast of running AlphaTab natively in Android

In parallel I'm working on a unified API that will hopefully ensure that all new features will go evenly to the different platforms.

Danielku15 avatar Nov 18 '18 00:11 Danielku15

Danielku15.. Using android studio, I got it set up in an application of mine just using a Webview. But playback is really choppy.. Is there anything I'm missing?? Or is the android studio Webview not powerful enough to handle it. Thanks

matt15wish avatar Feb 11 '19 01:02 matt15wish

Good day. I just tried to use alphatab and load the demo showcased at alphatab.net main site and playback is sluggish. Is alphasynth compatible with mobile? I would really like to get it going on mobile as a web app or with Android studio. Any help would be appreciated, thanks

matt15wish avatar Apr 23 '19 03:04 matt15wish