collab-project / videojs-record

video.js plugin for recording audio/video/image files
https://collab-project.github.io/videojs-record
MIT License
1.39k stars 315 forks source link

Record new empty tab in Chrome macOS does not work #451

Open ganyuehn opened 4 years ago

ganyuehn commented 4 years ago

Description

When I record a chrome tab, the record blob is 0 in size, thus playback fails. It records normally if I choose current chrome tab as target though. It happened with the example also, both screen-audio and screen-only. I record the bug here: https://drive.google.com/open?id=1Tu0KQ0BrMC6VhK8g1LK71AuKyv0rihkt

Steps to reproduce

  1. In "Share your screen" permission modal, choose Chrome Tab
  2. Choose any tab other than the current (first) one
  3. Record and Stop

Results

Expected

Record succeed, video playbacks normally

Actual

Resulted record blob is 0 size, playback fails

Error output

VIDEOJS: Using video.js 7.6.6 with videojs-record 3.11.0 and recordrtc 5.5.9 RecordRTC.js:53 RecordRTC version: 5.5.9 RecordRTC.js:63 started recording video stream. RecordRTC.js:1057 Using recorderType: MediaStreamRecorder RecordRTC.js:2104 Passing following config over MediaRecorder API. Object RecordRTC.js:713 Recorder state changed: recording RecordRTC.js:103 Initialized recorderType: MediaStreamRecorder for output-type: video RecordRTC.js:129 Stopped recording video stream. RecordRTC.js:713 Recorder state changed: stopped RecordRTC.js:170 video/webm -> 0 Bytes audio-screen.html:73 screen+audio capture ready: Blob blob:https://collab-project.github.io/2a954a84-8743-4083-b6ad-1598222d870c:1 Failed to load resource: net::ERR_REQUEST_RANGE_NOT_SATISFIABLE video.min.js:12 VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) The media could not be loaded, either because the server or network failed or because the format is not supported. vt (anonymous) @ video.min.js:12 audio-screen.html:66 undefined

Additional Information

Please include any additional information necessary here. Including the following:

versions

videojs

video.js 7.6.6 with videojs-record 3.11.0 and recordrtc 5.5.9

browsers

Chrome Version 80.0.3987.132 (Official Build) (64-bit)

OSes

macOS 10.15.3

thijstriemstra commented 4 years ago

Tested with Chrome 80 (both normal and incognito mode) on macOS 10.15.4.

This is entire screen:

Screenshot 2020-04-13 at 20 36 09

Current tab:

Screenshot 2020-04-13 at 20 38 08

And random window:

Screenshot 2020-04-13 at 20 39 44
thijstriemstra commented 4 years ago

But testing with an empty tab (!) reproduces the issue:

Screenshot 2020-04-13 at 20 43 00
thijstriemstra commented 4 years ago

I'm eager to call this a browser bug but I'll see if it can be reproduced without videojs-record.

thijstriemstra commented 4 years ago

I was able to record an empty tab using https://webrtc.github.io/samples/src/content/getusermedia/getdisplaymedia/

thijstriemstra commented 4 years ago

I was also able to record it using videojs-record but with a 'workaround', move the mouse around in the new empty browser tab during recording and the blob size will not be 0 anymore.

Screenshot 2020-04-13 at 21 10 44
ganyuehn commented 4 years ago

It seems that MediaRecorder will not start capturing record data from stream until it detects there's "movement" on the tab being recorded. I test with recording a still tab and set up with timeSlice of 10 and there's no dataavailable event triggered. Until I start moving the cursor, a blob size of 1 will return from dataavailable event. WebRTC example works because it starts recording as soon as the button is clicked, so it captures the movement of the browser tab jumping a bit due to the sharing screen bar's display.

thijstriemstra commented 4 years ago

It seems that MediaRecorder will not start capturing record data from stream until it detects there's "movement" on the tab being recorded.

Should this be considered a browser bug (since it's not an issue in firefox) and should a bug be filed for Chrome browser?

thijstriemstra commented 3 years ago

Should this be considered a browser bug (since it's not an issue in firefox) and should a bug be filed for Chrome browser?

See https://bugs.chromium.org/p/chromium/issues/detail?id=1100746

"Chromium is attaching some form of user activation algorithm to the getDisplayMedia() implementation, though no such restriction appear in the Screen Capture specification - or AFAICT are even specified at all"