]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
fixes to the mute and volume functions
authorKarim Hamidou <khamidou@gmail.com>
Thu, 29 Sep 2011 13:27:50 +0000 (15:27 +0200)
committerKarim Hamidou <khamidou@gmail.com>
Thu, 29 Sep 2011 13:27:50 +0000 (15:27 +0200)
players/jwplayer/popcorn.jwplayer.js

index 0c87c12f4eebaa501ae9b3b996d1337e6b575dea..00ba15e697c231692c0c580b6962f8e594b8c5c3 100644 (file)
@@ -59,15 +59,17 @@ Popcorn.player( "jwplayer", {
  
     Popcorn.player.defineProperty( media, "muted", {   
         set: function( val ) {
-        if ( jwplayer( container.id ).getMute() !== val ) {
-          if ( val ) {
-            jwplayer( container.id ).setMute(true);
+          if ( jwplayer( container.id ).getMute() !== val ) {
+            if ( val ) {
+              jwplayer( container.id ).setMute(true);
+            } else {
+              jwplayer( container.id ).setMute(false);
+            }
+
+            media.dispatchEvent( "volumechange" );
           }
-
-          media.dispatchEvent( "volumechange" );
-        }
-        
-        return jwplayer( container.id ).getMute();
+          
+          return jwplayer( container.id ).getMute();
         },
         get: function() {
           return jwplayer( container.id ).getMute();
@@ -79,15 +81,15 @@ Popcorn.player( "jwplayer", {
       set: function( val ) {
 
         if ( jwplayer( container.id ).getVolume() !== val *100 ) {
-        jwplayer( container.id ).setVolume( val * 100);
-        media.dispatchEvent( "volumechange" );
+          jwplayer( container.id ).setVolume( val * 100);
+          media.dispatchEvent( "volumechange" );
         }
-
+        
         return (jwplayer( container.id ).getVolume()) / 100;
       },
       
       get: function() {
-        return jwplayer( container.id ).percentage / 100;
+        return jwplayer( container.id ).getVolume() / 100;
       }
     });