Sfoglia il codice sorgente

add audio play/stop/pause methods

Nikolay Suslov 7 anni fa
parent
commit
45d0262517

+ 0 - 2
support/client/lib/vwf/model/aframe.js

@@ -892,8 +892,6 @@ define(["module", "vwf/model", "vwf/utility"], function (module, model, utility)
                         case "itemSrc":
                             value = aframeObject.getAttribute('src');
                         break;
-
-                      
                     }
                 }
 

+ 54 - 0
support/client/lib/vwf/view/aframeComponent.js

@@ -138,8 +138,62 @@ define(["module", "vwf/view"], function (module, view) {
 
             lerpTick ();
 
+        },
+
+
+        gotProperty: function (nodeId, propertyName, propertyValue) {
+            var selfs = this;
+
+            var node = this.state.nodes[nodeId];
+
+            if (!(node && node.aframeObj)) {
+                return;
+            }
+
+
+            // if (this.nodes[nodeId].extends == "http://vwf.example.com/aframe/a-sound-component.vwf"){
+            //     if (propertyName == "currentTime"){
+            //         console.log(node.aframeObj.el.components.sound.listener.context.currentTime);
+            //     }
+            // }
+
+        },
+
+        calledMethod: function( nodeID, methodName, methodParameters, methodValue ) {
+
+            var node = this.state.nodes[nodeID];
+
+            if (!(node && node.aframeObj)) {
+                return;
+            }
+
+       
+            if (this.nodes[nodeID].extends == "http://vwf.example.com/aframe/a-sound-component.vwf"){
+                if (methodName == "stopSound"){
+
+                    console.log("stop sound");
+                    node.aframeObj.el.components.sound.stopSound();
+                    //node.aframeObj.stopSound();
+                }
+
+                if (methodName == "playSound"){
+
+                    console.log("play sound");
+                    node.aframeObj.el.components.sound.playSound();
+                    //node.aframeObj.stopSound();
+                }
+
+                if (methodName == "pauseSound"){
+
+                    console.log("pause sound");
+                    node.aframeObj.el.components.sound.pauseSound();
+                    //node.aframeObj.stopSound();
+                }
+            }
+
         }
 
+
     });
 
     function lerpTick () {

+ 3 - 0
support/proxy/vwf.example.com/aframe/a-sound-component.vwf.yaml

@@ -14,6 +14,9 @@ properties:
   src:
   volume:
 methods:
+  stopSound:
+  playSound:
+  pauseSound:
   refreshSrc:
     parameters:
       - srcID