You are not logged in.

Dear visitor, welcome to Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.


Monday, August 22nd 2016, 5:31pm

Adding Video-Hotspots via js

I'm trying to add Video-Hotspots via js like I do for normal hotspots:

Source code

1'addhotspot(myname)');'set(hotspot[myname].ath,' + hotspot.position.x + ')');'set(hotspot[myname].atv,' + hotspot.position.y + ')');'set(hotspot[myname].loadedurl, krpano/plugins/videoplayer.js)');'set(hotspot[myname].loadingurl, krpano/plugins/videoplayer.js)');'set(hotspot[myname].url.html5, krpano/plugins/videoplayer.js)');'set(hotspot[myname].videourl, content/video.mp4)');'set(hotspot[myname].posterurl, content/poster.jpg)');'set(hotspot[myname].distorted, true)');'set(hotspot[myname].scale, 0.5)');'set(hotspot[myname].rx, 0)');'set(hotspot[myname].ry, 0)');'set(hotspot[myname].rz, 0)');'set(hotspot[myname].pausedonstart, false)');'set(hotspot[myname].loop, false)');'set(hotspot[myname].volume, 1)');'set(hotspot[myname].directionalsound, true)');'set(hotspot[myname].range, 90.0)');'set(hotspot[myname].rangefalloff, 1)');'set(hotspot[myname].outofrangevolume, 0)');'set(hotspot[myname].onvideoready, "")');'set(hotspot[myname].onvideoplay, "")');

I use this to check all the hotspots in my pano:

Source code

for (var i = 0; i < krpano.get('hotspot.count'); i++) {	console.log(krpano.get('hotspot[ ' + i + ']'), krpano.get('hotspot[ ' + i + ']'));}

The "myname"-hotspot appears in the resulting log but is not visible in my pano. Same data added via xml and everything is working fine.

Any ideas how to fix this? I need to add Video-Hotspots dynamically.


Tuesday, August 23rd 2016, 10:50am

Perhaps this happens because videos are plugins not real hotspots?
But I want to create a 3d-distorted hotspot like discibed here: #[url][/url]

I tried using addplugin() instead of addhotspot() but then I don't now how to make it a hotspot-node.


Tuesday, August 23rd 2016, 7:43pm


that's because you're setting invalid settings - 'loadedurl', 'loadingurl' and 'url.html5' - none of the these three settings is correct!

Just set the only 'url' setting!

Xml attribute filters like '.html5' are static xml filters and can't be used in dynamic code.

Best regards,


Wednesday, August 24th 2016, 10:08am

Thank you Klaus. Everything is working now. I don't now where I found 'loadurl' and 'loadingurl' ;-)
What I do now is:

Source code

1'set(hotspot[' + id + '].url, krpano/plugins/videoplayer.js)');'set(hotspot[' + id + '].videourl, content/video.mp4)');...

And I found this in the documentation:
  • Once the video is loaded, the value of the videourl attribute will be replaced by the url of the video file that was loaded.


Now things are a bit clearer for me.