简体   繁体   English

AR.js + A-Frame 在点击事件上播放视频

[英]AR.js + A-Frame Play a video on click event

I'm using this tool to generate an augmented reality video using a-frame and ar.js https://ar-js-org.github.io/studio/我正在使用此工具使用 a-frame 和 ar.js https://ar-js-org.github.io/studio/生成增强现实视频

this is where I'm testing it .这是我测试它的地方。 https://moya.do/temp/ar/video/ with this marker https://moya.do/temp/ar/video/marcador.png https://moya.do/temp/ar/video/带有此标记https://moya.do/temp/ar/video/marcador.png

Everything seems to work fine in android , but its seems that iOS have some restrictions on autoplaying videos in the browser.在 android 中一切似乎都很好,但似乎 iOS 对浏览器中的自动播放视频有一些限制。

I'm looking for options to getting this work on safari .我正在寻找在 safari 上进行这项工作的选项。 Maybe if I disable autoplay , I don't know how to trigger the videoplayback if I click the video element.也许如果我禁用了 autoplay ,如果我单击 video 元素,我不知道如何触发视频播放。

    <script>
        window.addEventListener('click', function () {
        var v = document.querySelector('#vid');
        v.play();
        });
    </script>

I tried this without success.我试过这个没有成功。

This link from @onironauta solved it, it's in Spanish but fairly simple to understand, also you can just download the source code provided by the developer and copy the lines needed, it should work, it did for me :)来自@onironauta 的这个链接解决了它,它是西班牙语但相当容易理解,你也可以下载开发人员提供的源代码并复制所需的行,它应该可以工作,它对我有用:)

Solution 解决方案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM