Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play Audio on Marker Detection #227

Closed
peterlunglum opened this issue Apr 25, 2018 · 1 comment
Closed

Play Audio on Marker Detection #227

peterlunglum opened this issue Apr 25, 2018 · 1 comment

Comments

@peterlunglum
Copy link

I'm trying to play sound when a marker is detected but it currently isn't working.
From other issues I tried the following:

` var entity = document.querySelector('[sound]');

AFRAME.registerComponent('markerhandler', {
   tick:function() {
      if(document.querySelector("a-marker").object3D.visible == true) {
      // MARKER IS PRESENT
			entity.components.sound.playSound();
      } else {
      // MARKER IS HIDDEN
			entity.components.sound.pauseSound();
      }
   }
});

`

With the scene being:

    <a-scene embedded arjs='sourceType: webcam; debugUIEnabled: false;';>
	  	<a-marker preset="hiro">
	            <a-box position='0 0.5 0' material='color: black;'></a-box>
	  	</a-marker>
  	  	<a-assets>
    		<audio id="sound" src="audio.mp3" preload="auto"></audio>
  		</a-assets>
  	<a-entity sound="src: #sound" autoplay="false"></a-entity>
  	<a-entity camera></a-entity>
    </a-scene>

Doesn't seem to register. Any ideas as to why?

@donmccurdy
Copy link
Collaborator

This seems like a workaround to jeromeetienne/AR.js#217 and not related to aframe-extras, I think you will need to follow up there. I do not use AR.js myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants