Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Jonathan_H_3
Beginner
231 Views

Phonon.js not loading in Emulate

Has anyone used phonon.js (http://phonon.quarkdev.com) in XDK?

I am having issues getting the emulator to properly load the JS library.

It works in App Preview Native app, but NOT in emulator. 

Any assistance is greatly appreciated.

 

Tags (2)
0 Kudos
14 Replies
PaulF_IntelCorp
Employee
231 Views

I recommend using the Debug tab, it will provide a much more accurate debug environment. If you make changes in the Develop tab to your files, while running a debug session, you will be prompted to reload when you return to the Debug tab. Or, if you are using an external editor, simply push the bug icon while the Debug session is running and it will reload your source files. Not quite as fast as the Emulate tab, but still pretty fast.

Jonathan_H_3
Beginner
231 Views

I do not have an Apple Certificate yet and cannot get it on my device without one.

I have applied for one, but it has not been approved yet so I cannot use the debug tab. :(

 

 

 

PaulF_IntelCorp
Employee
231 Views

What about Android?
 

Jonathan_H_3
Beginner
231 Views

I do not have an android device presently.  I was excited about using XDK because of the emulation of various devices while developing, but getting it to work with other libraries is not as easy as first thought. :p

PaulF_IntelCorp
Employee
231 Views

The Emulate tab is just a Chromium browser with some limited support for Cordova APIs, it is not a device emulator. Please see this doc > https://software.intel.com/en-us/xdk/docs/intel-xdk-dev-emulator-limitations

Jonathan_H_3
Beginner
231 Views

I am not using any Cordova Plugins/APIs in my app.  I am just trying to get Phonon.js to function correctly in the emulator.

Is there any way to submit for review with Intel developers to take a look at Phonon to see how to make it work?

I am just using the Kitchen Sink demo from the Phonon github demos area: http://github.com/quark-dev/Phonon-Framework.git

 

PaulF_IntelCorp
Employee
231 Views

You don't need to be using Cordova plugins to use the Develop tab. It is simply a better place to view and debug than the Emulate tab. There are many limitations to the Emulate tab. Since it works in App Preview, you could also just view and debug in a local browser, for quick debugging and then use App Preview and the Debug tab for on-device debugging and previewing.

Jonathan_H_3
Beginner
231 Views

I know I do not need to be using Cordova plugins to use develop tab...and I understand it WOULD be a better place to view and debug... My issue is that I do not have an Apple Developer Certificate to be able to USE the... guessing you meant to say "Debug" tab instead of Develop tab, as I can use the Develop tab... I need to know IS there a way an Intel XDK developer can look at the Phonon examples to get them working inside of XDK and the emulator as I do NOT have an Apple Cert or Android device at this time?

Please and Thank-You. :)

PaulF_IntelCorp
Employee
231 Views

I am unable to get to any of the Phonon examples, they are being blocked by our firewall due to blacklisting of their site (I don't know why, just that I am unable to see their samples and a large part of their documentation for that reason).

We can take a look at your sample app and see if there is something obvious, but we cannot commit to investing the time to insure that the Phonon framework will always work with the XDK. We do not have the resources to insure that all third-party JS frameworks and Cordova plugins will always work. Please attach a ZIP of the ENTIRE project directory to your post so we have an example to work with (use the "Attach Files to Post" section below the edit window in the forum) and I'll see if there is something obvious in the way of your app working.

Jonathan_H_3
Beginner
231 Views

Try accessing the github I mentioned: https://github.com/quark-dev/Phonon-Framework/  It houses all of the examples and the demo.

I also attached the files from github to this post.  Also included a couple of pages from the documentation

Thanks :)

PaulF_IntelCorp
Employee
231 Views

Jonathan -- please put together an XDK sample and attach that, then I can help you more efficiently. We cover a lot of issues and also have additional duties, beyond the forum, that consume our time. The more you can do to help me the more I can help you. Please put together a simple XDK app that illustrates the problem you are experiencing.
 

Jonathan_H_3
Beginner
231 Views

Sorry for not posting in a while... been out of the office and then pulled to other duties :p

So, I found out why the framework is not working and wrote a little work-around code to correct it in the framework, BUT I believe that a change to the emulator is also in order.

In the code below phonon.js determines the OS/Version based on the following:

phonon.device = (function () {

    /**
     * Device detection
     * Source: http://jsfiddle.net/ChristianL/AVyND/
     */

    // browser
    var nVer = navigator.appVersion;
    var ua = navigator.userAgent;

    // system
    var os = '-';

    var clientStrings = [
        {s:'Windows 10', r:/(Windows 10.0|Windows NT 10.0)/},
        {s:'Windows 8.1', r:/(Windows 8.1|Windows NT 6.3)/},
        {s:'Windows 8', r:/(Windows 8|Windows NT 6.2)/},
        {s:'Windows 7', r:/(Windows 7|Windows NT 6.1)/},
        {s:'Windows Vista', r:/Windows NT 6.0/},
        {s:'Windows Server 2003', r:/Windows NT 5.2/},
        {s:'Windows XP', r:/(Windows NT 5.1|Windows XP)/},
        {s:'Windows 2000', r:/(Windows NT 5.0|Windows 2000)/},
        {s:'Windows ME', r:/(Win 9x 4.90|Windows ME)/},
        {s:'Windows 98', r:/(Windows 98|Win98)/},
        {s:'Windows 95', r:/(Windows 95|Win95|Windows_95)/},
        {s:'Windows NT 4.0', r:/(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/},
        {s:'Windows CE', r:/Windows CE/},
        {s:'Windows 3.11', r:/Win16/},
        {s:'Android', r:/Android/},
        {s:'Open BSD', r:/OpenBSD/},
        {s:'Sun OS', r:/SunOS/},
        {s:'Linux', r:/(Linux|X11)/},
        {s:'iOS', r:/(iPhone|iPad|iPod)/},
        {s:'Mac OS X', r:/Mac OS X/},
        {s:'Mac OS', r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/},
        {s:'QNX', r:/QNX/},
        {s:'UNIX', r:/UNIX/},
        {s:'BeOS', r:/BeOS/},
        {s:'OS/2', r:/OS\/2/},
        {s:'Search Bot', r:/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/}
    ];
    for (var id in clientStrings) {
        var cs = clientStrings[id];
        if (cs.r.test(ua)) {
            os = cs.s;
            break;
        }
    }

    var osVersion = '-';

    if (/Windows/.test(os)) {
        osVersion = /Windows (.*)/.exec(os)[1];
        os = 'Windows';
    }

    switch (os) {
        case 'Mac OS X':
            osVersion = /Mac OS X (10[\.\_\d]+)/.exec(ua)[1];
            break;

        case 'Android':
            osVersion = /Android ([\.\_\d]+)/.exec(ua)[1];
            break;

         case 'iOS':
            osVersion = /OS (\d+)_(\d+)_?(\d+)?/.exec(nVer);
            //MY TEMPORARY WORKAROUND FIX FOR XDK EMULATOR
            if(osVersion === null){
                        osVersion = '8_0_0';
                        osVersion = osVersion[0] + '.' + osVersion[2] + '.' + (osVersion[3] | 0);
            } else {
                        osVersion = osVersion[1] + '.' + osVersion[2] + '.' + (osVersion[3] | 0);
            }
            //END TEMPORARY FIX
            break;
    }


    return {
        os: os,
        osVersion: osVersion
    };

})();

As you can see I have added a TEMPORARY WORKAROUND to allow the framework to load in the XDK Emulator, BUT SHOULD'NT XDK emulator be PROPERLY providing the correct OS Versions?

When I emulate iPhone 6 Plus in Intel XDK & run the following code:

alert(nVer);

I get: "5.0 (Macintosh; Intel Mac OS X 10_11_4)...", WHILE ON MY iPHONE I GET: "5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X)..."

... AND when I do following in Intel XDK:

alert(ua)[1];

I get: "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X)", WHILE ON MY iPHONE I GET: "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X)..."

See Pictures for better understanding....

Anyway to get this fixed in XDK?

PaulF_IntelCorp
Employee
231 Views

Yes, the Emulate tab should be providing a properly formatted UA string for the selected device. We are changing out that component of the XDK in the next major release, to use the Cordova TACO simulator, rather than the Ripple simulator. This new simulator is better supported and should provide the results you are looking for. In the meantime, we won't be making any fixes to the Emulate tab, because it will disappear from the product.

Rob_Welan
New Contributor I
231 Views

Paul F. (Intel) wrote:

Yes, the Emulate tab should be providing a properly formatted UA string for the selected device. We are changing out that component of the XDK in the next major release, to use the Cordova TACO simulator, rather than the Ripple simulator. This new simulator is better supported and should provide the results you are looking for. In the meantime, we won't be making any fixes to the Emulate tab, because it will disappear from the product.

 

Oh No - the emulator is awesome - it provides a sneaky way of providing images to App Store platforms that are reasonably accurate from a feature / function standpoint. If emulator disappears, won't I need to buy loads of hardware devices to grab my in-store screenshots? I love that the emulator (whilst not perfect) saves me $$$! Please don't disappear the emulator!

Reply