onviewchanged Panovideo

  • I'm having issues with getting the view.hlookat from a video SPHERE panorama onviewchanged.

    Is there any limitation on this action when it comes to video panoramas/images?
    I can get the view.hlookat from a CUBE panorama/image onviewchanged with no issue, leveraging the js function noted below.

    Any help would be greatly appreciated.

    My XML is:


    <krpano version="1.19-pr4">
    <plugin name="edittranshub"
    url="%SWFPATH%/plugins/videoplayer.swf"
    alturl="%SWFPATH%/plugins/videoplayer.js"
    videourl="/player/media/00000098566.mp4"
    visible="true"
    enabled="true"
    panovideo="true"
    keep="true"
    refreshrate="auto"
    loop="false"
    pausedonstart="true"
    />
    <control mousetype="drag2d" mousefriction="0.2" keybspeed="0.1" keybfriction="0.1"/>

    <events onviewchanged="transPanoParams()"/>

    <action name="transPanoParams">
    stopdelayedcall(transPanoParams);
    delayedcall(transPanoParams,0.25,
    js(setlookat(2));
    );
    </action>

    <view hlookat="0.00" vlookat="0.00" fov="70" fovmin="1" fovmax="170"/>
    <image type="SPHERE">
    <sphere url="plugin:edittranshub"/>
    </image>
    </krpano>

    And the js function:
    function setlookat(pancall) {
    if (pancall == 2) {
    console.log('2');
    krpano2().call("adjusthlookat(0)");
    var hlookat2 = Number(krpano2().get("view.hlookat"));
    document.getElementById("hlookat_2").value = hlookat2.toFixed(2);
    var vlookat2 = Number(krpano2().get("view.vlookat"));
    document.getElementById("vlookat_2").value = vlookat2.toFixed(2);
    console.log('2 ' + hlookat2 + ' - ' + vlookat2);
    }
    if (pancall == 1) {
    console.log('1');
    krpano1().call("adjusthlookat(0)");
    var hlookat1 = Number( krpano1().get("view.hlookat") );
    document.getElementById("hlookat_1").value = hlookat1.toFixed(2);
    var vlookat1 = Number( krpano1().get("view.vlookat") );
    document.getElementById("vlookat_1").value = vlookat1.toFixed(2);
    console.log('1 ' + hlookat1 + ' - ' + vlookat1);
    }
    };

  • Hi,

    I'm not sure what you're trying to achieve, but the onviewchange/onviewchanged events will be called everytime when rendering the pano view - in when using a pano video this will be changed every frame.

    Best regards,
    Klaus

  • Klaus,

    Thank you for the reply.

    I'm aligning to panoramas. A static and a video.
    I need the hlookat and vlookat coordinates from both the beginning and end of the video, hence the paused on start. I get to the end by calling seek(100%).
    But for some odd reason I'm not "getting" the view.hlookat or view.vlookat values.

  • Hi,

    maybe i am off track.. but did you try to use the onvideocomplete call?
    Maybe first make it work in xml.

    Code
    set(plugin[video].onvideocomplete, MakeView());
    
    
    <action name="MakeView">
    set(_lasthlookat, get(view.hlookat));
    set(_lastvlookat, get(view.vlookat));
    </action>

    and use those vars to set for the pano..
    or so..

    Tuur *thumbsup*

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!