At the time of the introduction of the krpano panorama into my React component, I was faced with the fact that I could not turn on the gyroscope on the devices in any way. The component doesn't even ask for permissions, and if I request it manually, then nothing happens either. I'm asking for help, because I can't figure out how to activate the gyro myself. I'm attaching parts of the code.
Code
//
var settings;
if (xmlText) {
settings = {};
settings["onstart"] = "loadxml(" + xmlText + ")";
}
window.embedpano({
focus: true,
html5: "only",
id: 'pano',
target: krpanoRef.current,
xml: process.env.PUBLIC_URL + "/assets/libs/krpano/krpano.xml",
vars: settings
});
Display More
And then look at XML:
Code
<krpano syncother="true"
showerrors="false"
onstart="ifnot(haveexternalinterface,
error('Javascript не доступен![br][br]Проверьте настройки безопасности Flashplayer:[br][br]
http://krpano.com/docu/localusage/')); is_ready(); js( krpanoIsReady());">
<plugin name="gyro"
url="assets/gyro2.js"
enabled="true"
onavailable="js(console.log('1'))"
onunavailable="showinfo('No Gyroscope available');"
ondenied="showinfo('Gyroscope usage denied');"
absolute="false"
north="0"
/>
<view
hlookat ="0"
vlookat ="0"
fovtype ="MFOV"
fov ="90"
maxpixelzoom ="1.0"
fovmax ="120"
limitview ="auto"
/>
<data name="panoInfoLon">38.720235587123</data>
<data name="panoInfoLat">52.5442582251982</data>
<data name="videoPositionID">9875666</data>
<data name="videoDocumentID">3510</data>
<data name="azimuth">138.444111707852</data>
<data name="direction">Forward</data>
<data name="VideoDocumentDate">07.09.2020</data>
<data name="VideoRoad">М-4 «Дон»</data>
<data name="VideoPath">Основное направление</data>
<data name="VideoKm">397.617</data>
<data name="VideoKmPlus">397+805</data>
<control mousetype="drag2d"
touchtype="drag2d" />
<image><cube url="***/Video/CubicFrameImage?VideoPositionId=9875666&CubeSideLabel='%s'" /></image>
<events name="compass_events" onviewchange="compass_update_rotate();"/>
<action name="compass_update_rotate">
set(dst, 180);
sub(dst, view.hlookat);
add(layer[buttons].rotate, dst, 180);
add(layer[buttonsFast].rotate, dst, 180);
</action>
<action name="is_ready">
set(layer[up].visible, true);
set(layer[up-end].visible, false);
set(layer[down].visible, true);
set(layer[down-end].visible, false);
set(layer[upFast].visible, true);
set(layer[upFast-end].visible, false);
set(layer[downFast].visible, true);
set(layer[downFast-end].visible, false);
</action>
<events onloadcomplete="js(adapterKrPanoOnComplete());" onnewpano="js(adapterKrPanoOnStart());" onviewchanged="if(syncother, js(adapterKrPanoOnHLookAtChange()));" />
<security>
<crossdomainxml url="https://geo.indorsoft.ru/crossdomain.xml" />
</security>
<layer name="buttons" keep="true" alpha="0.5" align="centerbottom" x="-37" y="40"
onover="set(layer[buttons].alpha, 1)" onout="set(layer[buttons].alpha, 0.5)"
type="container" width="20" height="65">
<layer name="up-end" visible="false" x="-7" y="22"
url="/assets/images/pano/stop.png" />
<layer name="down-end" visible="false" x="-7" y="67"
url="/assets/images/pano/stop.png" />
<layer name="up" onclick="js(getNextFrame('next'))" url="/geo3/assets/images/pano/up.png" width="32"
height="32" align="left" visible="true" x="-7" y="12" />
<layer name="down" onclick="js(getNextFrame('back'))" url="/geo3/assets/images/pano/down.png" width="32"
height="32" align="left" visible="true" x="-7" y="47" />
</layer>
<layer name="buttonsFast" keep="true" alpha="0.5" align="centerbottom" x="37" y="40"
onover="set(layer[buttonsFast].alpha, 1)" onout="set(layer[buttonsFast].alpha, 0.5)"
type="container" width="20" height="65">
<layer name="upFast-end" visible="false" x="-7" y="22"
url="/geo3/assets/images/pano/stop.png" />
<layer name="downFast-end" visible="false" x="-7" y="67"
url="/geo3/assets/images/pano/stop.png" />
<layer name="upFast" onclick="js(getFrameAtPos('next'))" url="/geo3/assets/images/pano/upFast.png" width="32"
height="32" align="left" visible="true" x="-7" y="12" />
<layer name="downFast" onclick="js(getFrameAtPos('back'))" url="/geo3/assets/images/pano/downFast.png" width="32"
height="32" align="left" visible="true" x="-7" y="47" />
</layer>
</krpano>
Display More