-
Notifications
You must be signed in to change notification settings - Fork 147
Description
No matter what php and javascript I use, nothing seems to work? I cannot upload the webm to the server?
save.php
`<?php
foreach(array('video', 'audio') as $type) {
if (isset(
echo 'uploads/';
$fileName = $_POST["${type}-filename"];
$uploadDirectory = 'uploads/'.$fileName;
if (!move_uploaded_file($_FILES["${type}-blob"]["tmp_name"], $uploadDirectory)) {
echo(" problem moving uploaded file");
}
echo($fileName);
}
}
?>
JavaScript code
var fileType = 'video'; // or "audio"
var fileName = 'ABCDEF.webm'; // or "wav"
var formData = new FormData();
formData.append(fileType + '-filename', fileName);
formData.append(fileType + '-blob', blob);
xhr('save.php', formData, function (fName) {
window.open(location.href + fName);
});
function xhr(url, data, callback) {
var request = new XMLHttpRequest();
request.onreadystatechange = function () {
if (request.readyState == 4 && request.status == 200) {
callback(location.href + request.responseText);
}
};
request.open('POST', url);
request.send(data);
}`
And my dev console has this:
RecordRTC version: 5.5.9
17:38:51.966 RecordRTC.js:63 started recording video stream.
17:38:51.967 RecordRTC.js:1057 Using recorderType: MediaStreamRecorder
17:38:51.968 RecordRTC.js:2104 Passing following config over MediaRecorder API. {type: "video", mimeType: "video/webm", checkForInactiveTracks: false, initCallback: ƒ}
17:38:51.969 RecordRTC.js:713 Recorder state changed: recording
17:38:51.969 RecordRTC.js:103 Initialized recorderType: MediaStreamRecorder for output-type: video
17:38:53.519 RecordRTC.js:129 Stopped recording video stream.
17:38:53.520 RecordRTC.js:713 Recorder state changed: stopped
17:38:53.522 RecordRTC.js:170 video/x-matroska;codecs=avc1,opus -> 121 KB
17:38:53.523 (index):347 POST url = save.php
17:38:53.696 (index):348 XHR finished loading: POST "https://bcast.mydomain.us/save.php".
xhr @ (index):348
(anonymous) @ (index):335
_callback @ RecordRTC.js:181
mediaRecorder.ondataavailable @ RecordRTC.js:2184
I get nothing in the uploads folder.
ideas?