xraudioplayer v0.15.0
XRAudioPlayer
for emily
an audio player for web XR experiences and distributed applications
The XRAudioPlayer is a subset of the experimental XRMediaPlayer object. The latter is going to be under heavy development as of the end of this week given the start of the winter term (expected release: February 2, 2019).
XRAudioPlayer as the name suggests generates an audio player that users can experience in VR, AR, or traditional flat modes. Experiences at their core use Three.js/AFrame to achieve a secure, cross-platform standard for immersive web experiences.
Users can view content using a wide range of devices and formats. Developers can implement the module in both modular server-side and non-modular client-side applications with just a few lines of JavaScript code.
Usage:
Server-Side
- install using npm
npm install xraudioplayer
import xraudioplayer (using require is recommended: not all releases of Node have the newest ES6 features enabled by default)
(a) using add method
var myPlayer= require('xraudioplayer');
myPlayer.add('../media/img/OracularSpectacular.png', '../media/audio/TheYouth.mp3' , { title: 'The Youth', author: 'MGMT', year: 2007});
myPlayer.add('../media/img/ExtraFine.png', '../media/audio/ExtraFine.mp3', { title: 'Extra Fine', author: 'Starmaker', year: 2019});
myPlayer.spawn();
(b) using addFromList method
an object or array of objects in the following format can be processed by the module to generate same outcome as above
var myPlayer= require('xraudioplayer');
var collection = {
'The Youth': {
coverURL: '../media/audio/TheYouth.png',
audioURL: '../media/audio/TheYouth.mp3',
{
title: 'The Youth',
author: 'MGMT',
year: 2007
}
},
'Extra Fine': {
coverURL: '../media/audio/ExtraFine.png',
audioURL: '../media/audio/ExtraFine.mp3',
{
title: 'Extra Fine',
author: 'Starmaker',
year: 2019
}
}
};
myPlayer.addFromList(collection);
myPlayer.spawn();
Client-Side
- download the boilerplate or make your own test directory
- move to the app.js or index.js level of the directory and create a test.js file
- implement as follows:
var myPlayer = new XRAudioPlayer();
myPlayer.build();
myPlayer.add('../media/img/OracularSpectacular.png', '../media/audio/TheYouth.mp3' , { title: 'The Youth', author: 'MGMT', year: 2007});
coreEventListeners.launch([myPlayer]);
Full API
property | type | description |
---|---|---|
type | string | short paragraph descriptor of type property |
socket | object | short paragraph descriptor of socket object |
hello | method | short paragraph descriptor of hello method |
buildCoreMarkup | method | short paragraph descriptor of buildCoreMarkup method |
spawn | method | short paragraph descriptor of spawn method |
assetsContainer | object | short paragraph descriptor of assetContainer object |
build | method | short paragraph descriptor of build method |
add | method | short paragraph descriptor of add method |
addFromList | method | short paragraph descriptor of addFromList method |
showTrackList | method | short paragraph descriptor of showTrackList method |
playNextTrack | method | short paragraph descriptor of playNextTrack method |
playPreviousTrack | method | short paragraph descriptor of playPreviousTrack method |
stream | method | short paragraph descriptor of type method |
application | object | short paragraph descriptor of type object |
view | string | short paragraph descriptor of type property |
XRSetting | string | short paragraph descriptor of type property |