summaryrefslogtreecommitdiff
path: root/site/public/assets/javascripts/mx/primitives/mx.vimeo.js
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2016-09-02 13:31:36 -0400
committerJules Laplace <jules@okfoc.us>2016-09-02 13:31:36 -0400
commitde8b6ffa3c686256030df04a6dd56025fe6de8ac (patch)
tree6e0f954f151060ccba3441e03409557f674e54c3 /site/public/assets/javascripts/mx/primitives/mx.vimeo.js
parent98bb711e716b4e9770aa7299b43f630fb7262acc (diff)
remove 2h site and bump to 0.1.40v0.1.40
Diffstat (limited to 'site/public/assets/javascripts/mx/primitives/mx.vimeo.js')
-rw-r--r--site/public/assets/javascripts/mx/primitives/mx.vimeo.js162
1 files changed, 0 insertions, 162 deletions
diff --git a/site/public/assets/javascripts/mx/primitives/mx.vimeo.js b/site/public/assets/javascripts/mx/primitives/mx.vimeo.js
deleted file mode 100644
index fe5ce86..0000000
--- a/site/public/assets/javascripts/mx/primitives/mx.vimeo.js
+++ /dev/null
@@ -1,162 +0,0 @@
-MX.Vimeo = MX.Object3D.extend({
-
- init: function (ops) {
-
- this.type = "Vimeo"
-
- this.media = ops.media
- this.width = ops.media.width
- this.height = ops.media.height
- this.x = ops.x || 0
- this.y = ops.y || 0
- this.z = ops.z || 0
- this.rotationX = ops.rotationX || 0
- this.rotationY = ops.rotationY || 0
- this.rotationZ = ops.rotationZ || 0
- this.scale = ops.scale || 1
- this.backface = ops.backface || false
-
- ops.className && this.el.classList.add(ops.className)
- this.backface && this.el.classList.add("backface-visible")
- this.el.classList.add("video")
- this.el.classList.add("mx-scenery")
- this.paused = !! this.media.autoplay
- this.muted = app.muted || !! this.media.mute
- this.started = false
- },
-
- load: function (ops) {
- var uid = 'player-' + Uid ()
- var loop = this.media.loop ? 'loop=1' : ""
- var preload = document.createElement("iframe")
- preload.id = uid
- preload.setAttribute("src", "//player.vimeo.com/video/" + this.media.token + "?api=1&badge=0&controls=0branding=0&byline=0&portrait=0&title=0&" + loop + "&player_id=" + uid)
- preload.style.backgroundImage = "url(" + this.media.thumbnail + ")"
- preload.style.width = "100%"
- preload.style.height = "100%"
- preload.style.border = "0"
- preload.style.pointerEvents = "none"
- preload.className = "preload"
- this.el.appendChild(preload)
- this.player = $f(preload)
-
- this.player.addEvent('ready', $.proxy(this.ready, this))
- },
-
- ready: function(){
- console.log("vimeo ready")
-
- this.started = true
-
- // wait until ready before binding events. other events: play, pause
- this.player.addEvent('play', $.proxy(this.onPlay, this))
- this.player.addEvent('pause', $.proxy(this.onPause, this))
- this.player.addEvent('finish', $.proxy(this.finished, this))
-
- // this is async on vimeo so call it asap
- this.player.api('getDuration', $.proxy(function(n){
- console.log("vimeo duration", n)
- this.player.duration = n
- }, this))
-
- if (this.media.mute) {
- this.mute()
- }
- else {
- this.unmute()
- }
-
- this.seek( this.media.keyframe || 0 )
-
- if (this.media.autoplay) {
- this.play()
- }
- else {
- this.pause()
- }
- },
-
- error: function(err){
- console.log("vimeo error", err)
- },
-
- play: function(){
- this.paused = false
- this.player.api('play')
- },
-
- pause: function(){
- this.paused = true
- this.player.api('pause')
- },
-
- seek: function(n){
- // defer seek until we have duration
- if (! this.duration()) {
- setTimeout($.proxy(function(){
- this.seek(n)
- }, this), 300)
- return
- }
-
- if (! this.started || n === 0) {
- return
- }
-
- if (n < 1) {
- n = n * this.duration()
- }
- this.player.api('seekTo', max(0, n-1))
- if (this.paused) {
- this.paused = false
- this.play()
- this.pause()
- setTimeout($.proxy(function(){
- this.pause()
- }, this), 100)
- }
- },
-
- duration: function(){
- return this.player.duration
- },
-
- mute: function(){
- this.player.api('setVolume', 0.0)
- this.muted = true
- },
-
- unmute: function(){
- this.player.api('setVolume', 0.8)
- this.muted = false
- },
-
- setLoop: function(state){
- this.media.loop = state
- this.player.api('setLoop', state)
- },
-
- onPlay: function(){
- if (this.paused) {
- this.pause()
- }
- },
-
- onPause: function(){
- if (! this.paused) {
- this.play()
- }
- },
-
- finished: function(){
-// if (this.media.loop) {
-// this.seek(0)
-// this.play()
-// }
-// else if (this.bound) {
- if (! this.media.loop && this.bound) {
- $(".playButton").removeClass('playing')
- }
- }
-
-})