title: Play audio ONCE on marker detection A-frame & Ar.js
body: <p>I'm trying to play a sound just once when a marker is detected with the A-frame and AR.JS libraries.</p>
  <p>I'm trying the code lines below but the sound is playing indefinite.</p>
  <pre><code>&lt;a-scene embedded arjs='sourceType: webcam; debugUIEnabled: false;';&gt;
       &lt;a-assets&gt;
           &lt;audio id=&quot;sound&quot; src=&quot;audio.mp3&quot; preload=&quot;auto&quot;&gt;&lt;/audio&gt;
       &lt;/a-assets&gt;
       &lt;a-marker preset=&quot;hiro&quot;&gt;
                  &lt;a-entity id=&quot;examplemodel&quot; gltf-model=&quot;./models/Example.glb&quot; soundhandler&gt;&lt;/a-entity&gt;
       &lt;/a-marker&gt;
       &lt;a-entity sound=&quot;src: #sound&quot; autoplay=&quot;false&quot;&gt;&lt;/a-entity&gt;
       &lt;a-entity camera&gt;&lt;/a-entity&gt;
  &lt;/a-scene&gt;
  
  &lt;script&gt;
  AFRAME.registerComponent('soundhandler', {
      tick: function () {
           var entity = document.querySelector('[sound]');
           if (document.querySelector('a-marker').object3D.visible == true) {
               entity.components.sound.playSound();
           } else {
               entity.components.sound.pauseSound();
           }
      }
  });
  &lt;/script&gt;
  </code></pre>
  <p>When I changed tick for init I got this error:</p>
  <blockquote>
  <p>Uncaught TypeError: Cannot read property 'playSound' of undefined</p>
  </blockquote>
  <p>Could you please give me some ideas to solve this issue?</p>