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

ARnftThreejs sometimes not start #19

Open
kezmanh opened this issue Oct 4, 2021 · 1 comment
Open

ARnftThreejs sometimes not start #19

kezmanh opened this issue Oct 4, 2021 · 1 comment
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@kezmanh
Copy link

kezmanh commented Oct 4, 2021

webarkit/ARnft#204

I came from the above thread. I was trying to use my own camera source. So I have the following script

navigator.mediaDevices.enumerateDevices()
.then(gotDevices)
.then(function(){
    navigator.mediaDevices.getUserMedia({
          video: constraints
    })
 .then(function(stream){
      window.stream = stream;
      video.srcObject = stream;

       const entities = [
                  { name: 'game1', markerUrl: "/markers/game1" },
                  { name: 'game2', markerUrl: "/markers/game2" },
                  { name: 'game3', markerUrl: "/markers/game3" },
          ];
                   
      ARnft.ARnft.initWithEntities(640, 480, entities,  '/config.json', true)
      .then((nft) => {
      });

And I commented out navigator.mediaDevices code in ARnft.js. Then, the last console log is ARnftThreejs version: 0.2.0. It seems cannot keep loading the remaining library. Without anymore console log and error log.

    <script src="/js/three.min.js"></script>
    <script src="/js/ARnftThreejs.js"></script>
    <script src="/js/ARnft.js"></script>
    <script src="/js/main.js"></script>

I was using the above structure. ARnft ini function was wrapped inside my custom getUserMedia function in main.js. It causes the ARnftThreejs not keep load. However, there is no problem when I test in desktop and the latest Samsung phone. It has problem only in my old Android phone.

    <script src="/js/three.min.js"></script>
    <script src="/js/ARnftThreejs.js"></script>
    <script src="/js/ARnft.js"></script>
    <script src="/js/main.js"></script>
    <script>
        const entities = [
            { name: 'game1', markerUrl: "/markers/game1" },
            { name: 'game2', markerUrl: "/markers/game2" },
            { name: 'game3', markerUrl: "/markers/game3" },
        ];
  
        ARnft.ARnft.initWithEntities(640, 480, entities,  '/config.json', true)
        .then((nft) => {})

lastly, when i move the function out. it works again. i am not sure the reason

@kalwalt kalwalt self-assigned this Oct 4, 2021
@kalwalt kalwalt added bug Something isn't working help wanted Extra attention is needed labels Oct 4, 2021
@kalwalt
Copy link
Member

kalwalt commented Oct 4, 2021

Thank you @kezmanh i will look into it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants