Start a new topic

Starting wikitude from outside of the bundle

Starting wikitude from outside of the bundle


ok, thx. Now I can mark this as 'answered' :)

Best regards

Andreas

Hi,

It's used elsewhere - it can be ignored here :)

Paul

Hi Paul,
I'm glad to here that you found a way to do what you wanted to do.

I'm just confused with the `path` variable in your snippet. where is it used?

Best regards

Andreas

Hi Andreas,

Thanks for your reply :)

The videos aren't available from a URL and are downloaded when the app first fires up. I have zero clue as to how many videos there will be so the imagerecognition.js file (and all the other wikitude bits have to be removed from Assets (Android) or Resources (iOS) and referenced outside of there. It works nicely) has to be generated once the files are downloaded. It's not difficult to do.

I solved the issue on iOS like this

var url = new NSUrl(App.Self.ContentPath).AbsoluteString + "/1_ImageRecognition_2_MultipleTargets/index.html";
var path = new NSUrl(string.Format("file://{0}/index.html", App.Self.UserSettings.LoadSetting<string>("WikitudeDir", SettingType.String)));
architectView.LoadArchitectWorldFromURL(NSUrl.FromString(url), WTFeatures.WTFeature_2DTracking);

which does the trick.

Thanks

Paul

Hi Paul,
If your URL is loadable by a UIWebView, it should be loadable from the Wikitude SDK (as we use a UIWebView to load the .html file). Please try to load your file from a UIWebView and convert the URL otherwise to a supported format (e.g. use the NSBundle class).

I'm not exactly sure why you try to generate the architect world on the fly. It's a JS API, maybe you can just call the right function on the fly without generating a static .js file. Your app could connect to a server, asking for the video url and then you use this url to create a AR.VideoDrawable. Video drawables can be created with a URL that points to a server. 

If your video is in your documents folder and your world in the bundle, try to use absolute paths for the video inside your architect world.

Best regards

Andreas

Hi,

The way I'm using wikitude is that I have my triggers but don't have the videos - these are downloaded from a server. As I don't know what videos are until they arrive, I'm having to generate the imagerecognition.js file on the fly. This works fine, but I can't save to the bundle for obvious reasons. To get around that, I copy Resources/1_ImageRecognition_2_MultipleImages to the Documents directory. The problem is though that when I fire up the architectWorld, the index.html file is not seen.

I know I can do this on Android (and indeed, have done), but can't seem to get it right on iOS

The code I'm using to fire the viewer is this

//var path = NSBundle.MainBundle.BundleUrl.AbsoluteString + "1_ImageRecognition_2_MultipleTargets/index.html";
var path = string.Format("file://{0}/index.html", App.Self.UserSettings.LoadSetting<string>("WikitudeDir", SettingType.String));
var url = NSUrl.FromString(path);
architectView.LoadArchitectWorldFromURL(url, Wikitude.Architect.WTFeatures.WTFeature_2DTracking);

(I'm using the Xamarin component)

Any ideas?

PFJ
Login or Signup to post a comment