question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upload isn't Working

See original GitHub issue

Hi I tried to upload using the explaination and simple file example everything works fine in console but i can’t find the uploaded file Here is my script :

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Audio/Video Example - Record Plugin for Video.js</title>

  <link href="../node_modules/video.js/dist/video-js.min.css" rel="stylesheet">
  <link href="../dist/css/videojs.record.css" rel="stylesheet">

  <script src="../node_modules/video.js/dist/video.min.js"></script>
  <script src="../node_modules/recordrtc/RecordRTC.js"></script>
  <script src="../node_modules/webrtc-adapter/out/adapter.js"></script>

  <script src="../dist/videojs.record.js"></script>

  <style>
  /* change player background color */
  #myVideo {
      background-color: #9ab87a;
  }
  </style>
</head>
<body>

<video id="myVideo" class="video-js vjs-default-skin"></video>

<script>
var options = {
    controls: true,
    width: 640,
    height: 480,
    fluid: false,
    plugins: {
        record: {
            audio: true,
            video: true,
            maxLength: 1800,
            debug: true
        }
    }
};

var player = videojs('myVideo', options, function() {
    // print version information at startup
    var msg = 'Using video.js ' + videojs.VERSION +
        ' with videojs-record ' + videojs.getPluginVersion('record') +
        ' and recordrtc ' + RecordRTC.version;
    videojs.log(msg);
});

// error handling
player.on('deviceError', function() {
    console.log('device error:', player.deviceErrorCode);
});

player.on('error', function(error) {
    console.log('error:', error);
});

// user clicked the record button and started recording
player.on('startRecord', function() {
    console.log('started recording!');
});

// user completed recording and stream is available
player.on('finishRecord', function() {
    // the blob object contains the recorded data that
    // can be downloaded by the user, stored on server etc.
    console.log('finished recording: ', player.recordedData);
	    //player.record().saveAs({'video': 'my-video-file-name.webm'});
player.record().stopDevice();
    upload(player.recordedData);

});
function upload(blob) {

    var serverUrl = '/upload';
    var formData = new FormData();
    formData.append('file', blob, blob.name);
    console.log('upload recording ' + blob.name + ' to ' + serverUrl);
    // start upload
    fetch(serverUrl, {
        method: 'POST',
        body: formData
    }).then(
        success => console.log('upload recording complete.')
    ).catch(
        error => console.error('an upload error occurred!')
    );
}
</script>

</body>
</html>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:26 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
conan1987commented, Jan 5, 2019

it worked , thanks

0reactions
conan1987commented, Jan 5, 2019

ok that will be better , thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

File Upload not working, how do i fix this? - Microsoft Community
1) Reset the browsers in Windows Settings > Apps & Features > Browser > Advanced Options > Reset and Repair to see if...
Read more >
Common uploading errors - YouTube Help - Google Support
If you're having problems uploading your video, select the error message you're seeing and follow the troubleshooting steps to solve your issue.
Read more >
What is Wrong With a Computer When Your Pictures Won't ...
Many factors come into play when uploading photos to a website; ... If one type of uploader isn't working, see if the website...
Read more >
Troubleshooting file upload problems - UK Copyright Service
Make sure the file is not corrupted. · Copy the file to your home/desktop folder and upload from there. · Don't upload folders...
Read more >
[Solved] Google Drive not Uploading! [2021]
I. How To Solve Google Drive Not Uploading On Computer · 1. Storage Space · 2. Network Issues · 3. Browser Issues ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found