0.0.4 • Published 5 years ago

media-scene v0.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

media-scene npm version

A library for playing or controlling media

dependencies

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>