1.0.66 • Published 6 months ago

ixrlibforwebxr v1.0.66

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

iXRLibForWebXR

Welcome to iXRLibForWebXR, a powerful JavaScript/TypeScript library crafted to seamlessly integrate XR analytics and services into web applications. This library is packed with features that allow developers to supercharge their applications with advanced event tracking, telemetry, and AI integrations, making it a perfect fit for enterprise-level solutions.

Table of Contents

  1. Introduction
  2. Installation
  3. Quick Start
  4. Features
  5. API Reference
  6. Authentication
  7. Event Tracking
  8. Logging
  9. Telemetry
  10. AI/LLM Integration
  11. Data Storage
  12. Initial Setup
  13. Running the Demo
  14. Best Practices
  15. Support
  16. License

Introduction

Dive into iXRLibForWebXR, where integrating XR analytics into your web applications becomes a breeze. From real-time event tracking to AI model interactions, this library enhances the capabilities of web-based XR platforms, ensuring a rich and interactive user experience.

Installation

Get started with iXRLibForWebXR by installing the package via npm:

npm install ixrlibforwebxr

Quick Start

Jump right into using iXRLibForWebXR with this simple setup:

import { iXRInit } from 'ixrlibforwebxr';

async function main() {
  const authData = {
    appId: 'your-app-id',
    orgId: 'your-org-id',
    deviceId: 'web-xr',
    authSecret: 'your-auth-secret'
  };

  const iXR = await iXRInit(authData);

  // Track a user action
  await iXR.Event('user_action', 'action=click,target=button');

  // Log user progress
  await iXR.LogInfo('User completed onboarding');

  // Send performance metrics
  await iXR.Telemetry('performance_metrics', { fps: 60, latency: 20 });
}

main();

Initial Setup

To get started with iXRLibForWebXR, you'll need to configure your application with the necessary authentication details.

  1. On the top menu, choose iXRLibForWebXR > Configuration.
  2. Enter the Application ID, Organization ID, and Authorization Secret. These can be retrieved from the iXRLibForWebXR Web Application which requires a free account to continue.
    • Organization ID and Authorization Secret: Available under Settings > Organization Codes.
    • Application ID: Available in the Web Dashboard under your application settings. Please use the 'Get Started' tutorial button on the Home page and then choose the 'Content Developer' path for step-by-step instructions.
    • Follow the visual guides below for clarity.

Simply use the provided tutorials with the 'Get Started Button' shown below, and choose the 'Content Developer' path. Visual Tutorial to get App ID

Features

Event Tracking

Capture user interactions and system events with ease. Here are some examples of how you can track various events:

// Basic event tracking
await iXR.Event('button_click', 'action=submit,page=checkout');

// Track level start
await iXR.EventLevelStart('level_1', { difficulty: 'easy' });

// Track level completion
await iXR.EventLevelComplete('level_1', 100, { time_taken: '120s' });

// Track assessment start
await iXR.EventAssessmentStart('math_quiz', { topic: 'algebra' });

// Track assessment completion
await iXR.EventAssessmentComplete('math_quiz', 85, ResultOptions.Pass, { questions_answered: '20' });

// Track objective start
await iXR.EventObjectiveStart('collect_coins', { total_coins: '50' });

// Track objective completion
await iXR.EventObjectiveComplete('collect_coins', 45, ResultOptions.Complete, { coins_collected: '45' });

// Track interaction start
await iXR.EventInteractionStart('npc_dialogue', { npc_name: 'Guide' });

// Track interaction completion
await iXR.EventInteractionComplete('npc_dialogue', 'Friendly', 'Player chose to help NPC', InteractionType.Select, { dialogue_path: 'friendly' });

Logging

Keep tabs on what happens in your application by logging information, warnings, and errors:

await iXR.LogInfo('User logged in successfully');
await iXR.LogWarning('Low storage space detected');
await iXR.LogError('Failed to process payment');

Telemetry

Gather and send performance metrics to analyze and optimize application performance:

await iXR.Telemetry('performance_metrics', { fps: 60, memory_usage: 512 });

AI/LLM Integration

Interact with AI language models to enhance user interaction and system intelligence:

const response = await iXR.AIProxy('Translate "Hello" to French', 'gpt-3.5-turbo');

Data Storage

