muaz-khan / RecordRTC

RecordRTC is WebRTC JavaScript library for audio/video as well as screen activity recording. It supports Chrome, Firefox, Opera, Android, and Microsoft Edge. Platforms: Linux, Mac and Windows.
https://www.webrtc-experiment.com/RecordRTC/
MIT License
6.45k stars 1.75k forks source link

macOS safari :Unhandled Promise Rejection: AbortError: The operation was aborted. #843

Closed hktalent closed 1 year ago

hktalent commented 1 year ago

macOS:3.5 Beta safari:Version 16.6 (18615.3.9.11.3) if use:

var fnStartRct = function () {// https://recordrtc.org/
                var videoOnlyStream = new MediaStream();
                stream.getVideoTracks().forEach(function(track) {
                    videoOnlyStream.addTrack(track);
                });
                var recorder = RecordRTC(videoOnlyStream || stream || local_media, {
                    'type': 'video'
                    , 'mimeType': 'video/webm; codecs="vp9"' // codecs="av01.2.19H.12.0.000.09.16.09.1, flac"  vp9
                    ,disableLogs: true,
                    'video': local_media,
                    // both for audio and video tracks
                    bitsPerSecond: 128000
                    // used by MultiStreamRecorder - to access HTMLCanvasElement
                    // ,elementClass: 'multi-streams-mixer'
                    ,recorderType: !!navigator.mozGetUserMedia ? MediaStreamRecorder : WhammyRecorder
                });
                recorder.startRecording();
                //  10分钟,停一下,并上传,然后重新开始
                g_nTmxx9 = window.setTimeout(function () {
                    window.clearTimeout(g_nTmxx9);
                    if (recorder) recorder.stopRecording(function () {
                        try {
                            // local_media.src = audioVideoWebMURL; // https://github.com/absaravanan/js-video-recording-tool
                            // var bData = recorder.getBlob();
                            // URL.createObjectURL(recorder.getBlob())
                            recorder.getDataURL(function (videoDataURL) {
                                signaling_socket.emit('saveVideo', { type: recorder.getBlob().type || 'video/webm',"videoDataURL": videoDataURL});
                                recorder.destroy();
                                recorder = null;
                            });
                        } catch (e) {
                            alert(e)
                        }
                        nT090 = window.setTimeout(function () {
                            window.clearTimeout(nT090);
                            if (!g_bStopVd) fnStartRct();
                        }, 3);

                        // recorder.getDataURL(function (videoDataURL) {

                        // });
                    });
                }, 1 * 60 * 1000);
            };

error code:

recorderType: !!navigator.mozGetUserMedia ? MediaStreamRecorder : WhammyRecorder

I found that the error was caused by this industry

But if I remove the line changing code, then I won't be able to record the video anymore

hktalent commented 1 year ago

RecordRTC.js: 5.5.6