get framecount with projekktor
<p>i'm currently working on a new project that requires several instances of a video player in the same page. each of those instances are suppose to return a framecount in order to be used later in the application. I made a javascript class that create a video player and make the calculation for the frame count. the only problem is that the method used for the framcount doesn't work (or at least it used to if I where to put a $(document).ready around).
The player I choose is projekktor.</p>

<p><strong>here is my html code</strong> </p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Youtube&lt;/title&gt;
    &lt;meta charset="utf-8" /&gt;
  &lt;link href="style.css" rel="stylesheet" type="text/css" /&gt;
  &lt;link rel="stylesheet" href="theme/style.css" type="text/css" media="screen" /&gt;
    &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="projekktor.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="init.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="video2.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript" src="tracking.js"&gt;&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;

    &lt;div id="params"&gt;
        &lt;span id="currentTime"&gt;&lt;/span&gt;&lt;br/&gt;
        &lt;span id="currentFrame"&gt;&lt;/span&gt;&lt;br/&gt;
        &lt;span id="currentFrame2"&gt;&lt;/span&gt;&lt;br/&gt;
        &lt;span id="progress"&gt;--&lt;/span&gt;&lt;br/&gt;
        &lt;span id="progress2"&gt;--&lt;/span&gt;&lt;br/&gt;
        &lt;span id="videoid"&gt;--&lt;/span&gt;&lt;br/&gt;

    &lt;/div&gt;


&lt;script&gt;
$(document).ready(function() {
    var init = new Init();
    init.setContainers();
    var video = new Video("Video03");
    video.setVideoContainer();
    video.setUpPlayer();
    video.frameCount();
    video.preload();
    //video.setFullScreen();
    setInterval(function() {
      $("#currentFrame2").html(video.getCurrentFrame());
}, 3000);



 });  
&lt;/script&gt;

&lt;/body&gt;      
&lt;/html&gt;
</code></pre>

<p><strong>here is my javascript code</strong> </p>

<pre><code>function Video(aVideoId) {

    //Attributs
    this.videoId = aVideoId
    this.currentFrame = 0;
    this.Id = aVideoId;


    //Getters / Setters
    this.getCurrentFrame = function() {
        return this.currentFrame;
        alert();
    };

    this.getVideoId = function() {
        return this.videoId;
    };

    //Methodes
    this.setVideoContainer = function() {
        var videoContainer = $('&lt;div&gt;', {
            id: this.videoId,
            class: 'projekktor',
            width: "100%",
            height: "100%",
        });

        $('#innerContainer').html(videoContainer);

    };

    this.setUpPlayer = function() {
        var videoId = this.videoId;
        $(document).ready(function() {
            myPlayer = projekktor('#' + videoId, {
                controls: "true",
                volume: 0.5,
                preload: false,
                autoplay: true,
                playlist: [{
                    0: {
                        src: 'http://fightingfish.fr/preprod/perrier/videosTracking/' + videoId + '.mp4',
                        type: 'video/mp4'
                    },
                    1: {
                        src: 'http://fightingfish.fr/preprod/perrier/videosTracking/' + videoId + '.mov',
                        type: 'video/mov'
                    },
                    2: {
                        src: 'http://fightingfish.fr/preprod/perrier/videosTracking/' + videoId + '.ogv',
                        type: 'video/ogv'
                    }
                }]
            });
        });

    };

    this.frameCount = function() {


            var timeListener = function(duration) {
                    var duration = duration;
                    $('#currentTime').html(duration);
                    this.currentFrame = Math.round(duration * 25);
                    $('#currentFrame').html(this.currentFrame);
                }

            myPlayer.addListener('time', timeListener);


    };




};
</code></pre>

<p>the problem really seem to happen around the this.framecount method. I always get the error (myPlayer is not defined). Does anyone have an idea on how I can fix this ? 
    thank you very much</p>
