You are not logged in.

  • "Sudarchikov Andrey" started this thread

Posts: 1,081

Location: Russia, Kaliningrad

  • Send private message

1

Monday, August 26th 2013, 2:20pm

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:
yourdomain.com/mytours/tour.htm?some_variable=value_of_variable&more_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
yourdomain.com/mytours/tour.htm?start_scene=scene_name_or_index
and in xml
some start action

Source code

1
2
3
4
5
6
7
8
9
10
<krpano onstart="start();"
<action name="start">
	<!-- set default start scene if start_scene is not defined -->
	if(start_scene === null, set(start_scene,0); );
	loadscene(get(start_scene));
</action>

...

</krpano>



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*



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

This post has been edited 1 times, last edit by "Sudarchikov Andrey" (Mar 1st 2014, 12:21pm)


2

Monday, August 26th 2013, 3:11pm

Great, a nice straightforward example. Appreciate the mini-tute. Care to add some challenging examples?
Thanks Andrey!
Tony

  • "Sudarchikov Andrey" started this thread

Posts: 1,081

Location: Russia, Kaliningrad

  • Send private message

3

Monday, August 26th 2013, 7:25pm

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*





Sudarchikov Andrey has attached the following file:
  • paramsDemo.zip (178.17 kB - 310 times downloaded - latest: Jul 15th 2019, 5:58pm)
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

Arsdezi

Intermediate

Posts: 174

Location: Ukraine

  • Send private message

4

Monday, September 2nd 2013, 7:43pm

Well done!
It's working!

And can to be useful, thank you! *rolleyes*

This post has been edited 1 times, last edit by "Arsdezi" (Sep 4th 2013, 5:13am)


5

Sunday, April 20th 2014, 5:01pm

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é

wilsan

Trainee

Posts: 65

Location: Nederland

Occupation: Logistics Specialist – Planning & Logistics

  • Send private message

6

Saturday, May 3rd 2014, 6:39pm

Very useful example, very easy to use. *thumbup*
Its working fine,Thanks Andrey.

Masterwork done by Andrey. *thumbsup*

Stefan.L

Trainee

Posts: 102

Location: Sweden

Occupation: Photography/ webdesign

  • Send private message

7

Wednesday, October 22nd 2014, 2:38pm

Very useful! Great!
Best regards - Stefan

8

Sunday, July 12th 2015, 12:22am

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 likethat 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 :)

  • "Sudarchikov Andrey" started this thread

Posts: 1,081

Location: Russia, Kaliningrad

  • Send private message

9

Sunday, July 12th 2015, 9:11pm

Scene name must starts from letter
004 - trying to load 4 index scene (0,1,2,3,4) 5-th actually
so it's correct behaviour
rename your scenes to string names like s004 or something


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

10

Friday, August 14th 2015, 5:09pm

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

This post has been edited 1 times, last edit by "sebastianm" (Aug 14th 2015, 8:57pm)


11

Thursday, November 15th 2018, 7:57pm

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!

12

Sunday, November 18th 2018, 10:18pm

Hi Andrey,

Thank you for sharing your example!
Since 1.19.pr3 there is 'deep linking' in krpano, which allows to start any scene of the tour.xml
https://krpano.com/forum/wbb/index.php?p…ews119vtourskin

It seems to do the same job as your code.
The <action name="skin_deeplinking_update_url_process" of the vtourskin.xml brings the syntax of the url. The <view> can be set by the url, too.
Pavel

13

Wednesday, November 21st 2018, 10:17pm

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*

14

Monday, November 26th 2018, 10:50pm

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

Source code

1
2
3
4
5
6
	<!-- 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/ZORICAK…kat(-150,0,10);

Pavel

This post has been edited 1 times, last edit by "pur" (Nov 26th 2018, 11:02pm)