Effortlessly store and retrieve data on the fly, supporting complex data management needs:

await iXR.StoreData('user_progress', { level: 5, score: 1000 }, 'keepLatest');
const data = await iXR.GetData({ name: 'user_progress' });

API Reference

For a detailed list of all available methods and their parameters, please refer to the API section in the documentation.

Authentication

iXRLibForWebXR simplifies the authentication process by automatically extracting the necessary data from URL parameters. To use this feature, simply include the authentication parameters in the URL when launching your application:

http://yourdomain.com/?xrdm_orgid=YOUR_ORG_ID&xrdm_authsecret=YOUR_AUTH_SECRET

Replace YOUR_ORG_ID, YOUR_AUTH_SECRET, and YOUR_APP_ID with your actual credentials.

The library will automatically detect and use these parameters to initialize the iXR instance, making it convenient for scenarios where the application is launched from a web link with pre-provided credentials.

When initializing the iXR instance in your code, you don't need to manually extract these parameters. Simply call iXRInit() without arguments:

import { iXRInit } from 'ixrlibforwebxr';

async function main() {
  const iXR = await iXRInit({
    appId : 'YOUR_APP_ID' 
  });
  // The iXR instance is now initialized with the credentials from the URL
  // Continue with using iXR...
}

main();

This approach ensures that your application can securely and conveniently initialize user sessions without manual data entry or additional code for parameter extraction.

Running the Demo

To run the Babylon.js sample included in the sample-babylon directory, you have two options:

  1. Using Node.js: Navigate to the sample-babylon directory and run:

    npm install
    node server.js

    This will start the server on http://localhost:6001.

  2. Using Docker: In the sample-babylon directory, build and run the Docker container:

    docker build -t ixr-sample .
    docker run -p 6001:6001 ixr-sample

Once the server is running, you can access the demo by navigating to:

http://localhost:6001/?xrdm_orgid=YOUR_ORG_ID&xrdm_authsecret=YOUR_AUTH_SECRET

Replace YOUR_ORG_ID and YOUR_AUTH_SECRET with your actual organization ID and authentication secret.

Best Practices

  • Early Initialization: Initialize the iXR instance as early as possible in your application lifecycle.
  • Meaningful Metadata: Use meaningful event names and metadata for better analytics and insights.
  • Graceful Error Handling: Ensure to handle errors gracefully, especially for network-dependent operations.

Support

Encountered an issue or have a feature request? Please open an issue on our GitHub repository.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

1.0.62

7 months ago

1.0.61

7 months ago

1.0.60

7 months ago

1.0.66

6 months ago

1.0.65

6 months ago

1.0.64

6 months ago

1.0.63

7 months ago

1.0.48

7 months ago

1.0.49

7 months ago

1.0.51

7 months ago

1.0.50

7 months ago

1.0.55

7 months ago

1.0.54

7 months ago

1.0.53

7 months ago

1.0.52

7 months ago

1.0.59

7 months ago

1.0.58

7 months ago

1.0.57

7 months ago

1.0.56

7 months ago

1.0.47

8 months ago

1.0.46

8 months ago

1.0.45

8 months ago

1.0.44

8 months ago

1.0.43

8 months ago

1.0.42

8 months ago

1.0.41

8 months ago

1.0.40

8 months ago

1.0.39

8 months ago

1.0.38

8 months ago

1.0.37

8 months ago

1.0.36

8 months ago

1.0.35

8 months ago

1.0.34

8 months ago

1.0.33

8 months ago

1.0.32

8 months ago

1.0.31

8 months ago

1.0.30

8 months ago

1.0.29

8 months ago

1.0.28

8 months ago

1.0.27

8 months ago

1.0.26

8 months ago

1.0.25

8 months ago

1.0.24

8 months ago

1.0.23

8 months ago

1.0.22

8 months ago

1.0.21

8 months ago

1.0.20

8 months ago

1.0.19

8 months ago

1.0.18

8 months ago

1.0.17

8 months ago

1.0.16

8 months ago

1.0.15

8 months ago

1.0.14

8 months ago

1.0.13

8 months ago

1.0.12

8 months ago

1.0.11

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.10

8 months ago

1.0.9

8 months ago

1.0.0

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.1

8 months ago

1.0.2

8 months ago