Hi,
So all the additional concatenated attributes are basically shorthand if checks?
Yes, can be said. They decide if that attribute will get parsed or not.
but this one could:
addlayer(pano15);
if(device.desktop,
set(layer[pano15].videourl, get(%FIRSTXML%/spots/pano_high.mp4));
set(layer[pano15].devices, 'desktop');
);
if(device.tablet.or.mobile.and.no-iphone,
set(layer[pano15].videourl, get(%FIRSTXML%/spots/pano_low.mp4));
set(layer[pano15].devices, 'tablet.or.mobile.and.no-iphone');
);
- the 'if' is okay
- the 'get(...)' is wrong as the values you're setting are not variables
- and setting the 'devices' attributes is unnecessary and wouldn't do anything. krpano checks the 'devices' attributes in the xml files only during parsing the xml data to the internal data structures.
Here an alternative one-line solution using the calc() action and the
ternary (if ? then : else) operator:
|
Quellcode
|
1
|
calc(layer[pano15].videourl, device.desktop ? '%FIRSTXML%/spots/pano_high.mp4' : '%FIRSTXML%/spots/pano_low.mp4');
|
or here with separating the folder-path from the file-names:
|
Quellcode
|
1
|
calc(layer[pano15].videourl, '%FIRSTXML%/spots/' + (device.desktop ? pano_high.mp4' : 'pano_low.mp4'));
|
Best regards,
Klaus