           console.log pos,size
           if pos==size
             console.log 'downloaded'
-            @convertToGif.apply @,[ytid]
+            @insertVideo.apply @,[savePath]
         video.pipe fs.createWriteStream(savePath)
       else
-        @convertToGif ytid
+        @insertVideo savePath
     else
       @removeVideo()
 

        console.log error

      if not alreadyExists
        video = youtubedl url,['--format=webm'],{ cwd: __dirname }
        size = 0
        video.on 'info', (info)->
          console.log 'Download started'
          console.log 'filename: ' + info._filename
          console.log 'size: ' + info.size
          size = info.size
        pos=0
        video.on 'data', (data) =>

    .replace(/>/g, "&gt;")
    .replace(/"/g, "&quot;")
    .replace(/'/g, "&#039;")

blobToBase64 = (blob, cb) ->
  reader = new FileReader()
  reader.onload = ->
    dataUrl = reader.result
    base64 = dataUrl.split(',')[1]
    cb(base64)
  reader.readAsDataURL(blob)




planeInitialCss =
  "position:absolute;
