0

We are developing a web tool to record Videos of the users screen and webcam.
Some people recording large videos longer than an hour. By using the File System Access API (in Chrome and Edge on Windows), we want to backup the recording Video to a file in the host's file system in case the browser or pc crashes.
All this is working like expected except of one side effect while closing the WritableStream (WritableStream.close()). While closing the Stream the cursor shortly changes system wide to the windows "Working In Background" Cursor.

Working In Background Cursor Windows

Does anyone know if there is any solution to prevent Chrome/Edge/Chromium from changing the cursor? Because we are recording the user's screen a cursor change every few seconds is not acceptable.

Example code:

<body>
    <button onclick="selectDirectory()">Select Directory for Backup</button>

    <script>
        async function selectDirectory() {
            const dirHandle = await window.showDirectoryPicker();
            const fileHandle = await dirHandle.getFileHandle('backup.txt', { create: true });

            setInterval(async () => {
                const writable = await fileHandle.createWritable();
                await writable.write("Test");

                console.log('closing writeable...');
                await writable.close(); // at this point the cursor changes
            }, 1000);
        }
    </script>
</body>
KMathmann
  • 444
  • 3
  • 15
  • This doesn't reproduce on Chrome 95 on Mac with your sample code. An improvement would be to create the `writable` just once outside of the interval, and then close it once you're done (note that `write()` without further arguments always writes at the beginning of the file). Since it's essentially a `WritableStream`, you might also be able to `pipe()` to it as a further improvement. – DenverCoder9 Nov 09 '21 at 12:21
  • No, this is not an option, because first the close method writes the written content to the file. Before closing, the data is written to a swap file, at least on Windows. But we need to write to the file and not to a swapfile every x seconds to create a safe backup. And yes I know that this example always writes to the beginning of the file, it's just to keep it simple. – KMathmann Dec 07 '21 at 12:24

0 Answers0