5.4.0

GlobalAudio

Add global sound to your scene.

The cientos package provides a <GlobalAudio /> component that serves to easily add a global sound to your scene.

Reference: Audio

Usage

<script setup>
import { TresCanvas } from '@tresjs/core'
import { GlobalAudio } from '@tresjs/cientos'
</script>

<template>
  <TresCanvas>
    <TresPerspectiveCamera :position="[0, 0, 7.5]" />
    <GlobalAudio :src="exampleAudio" />
  </TresCanvas>
</template>

*The src prop is required

Props

PropDescriptionDefault
srcPath to your audio file
playTriggerId of the DOM element that triggers the play/pause staterenderer.domElement
stopTriggerId of the DOM element that triggers the stop state
loopIf the audio must be replayed when endsfalse
volumeVolume of the audio0.5
playbackRatePlaybackRate of the audio1

Events

EventDescription
isPlayingDispatched when the Audio change its state (play, pause or stop)