src/js/pop.js
branchno-popcorn
changeset 391 0a68395f7e12
parent 390 9b4e5f606d72
child 394 89a79a2c6014
--- a/src/js/pop.js	Fri Dec 02 12:02:05 2011 +0100
+++ b/src/js/pop.js	Fri Dec 02 12:11:23 2011 +0100
@@ -29,10 +29,11 @@
   Popcorn._container = container.slice(1); //eschew the '#'
   options.events = {
       onReady: Popcorn.__initApi,
-      onTime: Popcorn.__timehandler 
+      onTime: Popcorn.__timeHandler 
     };
     
   jwplayer(Popcorn._container).setup(options);
+  Popcorn.media.duration = options.duration;
   return Popcorn;
 };
 
@@ -92,18 +93,20 @@
    (onTime event)
  */
 
-Popcorn.__timehandler = function() {
+Popcorn.__timeHandler = function() {
   var currentTime = jwplayer(Popcorn._container).getPosition();
   var i = 0;
   for(i = 0; i < Popcorn.__codes.length; i++) {
     var c = Popcorn.__codes[i];
-    if (currentTime <= c.start && currentTime + 0.1 >= c.start) {
+    if (currentTime == c.start) {
       c.onStart();
     }
     
-    if (currentTime <= c.end && currentTime + 0.1 >= c.end) {
+    if (currentTime == c.end) {
       c.onEnd();
     }
 
   }
+
+  Popcorn.trigger("timeupdate");
 };