title: Save / export webm videos to app directory from JavaScript in Shiny
body: <p>I have integrated a webcam video capture into a Shiny app using RecordRTC and JavaScript. That works great and I can access and store my videos in a JavaScript variable named "video.blob". However, I struggle with exporting that file into my app's shiny directory upon pressing a "btn-save-recording" button.</p>
  
  <p>I have tried to pass the blob to shiny as suggested here: <a href="https://shiny.rstudio.com/articles/communicating-with-js.html" rel="nofollow noreferrer">https://shiny.rstudio.com/articles/communicating-with-js.html</a></p>
  
  <pre><code>Shiny.setInputValue("videoObject", video.blob)
  </code></pre>
  
  <p>I also tried passing it to shiny as part of a form:</p>
  
  <pre><code>var formData = new FormData();
      formData.append('video', video.blob);
      Shiny.setInputValue("videoObject", formData)
  </code></pre>
  
  <p>However, I have so far neither been able to access the videoObject in Shiny nor to save it to the app directory.</p>
  
  <p>I also tried coding a solution in PHP as suggested here <a href="https://ourcodeworld.com/articles/read/671/how-to-record-a-video-with-audio-in-the-browser-with-javascript-webrtc" rel="nofollow noreferrer">https://ourcodeworld.com/articles/read/671/how-to-record-a-video-with-audio-in-the-browser-with-javascript-webrtc</a> and here <a href="https://stackoverflow.com/questions/31374084/local-store-video-webrtc">Local store video webRTC</a>. However, executing the PHP script returns a "400 Bad Request Error". I never used PHP before, so there is a good chance I did something wrong or PHP doesn't work on a Shiny server in the first place.</p>
  
  <p>I would greatly appreciate any information on</p>
  
  <ul>
  <li>How to save a webm video to my app directory from JavaScript on Shiny</li>
  <li>How to pass a webm video from JavaScript to Shiny such that I can work with it with libraries such as opencv, imager, or av. </li>
  <li>In case there is no easy way to accomplish the above I would appreciate some advice on what type of other server I should launch that would be able to receive my webm videos sent from JavaScript.</li>
  </ul>