0

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
Dom
  • 404
  • 6
  • 12

1 Answers1

0

any one still trying to figure out this, u can refer this link

How to pass blob url to rails create method by ajax

mediaRecorder.onstop = (ev) ->
        blob = new Blob(chunks, 'type': 'video/mp4;')
        chunks = []
        videoURL = window.URL.createObjectURL(blob)
        vidSave.src = videoURL

        formData = new FormData
        formData.append('testqwe[attr]', blob);

        $.ajax
          type: 'POST'
          url: '/test'
          processData: false
          contentType: false
          data: formData
        return

Send and save the audio/video data as a file

Dom
  • 404
  • 6
  • 12