You are not logged in.

Dear visitor, welcome to krpano.com 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.

1

Wednesday, October 12th 2011, 12:34pm

problem with fullscreen from javascript

I have a problem when I want to enable the fullscreen in javascript:
kp=document.getElementById('krpanoSWFObject');
kp.set('fullscreen', true);
will always fail with this message "Uncaught Error: Error calling method on NPObject."


Has someone a solution?



Thanks

2

Wednesday, October 12th 2011, 2:05pm

Hi,

first - you need to be sure that the krpano viewer is already loaded and ready,

either make callback from xml to js to inform your javascripts that krpano is ready,
e.g.
xml:

Source code

1
<krpano onstart="js( krpanoready() )">

js:

Source code

1
2
3
4
function krpanoready()
{
  ...
}


or check in js if there is already a "set" function and if not wait and try again:
e.g.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function dostuff()
{
  kp=document.getElementById('krpanoSWFObject');
  if(kp.set)
  {
	kp.set(...);
  }
  else
  {
 	setTimeout( dostuff(), 100 );
  }
}

dostuff();


second - changing the fullscreen mode is only possible as reaction of a user interaction (click, keypress) in the Flashplayer - that means a call from Javascript to change the fullscreen mode will not work - this is a Flashplayer security limitation,

best regards,
Klaus

3

Wednesday, October 12th 2011, 3:46pm

you can check this viewer :
http://svl360.wemake.fr/virtualtour/cite_de_l_or/index.html


there is a span :
fullscreen


wait that the krpano starts (I will add the check later), when you click on the span, oyu will get the error.

Thanks for your reply

Christophe

4

Wednesday, October 12th 2011, 7:36pm

Hi,

your 'init' code happens to early (directly after the embedding call) - the flash embedding is asynchronous so you need to wait until it is done and the viewer is ready,

best regards,
Klaus

5

Thursday, October 13th 2011, 11:01am

Hi Klaus,

I have changed my code in order to wait the flash to be ready :
http://svl360.wemake.fr/virtualtour/cite_de_l_or/index.html
and always the same bug...

Best Regards,

Christophe

6

Tuesday, October 18th 2011, 11:23am

Hi,

what bug?
if you mean setting fullscreen from javascript - that will never work - see above - switching to fullscreen is only possible as reaction to an user event (click, keyboard press) INSIDE the Flashplayer,

best regards,
Klaus