does not kick start when marker is detected

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了does not kick start when marker is detected相关的知识,希望对你有一定的参考价值。

我是java脚本和html的新手,我就这么堆叠了。以下是我编写的内容,并希望在检测到标记时启动原始内容。但是,当我在浏览器上访问html时,声音会立即启动。

   <a-marker type="pattern" url="pat/ban.patt">
      <a-entity>
         <a-image id="obj0" rotation="-90 0 0" src="#banto" width="5" height="5"></a-image>
         <a-entity position="-0.75 1 1" rotation="-90 0 0" text-geometry="value: Head of the cleark; bevelEnabled: false; bevelSize: 0.008; bevelThickness: 0.08; size: 0.25;" material="color: cyan;"></a-entity>
         <a-sound src="#bantoSound" autoplay="true"></a-sound>
      </a-entity>
    </a-marker>

虽然仅在检测到标记时显示....

不能像???一样工作

答案

我担心只要实体加载到DOM中,autoplay:true就会发出声音。

我建议您禁用自动播放,或在场景加载时停止所有声音,并在标记可见时激活它:

if(document.querySelector("a-marker").object3D.visible == true){
  // play the sound
}

以上是关于does not kick start when marker is detected的主要内容,如果未能解决你的问题,请参考以下文章

Git does not apply deleted files when merging an old branch into the master. How can I tell Git to a

最近在做celery时报MySQL backend does not support timezone-aware datetimes when USE_TZ is False.错误

最近在做celery时报MySQL backend does not support timezone-aware datetimes when USE_TZ is False.错误

CRS does not start GIPC error: [29] msg [gipcretConnectionRefused]

service mc_start.sh does not support chkconfig

Starting the application on Mac does not work(拷贝platforms到不同的位置,才能解决问题)