You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Sunday, April 15th 2012, 11:32pm

loading different navigation buttons depending on device type

Apologies in advance if this has already been covered, I spent several hours looking through previous posts but could not find a definitive answer.

I currently use the following html code to load a different xml file for different devices:

if( viewer.isDevice("iPhone|Android") )
viewer.addVariable("xml", "pano-iphone.xml");
else
if( viewer.isDevice("iPad") )
viewer.addVariable("xml", "pano-ipad.xml");
else
viewer.addVariable("xml", "pano-pc.xml");
viewer.passQueryParameters();
viewer.embed();

Ideally I'd like to use the same xml file but load a different xml file 'inside' which had different buttons for various devices. For example zoom in/out for PC/flash but no button for iPad etc.

So I tried putting all the buttons into a separate xml file and adding:

<include url="buttons-pc1.xml" />

Which works fine, my problem is that I'd ideally like to have something like this in the xml file:

if isDevice("iPhone|Android") include phone-android-buttons.xml
else
if isDevice("iPad") include ipad-buttons.xml
else
include pc-buttons.xml

Now I know this can't be done with <include> as it is parsed when the xml is first read.

So my questions is what is the 'best practice' way of supporting different button layout 'skins' for different devices.

thanks in advance for help.

Tim

mindlessboss

Professional

Posts: 1,081

Location: Russia, Kaliningrad

  • Send private message

2

Monday, April 16th 2012, 5:41am

Hi!
better use devices attribute in include tag.
example:
include url="iphones_kin.xml" devices="iphone"
include url="ipad_kin.xml" devices="ipad"
include url="default_kin.xml" devices="flash"

docu http://krpano.com/docu/xml/#devices-notes

Regards
Andrey *thumbup*
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

3

Monday, April 16th 2012, 9:47am

<include url="buttons-ipad.xml" devices="ipad" /> does not work (bug or feature?)

Hi Andrey



Thanks for your suggestion. I added the includes as below:



<krpano version="1.0.8" onstart="startup();">


<!-- Licensed to -->
<!-- Copyright Trek Wireless Ltd 2012 -->
<!-- -->



<action name="startup">

if(scenetoload === null, set(scenetoload,pano3));

loadscene(get(scenetoload),blend(4));

</action>

<action name="rotate-on">
set(autorotate.enabled,true);
set(plugin[rotate-on-button].visible,false);
set(plugin[rotate-off-button].visible,true);
</action>


<action name="rotate-off">
set(autorotate.enabled,false);
set(plugin[rotate-on-button].visible,true);
set(plugin[rotate-off-button].visible,false);
</action>

<!-- disable the progress bar -->
<progress showload="none" showwait="none" />


<!-- hotspot styles (for Flash and HTML5) -->


<!-- text style for hotspot hovering -->
<textstyle name="hotspottextstyle"
font="Arial" fontsize="16" bold="true" italic="true" textcolor="0xFFF7EF" background="false" border="false"
alpha="1" blendmode="layer" effect="glow(0x000000,0.5,4,3);dropshadow(4,45,0x000000,4,0.66);"
origin="cursor" edge="bottom" textalign="left" xoffset="0" yoffset="-3" noclip="true" showtime="0.1" fadetime="0.25" fadeintime="0.1"
/>




<!-- ** pano3 Entrance ********************************************************************************************** -->

<scene name="pano3" title="pano3">

<view limitview="offrange" hlookat="40" vlookat="0" vlookatmin="-90" vlookatmax="90" fovtype="MFOV" fovmax="85" maxpixelzoom="4.0" />

<preview url="../images/preview/pano3_preview.jpg" />

<image>
<left url="../images/pc-med-res/pano3_l.jpg" />
<front url="../images/pc-med-res/pano3_f.jpg" />
<right url="../images/pc-med-res/pano3_r.jpg" />
<back url="../images/pc-med-res/pano3_b.jpg" />
<up url="../images/pc-med-res/pano3_u.jpg" />
<down url="../images/pc-med-res/pano3_d.jpg" />
<mobile>
<left url="../images/iphone/pano3_l.jpg" />
<front url="../images/iphone/pano3_f.jpg" />
<right url="../images/iphone/pano3_r.jpg" />
<back url="../images/iphone/pano3_b.jpg" />
<up url="../images/iphone/pano3_u.jpg" />
<down url="../images/iphone/pano3_d.jpg" />
</mobile>
<tablet>
<left url="../images/ipad/pano3_l.jpg" />
<front url="../images/ipad/pano3_f.jpg" />
<right url="../images/ipad/pano3_r.jpg" />
<back url="../images/ipad/pano3_b.jpg" />
<up url="../images/ipad/pano3_u.jpg" />
<down url="../images/ipad/pano3_d.jpg" />
</tablet>
</image>




<include url="buttons-ipad.xml" devices="iphone" />
<include url="buttons-ipad.xml" devices="ipad" />
<include url="buttons-pc.xml" devices="flash" />




<autorotate enabled="true"
waittime="2.0"
accel="1.0"
speed="-3.0"
horizon="0.0"
tofov="off"
/>


</scene>



<!-- ******************************************************************************************************* -->


</krpano>



It looks like the last <include overwrites the previous ones. ie as above buttons-pc.xml get displayed, but if I put buttons-ipad.xml as the last entry instead then on both PC and iPad) buttons-ipad.xml gets displayed.



Any ideas as it looks like you cannot combine <include with devices=



thanks

Tim

mindlessboss

Professional

Posts: 1,081

Location: Russia, Kaliningrad

  • Send private message

4

Monday, April 16th 2012, 11:58am

What krpano version?
It must work as in your xml, all is right.
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

5

Monday, April 16th 2012, 12:08pm

Using krpano-1.0.8.14-2012-02-20



rgds

Tim

mindlessboss

Professional

Posts: 1,081

Location: Russia, Kaliningrad

  • Send private message

6

Monday, April 16th 2012, 12:16pm

Hi!
<include url="buttons-ipad.xml" devices="iphone" />
<include url="buttons-ipad.xml" devices="ipad" />
<include url="buttons-pc.xml" devices="flash" />

it must work.
Check your XML files.

Or share test example.

Andrey
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

7

Monday, April 16th 2012, 12:29pm

fixed!!! - loading different navigation buttons depending on device type

Hi Andrey



When I started testing I copied an old tour with the previous krpano version *thumbdown*



Just copied across the latest krpano files and it is now working *thumbsup*



Thanks for jogging my memory re versions



So for anyone else looking...



<include url="buttons-ipad.xml" devices="iphone" />
<include url="buttons-ipad.xml" devices="ipad" />
<include url="buttons-pc.xml" devices="flash" />

does work with krpano-1.0.8.14-2012-02-20



thanks again



Tim