Devices attribute does not work when creating a plugin via addplugin() funciton

  • Hi,

    I picked this up today.

    If you add a plugin in the normal way shown below, the button shows in flash but not in html5. This works as expected.

    Code
    <plugin name="the_image"
    		url="random_image.jpg"
    		devices="flash"
    />

    The problem is that if you add the plugin via the addplugin() method shown below then it still works in flash, but it also shows in html5. In this case Html5 does not pick up the devices attribute.

    Code
    <action name="create_image">
    	addplugin(the_image);
    	set(plugin[the_image].devices,flash);
    	set(plugin[the_image].url, "random_image.jpg");
    </action>

    Note: Flash respects the devices attribute in with methods, but html5 does not.

  • Hi,

    the devices attribute in the xml is a 'filter' for static xml content.
    It will be only parsed during xml parsing and can be used to parse or skip parts of the xml.

    When setting it dynamically like in your example, it will not have any affect - in this case it will be just a custom variable.

    For dynamically checking the current device in action code, there exists the 'device' object:
    https://krpano.com/docu/actions/#device

    e.g.

    Code
    if(device.flash, ...do something...);

    Best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!