npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nativescript-wikitude-chiliz

v2.4.0

Published

NativeScript plugin for Wikitude.

Downloads

66

Readme

nativescript-wikitude

This is a fork of @breningham/nativescript-wikitude that has been unfortunately inactive.

npm version

NPM

Provides nativescript access to Wikitude AR (9.1.0 on Android and 9.0.0 on iOS).

Prerequisites / Requirements

Permissions

Before you can use this plugin you should ensure your application has permissions for Camera and Location, for an easy way to do this on both android and ios, you can make use of this plugin @spartadigital/nativescript-permissions

Running the Demo

We include a very basic AR Sample in the Demo app,

but if you want to check something a bit more advanced from wikitude examples and place them in demo/app/wikitude... Then update the URL Reference in either the items.component.ts for Nativescript-angular or the main-view-model.ts in Regular Nativescript.

and then go and grab a Trial License from Wikitude's Website and place it in demo/app/main-view-model.ts on line 13

Installation

to install for your project you can use :

tns plugin add nativescript-wikitude

for Nativescript Angular Projects you will need to import the Element in your app.component.ts

import { Wikitude } from "nativescript-wikitude";
// ...snip....
registerElement("Wikitude", () => Wikitude);

and then in your ar.component.html :

<Wikitude
  [url]="WikitudeURL"
  (WorldLoaded)="onWorldLoaded($event)"
  (JSONReceived)="onJSON($event)"
>
</Wikitude>

and in your ar.component.ts:

    import { Wikitude } from 'nativescript-wikitude';

    // ...snip...

    WikitudeInstance: Wikitude;
    WikitudeURL: string = "~/wikitude_world/index.html";

    onWorldLoaded($event) {
        this.WikitudeInstance = $event.owner; // or you can use Angular's ViewChild
    }

    onJSON($event) {
        console.log(JSON.stringify($event.data));
    }

    // ...snip...

and somewhere in your application you will need to define the wikitude license, you can get one from wikitude (free trial license)

    (global as any).wikitudeLicense: string = "YOUR_LICENSE_KEY_HERE"

And Voila! you have Wikitude AR working in your Nativescript Application!

Usage

using your own location provider

by default this plugin has a basic Location Provider, if this does not suit your purpose, you can disable it once it is fully loaded, with the following code :


    onWorldLoaded($event) {
        this.WikitudeInstance = $event.owner; // or you can use Angular's ViewChild
        this.WikitudeInstance.disableLocationProvider();
    }

Once Disabled, Geo-location based AR will not work unless you provide your own location, this can be achieved with the following

this.WikitudeInstance.setLocation({ latitude, longitude, altitude, accuracy });

this is useful if you want a single location state.

once you have disabled it you can re-enable it with the following :

this.WikitudeInstance.enableLocationProvider();

TODO

  • Plugins API Exposure, not sure how to go about this, Wikitude allows Plugins, built in CPP to be used, and linked using their Plugin's API (an Example of a plugin would be face recognition). I'm unsure how to go about allowing users to do this. any advice would be appreciated...
  • Detecting if Device needs Calibration: Currently being held back by Android causing a crash when i try to listen to this event.
  • Camera Events: Could be useful for the Developer to check for the Camera Open, Closed, and any Crashes.
  • a better way to set the Wikitude LicenseKey and Required Features.

API

Properties

| Property | Default value | Description | | -------- | ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | | url | "" | the URL of the Wikitude "ARWorld" | | features | Features.ImageTracking | Features.InstantTracking | ObjectTracking | GeoTracking | The Required Features you need, this is experimental and may not work |

Functions

| Function | Arguments | Description | | ------------------------- | ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | | setLocation() | { latitude: number, longitude: number, altitude: number, accuracy: number } | sets the location in the ARWorld | | hasFeature() | feature : number | checks if your device can support said features (or if your license supports it) | | loadUrl() | url: string | loads the URL in the Wikitude WebView | | reload() | | reloads the current Wikitude WebView | | clearCache() | | clears the wikitude Cache | | toggleFlash() | | Toggles the Devices Flash-light | | switchCamera() | | switches the Camera that wikitude uses | | captureScreen() | captureWebViewContent: boolean | captures the current view, can also capture the webview content | | disableLocationProvider() | | disables the location Provider (you will need to provide your own for GEO/POI's to work) | | enableLocationProvider() | | enables the location Provider |

Events

| Event | Description | Type | | -------------------- | --------------------------------------------------- | ------------------------------- | | WorldLoadSuccess | Fires when the ARWorld Loads Successfully | WorldLoadSuccessEventData | | WorldLoadFail | Fires if an Error Occurs while loading the AR World | WorldLoadFailedEventData | | JSONReceived | Fires when the ARWorld sends a JSON Object | JSONReceivedEventData | | ScreenCaptureSuccess | fires when the screen is captured | ScreenCaptureSuccessEventData | | ScreenCaptureFail | fires when wikitude fails to capture the screen | ScreenCaptureFailedEventData |

all can be imported from the index.d.ts.

License

Wikitude is (c) Wikitude GmbH Before using see their End-User License Agreement

Apache License Version 2.0, January 2004