src/js/pop.js
branchpopcorn-port
changeset 839 4357aac4eb19
parent 785 980163a156d1
child 841 8da49ff273e0
--- a/src/js/pop.js	Mon Mar 26 19:18:04 2012 +0200
+++ b/src/js/pop.js	Wed Mar 28 17:37:49 2012 +0200
@@ -144,6 +144,22 @@
   }
 };
 
+IriSP.PopcornReplacement.player.prototype.volume = function(val) {
+    if (typeof this.playerFns.getVolume == "undefined" || typeof this.playerFns.setVolume == "undefined") {
+        return false;
+    }
+    var _vol = this.playerFns.getVolume();
+    if (typeof(val) !== "undefined" && parseFloat(val) !== NaN) {
+        val = Math.max(0, Math.min(1, val));
+        if (parseFloat(val) != parseFloat(_vol)) {
+            this.playerFns.setVolume(val);
+            this.trigger("volumechange");
+            _vol = this.playerFns.getVolume();
+        }
+    }
+    return _vol;
+};
+
 IriSP.PopcornReplacement.player.prototype.mute = IriSP.PopcornReplacement.player.prototype.muted;
 
 IriSP.PopcornReplacement.player.prototype.code = function(options) {