diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-06-24 16:04:19 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-06-24 16:04:19 -0400 |
| commit | 1b69dbd0897b21e9613c08811da5ca8e4c863cfa (patch) | |
| tree | d87afa6d0cb121166450da0d6bcb8b7df7dd1808 /public/assets/javascripts/mx/primitives/mx.video.js | |
| parent | d52c037ab7e01660a85363a2941052e4d4b8cf03 (diff) | |
putting mp4/webm videos on walls
Diffstat (limited to 'public/assets/javascripts/mx/primitives/mx.video.js')
| -rw-r--r-- | public/assets/javascripts/mx/primitives/mx.video.js | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/public/assets/javascripts/mx/primitives/mx.video.js b/public/assets/javascripts/mx/primitives/mx.video.js index c9ec339..b2727c0 100644 --- a/public/assets/javascripts/mx/primitives/mx.video.js +++ b/public/assets/javascripts/mx/primitives/mx.video.js @@ -4,11 +4,14 @@ MX.Video = MX.Object3D.extend({ this.type = "Video" var layer = this - layer.width = 0 - layer.height = 0 + layer.width = ops.width + layer.height = ops.height layer.x = ops.x || 0 layer.y = ops.y || 0 layer.z = ops.z || 0 + layer.rotationX = ops.rotationX || 0 + layer.rotationY = ops.rotationY || 0 + layer.rotationZ = ops.rotationZ || 0 layer.scale = ops.scale || 1 layer.backface = ops.backface || false layer.media = ops.media @@ -30,15 +33,22 @@ MX.Video = MX.Object3D.extend({ loadVideo: function(ops){ var layer = this - layer.ops = defaults(ops, layer.ops) var video = document.createElement('video') video.addEventListener("loadedmetadata", function(){ - // - video.play() + if (ops.autoplay) { + video.play() + } + else { + video.currentTime = video.duration / 3 + } }) + video.width = layer.width + video.height = layer.height video.src = ops.src video.load() + + this.el.appendChild(video) }, move: function(ops){ @@ -49,11 +59,6 @@ MX.Video = MX.Object3D.extend({ } layer.dirty = true layer.update() - }, - - toString: function(){ - var params = "id src width height depth x y z rotationX rotationY rotationZ scale".split(" ") - return this.__toString(params) - }, + } }) |
