Attributes – src (Audio)

Attributes – src (Audio)

Working with Audio

It is also possible to add audio with the src attribute. Due to problems (the color is missing, tested with A-Frame 0.8) within A-Frame, it is better to create a separate entity for the audio and make it invisible:

<a-box
   id="audio"
   src="audio/chaplin_4.mp3"
   visible="false"
></a-box>

An alternative is to use the sound attribute instead of src:

<a-box
  id="audio"
  sound="src:audio/chaplin_4.mp3; loop:true; autoplay:true;"
  visible="false"
></a-box>

It is also possible to use the <a-sound> Tag

<a-sound src="audio/chaplin_4.mp3" autoplay="true"></a-sound>

 

Example

You can use this example.

 

 

Comments are closed.