Jump to content

Model loading and file path issue while using babylon inside webview for cordova based mobile app


dsman
 Share

Recommended Posts

We are trying to build simple Cordova/ionic based Babylon model viewer. 

We are downloading and storing model files at runtime to App's folder in primary storage ( ///storage/emulated/0/android/data/com.vizmonk/files/code/front/models/ )

Now the problem is babylon.js is not able to load the .babylon field from that location. Following is console error and stack trace. 

Same file if accessed using ajax call and printed on the console it works fine (content is printed in the console in the screenshot below. )

Screenshot_12.thumb.png.90abf912ba39f30e76b6b622044e5ccf.png

Link to comment
Share on other sites

I checked my cordova project.  I do not use .babylon files, but do load textures.  I just added an 'img' sub-directory to 'www', then reference textures relative to 'www', where index.html is.  That is './img'.   Your description does not even remotely resemble mine.  Are you going handle all your reading in a platform (iOS, Android, Windows) way?

Link to comment
Share on other sites

@Deltakosh

We tried both types of URL. The one starting with file ( file:///storage/emulated/0/Android/data ...  etc)  and without it ( ///storage/emulated/0/Android/data ... etc).    

@JCPalmer Yes. We are going to store model files at runtime, so it can't be placed in www or asset folder. And it has to be stored/read in a platform-specific way. 

Link to comment
Share on other sites

@Deltakosh   No matter if we use the path beginning with "file:///storage/emulated....." or "///storage/emulated/..."  or "/storage/emulated/...."  The path in the network tab of chrome dev tools is:  "file:///storage/emulated/0/android/data/com.vizmonk/code/front/models/3879316/3879316.babylon"

Link to comment
Share on other sites

@Deltakosh Well, that's precisely my question. :) You can see in the screenshot above.  An ajax function call using jquery to the same URL is able to access .babylon file and print its content. While below it, you can see the babylon.max.js is showing the error saying "unable to load from .. " 

Link to comment
Share on other sites

This is weird as BJS is only using xhr internally :(

Can you reference non minified version of bjs and try to dig into it?

 

I will need a repro if you want me to help further

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...