Skip to content
Permalink
Browse files

Add VideoLayer

  • Loading branch information...
koenbok committed Jul 22, 2014
1 parent d14e883 commit f65e89dd4716ceac09e33e8a4d0c4943d49bf493
Showing with 33 additions and 0 deletions.
  1. +1 −0 framer/Framer.coffee
  2. +24 −0 framer/VideoLayer.coffee
  3. +8 −0 test/tests/VideoLayerTest.coffee
@@ -8,6 +8,7 @@ Framer.Utils = (require "./Utils")
Framer.Frame = (require "./Frame").Frame
Framer.Layer = (require "./Layer").Layer
Framer.BackgroundLayer = (require "./BackgroundLayer").BackgroundLayer
Framer.VideoLayer = (require "./VideoLayer").VideoLayer
Framer.Events = (require "./Events").Events
Framer.Animation = (require "./Animation").Animation
Framer.Screen = (require "./Screen").Screen
@@ -0,0 +1,24 @@
{Layer} = require "./Layer"

class exports.VideoLayer extends Layer

constructor: (options={}) ->

super options

@player = document.createElement("video")
@player.style.width = "100%"
@player.style.height = "100%"

# Make it work with .on and .off
# https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events
@player.on = @player.addEventListener
@player.off = @player.removeEventListener

@video = options.video

@_element.appendChild(@player)

@define "video",
get: -> @player.src
set: (video) -> @player.src = video
@@ -0,0 +1,8 @@
describe "VideoLayer", ->

describe "Defaults", ->

it "should create video", ->

videoLayer = new VideoLayer video:"static/test.mp4"
videoLayer._element.innerHTML.should.equal '<video src="static/test.mp4" style="width: 100%; height: 100%;"></video>'

0 comments on commit f65e89d

Please sign in to comment.
You can’t perform that action at this time.