提交 c8cf005b 编写于 作者: N Nicolò Carpignoli 提交者: GitHub

Merge pull request #614 from jeromeetienne/ios13

fix ios13 permissions
# 2.0.2
- Fixed motion and orientation sensors permission for iOS 13+ devices
# 2.0.1
- Fixed location-based files build
......
......@@ -123,7 +123,7 @@ You can also use GeoAR.js **without** the script, adding `gps-entity-place` enti
<!doctype HTML>
<html>
<script src="https://aframe.io/releases/0.9.2/aframe.min.js"></script>
<script src="https://raw.githack.com/jeromeetienne/AR.js/2.0.1/aframe/build/aframe-ar.js"></script>
<script src="https://raw.githack.com/jeromeetienne/AR.js/2.0.2/aframe/build/aframe-ar.js"></script>
<body style='margin : 0px; overflow: hidden;'>
<a-scene embedded arjs>
<a-marker preset="hiro">
......
此差异已折叠。
此差异已折叠。
......@@ -5,7 +5,7 @@
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>GeoAR.js demo</title>
<script src='https://aframe.io/releases/0.9.2/aframe.min.js'></script>
<script src='https://raw.githack.com/jeromeetienne/AR.js/master/aframe/build/aframe-ar.min.js'></script>
<script src='../../build/aframe-ar.js'></script>
<script>
THREEx.ArToolkitContext.baseURL = 'https://raw.githack.com/jeromeetienne/ar.js/master/three.js/'
</script>
......
......@@ -24,7 +24,7 @@ function loadPlaceFromAPIs(position) {
const params = {
radius: 300, // search places not farther than this value (in meters)
clientId: 'HZIJGI4COHQ4AI45QXKCDFJWFJ1SFHYDFCCWKPIJDWHLVQVZ',
clientSecret: '',
clientSecret: '2VBFT2H3OWI03RY5TDIMANCX4ATUTRYSXWZJHUVYGRWEZQ24',
version: '20300101', // foursquare versioning, required but unuseful for this demo
};
......
......@@ -31,13 +31,27 @@ AFRAME.registerComponent('gps-camera', {
var eventName = this._getDeviceOrientationEventName();
this._onDeviceOrientation = this._onDeviceOrientation.bind(this);
// From iOS 12.2 Safari has Motion & Orientation turned off by default.
// This may change from iOS 13.*
// if Safari
if (!!navigator.userAgent.match(/Version\/[\d.]+.*Safari/)) {
var timeout = setTimeout(function() { alert('Please enable device orientation in Settings > Safari > Motion & Orientation Access.')}, 750);
window.addEventListener(eventName, function() {
clearTimeout(timeout);
});
// iOS 13+
if (typeof DeviceOrientationEvent.requestPermission === 'function') {
var handler = function() {
console.log('Requesting device orientation permissions...')
DeviceOrientationEvent.requestPermission();
document.removeEventListener('touchend', handler);
};
document.addEventListener('touchend', function() { handler() }, false);
alert('After camera permission prompt, please tap the screen to active geolocation.');
} else {
var timeout = setTimeout(function () {
alert('Please enable device orientation in Settings > Safari > Motion & Orientation Access.')
}, 750);
window.addEventListener(eventName, function () {
clearTimeout(timeout);
});
}
}
window.addEventListener(eventName, this._onDeviceOrientation, false);
......
{
"name": "ar.js",
"version": "2.0.1",
"version": "2.0.2",
"description": "Efficient Augmented Reality for the Web",
"main": "",
"scripts": {
......
......@@ -76,7 +76,7 @@ Object.assign( ARjs.Context.prototype, THREE.EventDispatcher.prototype );
// ARjs.Context.baseURL = '../'
// default to github page
ARjs.Context.baseURL = 'https://jeromeetienne.github.io/AR.js/three.js/'
ARjs.Context.REVISION = '2.0.1';
ARjs.Context.REVISION = '2.0.2';
/**
* Create a default camera for this trackingBackend
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册