     element: deserializer.getElement()
     range: deserializer.getRange()
 
-  updateFrame: ->
+  updateFrame: =>
     @frame.style.height = 0
     @frame.style.height = @body.scrollHeight + "px"
     @frame.focus()
+    @frame.contentWindow.focus()
 
   clear = (element) ->
     element.removeChild(element.lastChild) while element.lastChild

    @frame.style.border = "none"
    @frame.style.width = "100%"
    @frame.onload = @frameDidLoadDefaultDocument

    bottomContainer = document.createElement("div")


  frameDidLoadStylesheet: =>
    @updateFrame()

  frameDidLoseFocus: =>
    if @element.classList.contains(@constructor.playingClassName)
      requestAnimationFrame(@updateFrame)

  didClickPlayButton: =>
    @delegate?.playerViewDidClickPlayButton?()

