Skip to content

Latest commit

 

History

History
55 lines (39 loc) · 1.32 KB

player-javascript.README.md

File metadata and controls

55 lines (39 loc) · 1.32 KB

Introduction

@icraft/player

npm version npm downloads

@icraft/player is a native JavaScript component that allows you to easily integrate scenes edited in iCraft Editor into your projects, providing rich interaction events and methods.

Quick Start

Installation

npm

Install the @icraft/player package using npm or pnpm:

# Using npm
npm install @icraft/player --save

# Or using pnpm
pnpm install @icraft/player --save

Note: Some package managers may not automatically install the @icraft/engine package. If it's missing, please install it manually:

CDN

<script src="https://unpkg.com/@icraft/player@latest/dist/umd/icraft-player.min.js"></script>

Basic Usage

ESM

import ICraftPlayer from '@icraft/player'

CDN

const ICraftPlayer = window.ICraftPlayer

Create a player instance:

const player = new ICraftPlayer({
  src: 'your-scene.iplayer',
  container: document.getElementById('container'),
});

Here, src is the URL of the .iplayer file exported from iCraft Editor, and container is the DOM element that will host the scene.