jeudi 14 mars 2019

how to save a blob file using carrierwave in rails

So i have a requirement where i record a video and save it in the database, the recording of the video is working fine, only thing is it generates a blob file, then i use js to send the blob file to the server. This are my params

{"testqwe"=>{"attr"=>"blob:http://localhost:3000/6f12f123-b1d0-7bfc-6b15-d3b54341946"}, "controller"=>"myControler", "action"=>"test"}

i have an uploader in place , but it does not save anything.

so how can i save this using carierwave to my database?

here is my javascript

mediaRecorder.onstop = (ev) ->
        blob = new Blob(chunks, 'type': 'video/mp4;')
        chunks = []
        videoURL = window.URL.createObjectURL(blob)
        vidSave.src = videoURL
        $.ajax
          type: 'POST'
          content_type: "video/webm"
          url: '/test'
          enctype: "multipart/form-data"
          data: testqwe: attr: videoURL
        return

Aucun commentaire:

Enregistrer un commentaire