🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

mixed-reality-extension-util

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mixed-reality-extension-util

Utilities to help using Microsoft's Mixed Reality Extension SDK

0.1.2
latest
Source
npm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

mixed-reality-extension-util

Utilities to help developing Node.JS applications which integrate with virtual worlds using Microsoft's Mixed Reality Extension SDK.

CI status: Build Status

Quick Start

The library comprises several distinct modules

Parameter-set Util

Utility functions for reading arguments passed to the application via query parameters. Examples:

import { getParameterLastValue, getParameterAllValues, getBooleanOption, getColorOption } from 'mixed-reality-extension-util';

// Get a string argument, with a default value
const soundFilePath = getParameterLastValue(params, 'sf', 'alarm.ogg');

// Get a string argument, with the default ''
const name  = getParameterLastValue(params, 'name');

// Get all the instances of the query argument 'user' as an array
const users = getParameterAllValues(params, 'user'))

// Get a boolean parameter, defaulting to true
const modsOnly = getBooleanOption(params, 'mo', true);

// Get a color value from an RGB hexvalue, which the default being #304050
// The returned value may be with alpha (Color4) or without (color3)
const userColor = getColorOption(params, 'col', '304050');

Playing Media

A wrapper around the MediaInstance class, simplifying the action of stopping playback and changing the volume. An example for video, assuming playingActor is an actor already defined:

import { PlayingMedia } from 'mixed-reality-extension-util';

const args = { paused: true, volume: 0.5}
const video = this.mediaAssets.createVideoStream('User video', { uri: userUri });
let playingVideo = new PlayingMedia(
    playingActor.startVideoStream(video.id, args), args);

assert(playingVideo.isLoaded && playingVideo.isPaused);
playingVideo.resume();
assert(! playingVideo.isPaused);

// Raise the volume by 25%:
playingVideo.changeVolume(25);
console.log('Current volume: %f', playingVideo.currentVolume);
// Current volume: 0.625

// Cap volume at 1
playingVideo.changeVolume(75);
console.log('Current volume: %f', playingVideo.currentVolume);
// Current volume: 1

playingVideo.changeVolume(-50);
console.log('Current volume: %f', playingVideo.currentVolume);
// Current volume: 0.5

// Stop
playingVideo.stop();
assert(! playingVideo.isLoaded);
assert(playingVideo.currentVolume === undefined);

Keywords

Microsoft

FAQs

Package last updated on 08 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts