Direct link to specific scene tutorial (url params)

  • Hi!
    Customers often ask me about scenes direct link (url) in the tour.
    Well, krpano has great feature pass url params to xml.
    And here is small tutorial of how to use it.

    First, you need to set passQueryParameters to true
    example:
    embedpano({swf:"tour.swf", xml:"tour.xml", target:"pano", passQueryParameters:true });
    then you can use any variable names in url string
    for example:
    http://yourdomain.com/mytours/tour.h…e_var=its_value
    and so on
    all this variables will be passed to xml and you can get it's values
    like get(some_variable) or get(more_var)

    So, what if we want to start specific scene from url?
    then let's use start_scene for define which scene to start.
    your url will be like this
    http://yourdomain.com/mytours/tour.h…e_name_or_index
    and in xml
    some start action


    you can pass start view same way or any other variables to your tour xml.

    Well, I hope you will find it usefull

    Best wishes
    Andrey *thumbup*


  • Small working example!

    how to use:
    open tour.html
    and add params to url, for example:
    tour.html?start_scene=scene1
    or
    tour.html?start_scene=1


    name and index of the scene can be used

    start_fov, start_hlookat, start_vlookat also available in this example

    for example:
    tour.html?start_scene=2&start_fov=70&start_vlookat=20

    Enjoy
    Andrey *thumbup*


  • Hi

    i did try the exemple but is it possible the the url dinamicly display the full link every time you change panorama

    if you click on scene 2 the url change to:
    tour.html?start_scene=2&start_fov=70&start_vlookat=20

    if you click on scene 1 url automaticly change to

    tour.html?start_scene=1&start_fov=70&start_vlookat=20


    Kind regards,

    José

  • Hello

    i followed your tutorial and found passQueryParameters set to ture already in my tour.html

    and when i write the url in the address bar in my browser like that it opens the next scene instead of the written number?! i don`t know what did i do wrong? :/

    plus.. i actually when i started to read this thread i thought that it would be able to get the link updated from current scene i`m viewing.. i mean for example if i`m viewing scene no 007 and i clicked on share.. it shares this scene.. not the main tour link that opens from scene 001.. get me?

    thanks in advance :)

  • Thank you for this tip, is working as supposed to, now that we can access direct panos inside the virtual tour, i wonder do you know a way to share(on facebook) a specific pano within the virtual tour?

    Edit:

    I saw you already made this happen in another post, so thank you again :)

    Thanks
    Sebastian

    Edited once, last by sebastianm (August 14, 2015 at 8:57 PM).

  • Is it possible to get these vars when change current view?
    Update the url when user is looking up an see something interesting and want to share the scene but with the current view?



    Many thanks for your solution Andrey!

  • Thx,

    deeplinking was my solution.

    But is it possible to change the path of the deeplinking?


    http://192.168.178.22:666/?s=0&ansicht=lookat(112,56,140);


    to

    http://192.168.178.22:666/?s=0&hlookat=1…okat=56&fov=140


    <action name="skin_deeplinking_update_url_process">
    copy(adr, browser.location);
    indexoftxt(qi, get(adr), '?');
    if(qi GT 0, subtxt(adr, adr, 0, get(qi)));
    copy(si, scene[get(xml.scene)].index);
    copy(h, view.hlookat);
    copy(v, view.vlookat);
    copy(f, view.fov);
    set(pp, calc(f LT 10 ? 6 : 0));
    roundval(h, get(pp));
    roundval(v, get(pp));
    roundval(f, get(pp));
    set(adr, calc(adr + '?s=' + si + '&amp;ansicht=lookat('+h+','+v+','+f+');'));
    js( history.replaceState(null, document.title, get(adr)); );
    </action>


    Thanks for any help! *smile*

  • Anjenehm,
    If you use the default krpano tour.xml generated by the MAKE VTOUR (MULTIRES) droplet (ver. 1.19.pr16) you see the

    Code
    <!-- startup action - load the first scene -->
    	<action name="startup" autorun="onstart">
    		if(startscene === null OR !scene[get(startscene)], copy(startscene,scene[0].name); );
    		loadscene(get(startscene), null, MERGE);
    		if(action[startactions].name !== null, startactions() );
    	</action>


    Then you can start any of your scenes by adding to the startlink yourdomain.tour.html?startscene=yourscenename_or_sceneindex&startactions=any_krpano_actions
    e.g.:
    https://pavel.ursiny.sk/pano/Art/ZORIC…kat(-150,0,10);

    Pavel

    Edited once, last by pur (November 26, 2018 at 11:02 PM).

  • Been playing around with this and can't get it too completely work, I'd appreciate any insight.

    Noticed that in previous threads the syntax was

    Code
    tour.html?start_scene=coolScene


    but now it is:

    Code
    tour.html?startscene=coolScene


    This works fine to load the specified scene but when I try to change another attribute like fov or hlookat it doesn't quite work.

    I've tried various combinations similar to:

    Code
    tour.html?startscene=coolScene&start_fov=85&start_hlookat=20



    Is my syntax wrong? I can't seem to change the fov or hlook at all.

    Thanks!

  • Hi)

    Thats because URL parameters are passed BEFORE the scene is loaded and the scene has its own VIEW settings.

    Try this:

    Code
    ?startscene=1&h=90


    and add the following into "onstart" of the needed scene (in my test it's second scene)

    Code
    onstart="lookat(get(h), get(v), get(f))"


    Hope this helps

    Regards,

    Alexey

  • I SOLVED.
    Thanks.

    Code
    hi, 
    I could not find how to use it for PTP. How can I go to the scene I want in PTP projects?
    1.20.9 krpano installed on panotour pro 2.5.14

    Best!
    Alican Y.

    Edited 2 times, last by sanaltur (February 25, 2021 at 10:18 AM).

Participate now!

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