media-scene
v0.0.4
Published
A library for media control.
Downloads
5
Maintainers
Readme
media-scene
A library for playing or controlling media
dependencies
- scenejs >= 1.0.0-rc4
Installation
npm
$ npm i media-scene
script
<script src="//daybrush.com/scenejs/release/latest/dist/scene.js"></script>
<script src="//daybrush.com/media-scene/release/latest/dist/mediascene.js"></script>
How to use
- scene with a total length of 8 seconds and the audio will play in 7 seconds.
- The audio ends at 7.5 because the playSpeed is 2x.
<audio style="display: none">
<source src="clapper.wav" type="audio/wav" />
</audio>
<script>
const clapperElement = document.querySelector("audio");
const mediaScene = new MediaScene(
8,
{
"./clapper.wav": {
7: {
seek: [0, 1],
playSpeed: 2,
volume: 0.7,
},
options: {
element: clapperElement,
}
},
}
).play();
</script>