Raw Source
kalpdev.1 / check rec

// ==UserScript==
// @name     check rec
// @namespace     kalpsdj
//@description    check rec
// @author        Shjaisw
// @license       MIT
// @version       1.5
// @updateURL https://openuserjs.org/meta/kalpdev.1/Language_Setup.meta.js
// @downloadURL https://openuserjs.org/install/kalpdev.1/Language_Setup.user.js
// @include  https://argus.aka.amazon.com/*
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @grant         GM_setValue
// @grant         GM_getValue
// ==/UserScript==



$("body").append ( `
    <div id="guide">
<style>
div#guide {padding: 4px;font-weight: bold;font-size:small; width:170px; height:28px; bottom:25px;  background-color:rgba(236, 199, 199, 0.12); color:red; padding:0;margin:0;border-radius:8px;position: fixed; bottom: 15%; right: 46%;z-index:10000; text-align:center;margin-top:40px; box-shadow: 4px 4px 8px  #00796b;" }

</style>
   <html>
<body>


<button id="start" >start  </button>
<button  id="stop" >stop </button>

<script>
let start = document.getElementById('start'),
    stop  = document.getElementById('stop'),
    mediaRecorder;

start.addEventListener('click', async function(){
    let stream = await recordScreen();
    let mimeType = 'video/webm';
    mediaRecorder = createRecorder(stream, mimeType);
  let node = document.createElement("p");
    node.textContent = "Started recording";
    document.body.appendChild(node);
})

stop.addEventListener('click', function(){
    mediaRecorder.stop();
    let node = document.createElement("p");
    node.textContent = "Stopped recording";
    document.body.appendChild(node);
})

async function recordScreen() {
    return await navigator.mediaDevices.getDisplayMedia({
        audio: false,
        video: { mediaSource: "screen"}
    });
}

function createRecorder (stream, mimeType) {
  // the stream data is stored in this array
  let recordedChunks = [];

  const mediaRecorder = new MediaRecorder(stream);

  mediaRecorder.ondataavailable = function (e) {
    if (e.data.size > 0) {
      recordedChunks.push(e.data);
    }
  };
  mediaRecorder.onstop = function () {
     saveFile(recordedChunks);
     recordedChunks = [];
  };
  mediaRecorder.start(200); // For every 200ms the stream data will be stored in a separate chunk.
  return mediaRecorder;
}

function saveFile(recordedChunks){

   const blob = new Blob(recordedChunks, {
      type: 'video/webm'
    });
    let filename = window.prompt('Enter file name'),
        downloadLink = document.createElement('a');
    downloadLink.href = URL.createObjectURL(blob);
    downloadLink.download = '${'filename'}.webm';

    document.body.appendChild(downloadLink);
    downloadLink.click();
    URL.revokeObjectURL(blob); // clear from memory
    document.body.removeChild(downloadLink);
}
</script>

</body>
</html>



` );