Author Message

Posted: Mon Oct 08, 2012 12:23 pm   Post subject: JavaScript API

Hello everybody,

I am trying to use the JavaScript API on my page published with iSpring Suite 6. I tried to find samples in the installation directory, but there isn't anything.

I found a post on this forum : viewtopic.php?f=3&t=976 and tried to reproduce it.

I am not sure if my JS files (fsplayer.js and swfobject.js) are corrects, I downloaded the ZIP file linked in that post, but I did not find them in another place ... even on iSpring website...

Here my code :

Code:
<!-- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Test iSpring JavaScript API</title>
        <script type="text/javascript" src="fsplayer.js"></script>
        <script type="text/javascript" src="swfobject.js"></script>
    </head>
    <body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" bgcolor="#ffffff">
        <!-- saved from url=(0013)about:internet -->
        <table cellpadding="0" cellspacing="0" width="100%" height="100%">
            <tr>
                <td align="center" valign="middle">
                    <div id="movie">

                    </div>
                    <script type="text/javascript">
                        var loader = new fsplayer.api.PresentationLoader();
                        var pc;
                        loader.onPlayerInit = function(player){
                            pc = player.getPlaybackController();
                            pc.enableAllEventHandlers();
                        }
                        loader.load('presentation.swf', document.getElementById('movie'), 'presentation', 850, 540);
                       
                        if(gup('slide')){
                            if(pc != null){
                                consol.log('OK!');
                                pc.gotoSlide(parseInt(gup('slide')));
                            }else{
                                console.log('pc is null ...');
                            }
                        }
                       
                        function gup( name ){
                            name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
                            var regexS = "[\\?&]"+name+"=([^&#]*)";
                            var regex = new RegExp( regexS );
                            var results = regex.exec( window.location.href );
                            if( results == null )
                                return "";
                            else
                                return results[1];
                        }
                    </script>
                </td>
            </tr>
        </table>
        <script type="text/javascript" src="fixprompt.js"/>
    </body>
</html>


The flash is well loaded, but the "onPlayerInit" method is never called, even if I override it. And my PlaybackController object is never construct and then I cannot use those class methods.

Is there a download page where I can find latest version of jsplayer and swfobject file? Is there any online examples for the JavaScript API ? I need to launch the presentation at a given slide retrieved in the URL.

Thanks in advance,
Julien


Profile profile test

Posted: Thu Oct 11, 2012 7:10 am   Post subject: Re: JavaScript API

Nobody use the JavaScript API ? : p


Profile profile test

Posted: Thu Oct 11, 2012 2:20 pm   Post subject: Re: JavaScript API

JavaScript commands are implemented using external interface. If your presentation is located on the local drive it might experience issues with the Adobe FlashPlayer sercurity restrictions. Read more at our blog here:
http://blog.ispringsolutions.com/?p=174

Once you upload your project to the Internet, you will not face this issue anymore.

Also don't forget to include JavaScript interface while converting to Flash in Publish -> Advanced settings.

JS samples are available in iSpring SDK folder:
"C:\Program Files (x86)\iSpring\SDK 5\samples\client\samples\javascript\"


Profile profile test

Posted: Thu Oct 11, 2012 2:21 pm   Post subject: Re: JavaScript API

Thank you for your help!
I am going to check that and come back later to post the result.

Regards,
Julien


Profile profile test
Display posts from previous:  Sort by  

  


Who is online
Who is online In total there are 15 users online :: 1 registered, 0 hidden and 14 guests (based on users active over the past 5 minutes)
Most users ever online was 108 on Thu Nov 21, 2013 3:41 pm

Registered users: Yahoo [Bot]