Native html5 player help with Upload

  You are currently not logged in. You can view the forums, but cannot post messages. Log In | Register

04-Nov-17 10:34
Native html5 video player starts, stops & records successfully, but need help with Upload.
This web video player starts, stops, records and plays back successfully, but the Upload portion needs help. Although the console shows "Success", no file actually arrives. Any guidance/suggestion/remedy to get the recorded video to Upload to a folder, will be welcomed. Thanks.

<button class="start" disabled>Start</button>
<button class="stop" disabled>Stop</button>
<button class="reset" disabled>Reset</button>
<button class="upload" onclick="InitUploading()" disabled>Upload</button>


const video = document.querySelector('video')
const start = document.querySelector('.start')
const stop = document.querySelector('.stop')

const initRecorder = stream => {

const recorder = new MediaRecorder(stream)

video.srcObject = stream

video.addEventListener('loadedmetadata', () => {

recorder.addEventListener('dataavailable', ({ data }) => {
video.srcObject = null
video.src = URL.createObjectURL(data)

start.addEventListener('click', () => {

stop.addEventListener('click', () => {

// Upload the video blob as form data

upload.addEventListener('click', () => {
const body = new FormData()

body.append('myvideo', blob)

fetch('upload.php', { method: 'POST', body })
.then(() => console.log('Success!'))



.getUserMedia({ video: true })

Here's the upload.php file:

Here's the upload.php file:

foreach(array('video', 'audio') as $type) {
if (isset($_FILES["${type}-blob"])) {

//echo 'uploadWC/';

$fileName = $_POST["${type}-filename"];
$uploadDirectory = 'uploadWC/'.$fileName;

if (!move_uploaded_file($_FILES["${type}-blob"]["tmp_name"], $uploadDirectory)) {
echo(" problem moving uploaded file");

05-Nov-17 18:59

$uploadDirectory = 'uploadWC/'.$fileName;

After that operation $uploadDirectory is no longer a directory, so saving files to that path WILL fail.

So long, and thanks for all the fish.

New posts
Old posts

Follow Elated