GithubHelp home page GithubHelp logo

Comments (7)

ItIsArmin avatar ItIsArmin commented on May 16, 2024 3

I'm now running it with chrome port forwarding and a USB cable, and it works perfectly fine.
I appreciate it guys, we are building something big with this

from webxr-samples.

jsantell avatar jsantell commented on May 16, 2024 2

You'll need to use something like adb reverse or port forwarding in Chrome so that you're visiting something that looks like a local URL on device e.g. localhost or 127.0.0.1 to circumvent the HTTPS restriction for local dev

from webxr-samples.

klausw avatar klausw commented on May 16, 2024 1

Ah, that's the problem - 192.168.1.20 isn't a localhost address. You need to use http://localhost:8887 or http://127.0.0.1:8887. (Or, for IPv6, "::1" and "localhost6" also work.) Even if 192.168.1.20 is your device's current IP address, as far as I know that's not recognized as localhost.

If this was your PC's address, that's definitely not a localhost address. It specifically means "same device", not "on the same local network".

I assume you mean a local HTTP server? HTTPS isn't needed for localhost, and setting up the certificates needed for HTTPS would be an unnecessary annoyance.

from webxr-samples.

klausw avatar klausw commented on May 16, 2024

There's a HTTPS requirement for using WebXR, but using localhost has an exception for that and should work. What's the exact URL you're using for the localhost test?

file:// URLs are not considered to be localhost addresses, you need to use HTTP to access http://localhost:8000 or similar using either port forwarding or a local http server.

from webxr-samples.

ItIsArmin avatar ItIsArmin commented on May 16, 2024

Thank you, I just tested with HTTPS local server and it worked, but before trying HTTPS, I was running "Web Server for chrome" App on my PC, and on my AR compatible phone I was using http://192.168.1.20:8887/proposals/phone-ar-hit-test.html to access. I also enabled "#allow-insecure-localhost" just in case, but did not help.

from webxr-samples.

wimachtendink avatar wimachtendink commented on May 16, 2024

I don't remember where I got it but I use the following as "server.py" and this works really well.

# -*- coding: utf-8 -*-
#test on python 3.4 ,python of lower version  has different module organization.
import http.server
from http.server import HTTPServer, BaseHTTPRequestHandler
import socketserver

PORT = 8080

Handler = http.server.SimpleHTTPRequestHandler

Handler.extensions_map={
        '.manifest': 'text/cache-manifest',
	'.html': 'text/html',
        '.png': 'image/png',
	'.jpg': 'image/jpg',
	'.svg':	'image/svg+xml',
	'.css':	'text/css',
	'.js':	'application/x-javascript',
	'': 'application/octet-stream', # Default
    }

httpd = socketserver.TCPServer(("", PORT), Handler)

print("serving at port", PORT)
httpd.serve_forever()

then it should be served to http://127.0.0.1:8080 It's so easy and small that I just keep a copy in every project so I cas serve directly from the file (just double click) and not worry about anything it.

from webxr-samples.

jsantell avatar jsantell commented on May 16, 2024

serve on npm and python's SimpleHTTPServer are two basic servers for this purpose, in addition to @wimachtendink's snippet above. I'll file an issue indicating that some text would be helpful explaining the secure context requirements used by WebXR.

Thanks for filing!

from webxr-samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.