New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

cycle-html5-audio-driver

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cycle-html5-audio-driver

A cycle.js driver based on the html5 audio element for playing sounds

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Audio driver for cycle.js applications

A cycle.js driver based on the html5 audio element for playing sounds.

Install

npm install --save cycle-html5-audio-driver

Usage

The audio driver expects a stream of arrays containing objects of two keys: soundPath: A string path to a sound file (local or external) toPlay: A boolean value representing whether the sound should be played or not

import { run } from '@cycle/run';
import xs from 'xstream';
import { makeAudioDriver } from 'cycle-html5-audio-driver';

const main = (sources) => {
	...

	return {
		audio: xs.of([
			{
				soundPath: 'path/to/my/audio/file.mp3',
				toPlay: true, // Will be played completely
			},
			{
				soundPath: 'path/to/other/audio/file.wav',
				toPlay: false, // Will not start util it is passed true again,
							   // but will continue playing
			},
		]),
	}
};

run(main, { audio: makeAudioDriver() });

Each object in the sounds array emmited via the audio sink will produce a sound for its total duration. A sound cannot be stopped and only replayed. This happens when it has been reset to false and then true again.

Motivation

The driver was created for a personal project that served the goal to experiment with cycle.js. It is a simple javascript piano playing sounds when the keys are pressed.

See the project on Github: Reactive piano

Disclaimer

The driver is really simple and may not be used in production applications. It only produces write effects (playing sounds) and doesn't retrieve any feedback (read effects). Please feel free to improve upon this package and to send PRs but do not expect too much of it. :)

Keywords

cyclejs

FAQs

Package last updated on 07 Aug 2017

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