-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
restrictions on chrome.tabCapture.captureOffscreenTab() #6900
Comments
Will look to fix this. Regarding the workaround, you can make a remote page trusted and node.js enabled with the |
Thanks! I will look into your proposal - meanwhile, I found a way of fixing the black bars with the "hidden" window approach and will update the workaround in the original post. |
This is fixed in git and will be available in the next nightly build. |
Thanks for the blazing fast fix! Looking forward to testing it! |
One thing I noticed is that you have to explicitly get and use the chrome-extension:// URL - would it be possible to implement that passing a relative URL will automatically be handled? |
Will look into it. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Using the latest 0.51.0 (and at least with 0.50.3 also), captureOffscreenTab() seems to have stopped working completely:
results in I tried remote addresses, local URLs as well... |
Now (0.57.0) it looks like there is no |
@mcpiroman upstream removed this feature in recent releases: https://chromium-review.googlesource.com/c/chromium/src/+/3059531 |
NWJS Version : 0.35.2
Operating System : Win64 (but supposedly applies to all systems)
Expected behavior
Should result in
stream
being aMediaStream
object, regardless of whether thestart_url
(first argument ofcaptureOffscreenTab
) is an http(s)/data protocol URL or a relative URL in the nwjs app's scope (or using a chrome-extension protocol URL).Actual behavior
stream
isundefined
and checking themessage
inchrome.runtime.lastError
, it states"Invalid/Missing/Malformatted starting URL for off-screen tab."
This is due to restrictions in Chromium's/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
, which should not be applied to nwjs context.How to reproduce
Try to capture a page ("render.html" in these code examples) in the nwjs app's context as a hidden tab - see code above.
Temporary workaround(s)
I managed to circumvent this issue by serving the file(s) I need in the hidden tab as http via the
connect
andserve-static
packages (let's say on port 3000) and then loading'http://localhost:3000/render.html'
. But of course this leads to not being able to use node/nwjs API calls directly in the page's scripts, no direct communication between the tab and the rest of the app (or having to workaround that by using ajax to access an intermediary file) and other restrictions (mixed-content problems would have to be handled by serving as https and potentially handling certificate problems... etc,).Another makeshift solutionis to open the page to render in a separate window and hiding this with a mixture of options and a
minimize()
call:This results in the popup flickering shortly when starting up the application, but interaction between the page and the rest of the app is possible without restrictions.
However, there are small black bars on top and bottom of the rendered output that I can't get rid of so far, and(I fixed the black bars by setting the width and hight specificly before minimizing the window in the callback.) I think the performance is a bit worse than thecaptureOffscreenTab()
solution.The text was updated successfully, but these errors were encountered: