     @picture.setDomAttributes size
     @setSize size
 
+  unsetVideoStream: ->
+    video = @video.getElement()
+    video.pause()
+    KDWebcamView.setVideoStreamVendor video, ""
+    @localMediaStream?.stop()
+
   setVideoStream: (stream)->
     video = @video.getElement()
     KDWebcamView.setVideoStreamVendor video, stream

      @retake.show()
      @save.show()
      @takePicture()
      @button.setTitle options.snapTitle

  resetView: ->
    @button.show()

        @emit "save"

  attachEvents: ->

    {snapTitle} = @getOptions()

    @on "KDObjectWillBeDestroyed", => @unsetVideoStream()

    @on "viewAppended", =>
      @context = @picture.getElement().getContext "2d"
      @getUserMedia()
