Skip to content

Latest commit

 

History

History
63 lines (52 loc) · 1.28 KB

basic.md

File metadata and controls

63 lines (52 loc) · 1.28 KB

Basic Tutorial

WindowManager has built-in DocsViewer and MediaPlayer to play PPT and audio and video

Open dynamic/static PPT

import { BuiltinApps } from "@netless/window-manager";

const appId = await manager.addApp({
     kind: BuiltinApps.DocsViewer,
     options: {
         scenePath: "/docs-viewer", // define the scenePath where the ppt is located
         title: "docs1", // optional
         scenes: [], // SceneDefinition[] static/dynamic Scene data
     },
});

Open audio and video

import { BuiltinApps } from "@netless/window-manager";

const appId = await manager.addApp({
     kind: BuiltinApps.MediaPlayer,
     options: {
         title: "test.mp3", // optional
     },
     attributes: {
         src: "xxxx", // audio and video url
     },
});

Query all apps

const apps = manager.queryAll();

Query a single APP

const app = manager.queryOne(appId);

Close App

manager.closeApp(appId);

events

Minimize and maximize the window

manager.emitter.on("boxStateChange", state => {
     // maximized | minimized | normal
});

Camera follow mode

manager.emitter.on("broadcastChange", state => {
     // state: number | undefined
});