•  


feat: add webContents.getMediaSourceId() method by mitchemmc · Pull Request #31204 · electron/electron · GitHub
Skip to content
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

feat: add webContents.getMediaSourceId() method #31204

Merged
merged 5 commits into from
Oct 26, 2021

Conversation

mitchemmc
Copy link
Contributor

Description of Change

New feature: add webContents.getMediaSourceId() to provide a way to get a MediaStream from a WebContents using getUserMedia.

This aims to fix the issues from #22701 which was removed with #25414 .

The first main issue was with claiming to be available in both the renderer and main process but only working in the renderer.

This is fixed here by moving the api from the DesktopCapturer to a method on a WebContents. This means the API can only be consumed in the main process but I think this is inline with restricting the access for the DesktopCapturer to the main process in v17.

The next issue was with the lack of access control to the caller.

This is fixed here by requiring the user of the api to pass in the web contents that the media source ID will be registered to.
This allows you to restrict access to only the web contents you trust.

Checklist

Release Notes

Notes: Added webContents.getMediaSourceId() , can be used with getUserMedia to get a stream for a WebContents .

@welcome
Copy link

welcome bot commented Sep 30, 2021

?? Thanks for opening this pull request! ??

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style .
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide .
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@electron-cation electron-cation bot added the new-pr ?? PR opened in the last 24 hours label Sep 30, 2021
@jkleinsc jkleinsc added the semver/minor backwards-compatible functionality label Sep 30, 2021
Copy link
Member

@zcbenz zcbenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more .

API looks good to me.

shell/browser/api/electron_api_web_contents.cc Outdated Show resolved Hide resolved
shell/browser/api/electron_api_web_contents.cc Outdated Show resolved Hide resolved
shell/browser/api/electron_api_web_contents.h Outdated Show resolved Hide resolved
Copy link
Member

@zcbenz zcbenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more .

Other than the minor stylish thing the code looks good to me.

shell/browser/api/electron_api_web_contents.cc Outdated Show resolved Hide resolved
shell/browser/api/electron_api_web_contents.cc Outdated Show resolved Hide resolved
docs/api/web-contents.md Outdated Show resolved Hide resolved
@vapormusic
Copy link

bump

@jkleinsc
Copy link
Contributor

API LGTM

@welcome
Copy link

welcome bot commented Oct 26, 2021

Congrats on merging your first pull request! ??????

@release-clerk
Copy link

Release Notes Persisted

Added webContents.getMediaSourceId() , can be used with getUserMedia to get a stream for a WebContents .

t57ser pushed a commit to t57ser/electron that referenced this pull request Oct 27, 2021
* feat: add webContents.getMediaSourceId() method

* fix: account for null frame_hosts in webContents.getMediaSourceId()

* fix: move webContents.getMediaSourceId definition to be more organised

* fix: move webContents.getMediaSourceId implementation

* fix: move webContents.getMediaSourceId docs
t57ser pushed a commit to t57ser/electron that referenced this pull request Oct 27, 2021
* feat: add webContents.getMediaSourceId() method

* fix: account for null frame_hosts in webContents.getMediaSourceId()

* fix: move webContents.getMediaSourceId definition to be more organised

* fix: move webContents.getMediaSourceId implementation

* fix: move webContents.getMediaSourceId docs
t57ser pushed a commit to t57ser/electron that referenced this pull request Oct 29, 2021
* feat: add webContents.getMediaSourceId() method

* fix: account for null frame_hosts in webContents.getMediaSourceId()

* fix: move webContents.getMediaSourceId definition to be more organised

* fix: move webContents.getMediaSourceId implementation

* fix: move webContents.getMediaSourceId docs
t57ser pushed a commit to t57ser/electron that referenced this pull request Oct 29, 2021
* feat: add webContents.getMediaSourceId() method

* fix: account for null frame_hosts in webContents.getMediaSourceId()

* fix: move webContents.getMediaSourceId definition to be more organised

* fix: move webContents.getMediaSourceId implementation

* fix: move webContents.getMediaSourceId docs
t57ser pushed a commit to t57ser/electron that referenced this pull request Oct 29, 2021
* feat: add webContents.getMediaSourceId() method

* fix: account for null frame_hosts in webContents.getMediaSourceId()

* fix: move webContents.getMediaSourceId definition to be more organised

* fix: move webContents.getMediaSourceId implementation

* fix: move webContents.getMediaSourceId docs
t57ser pushed a commit to t57ser/electron that referenced this pull request Oct 29, 2021
* feat: add webContents.getMediaSourceId() method

* fix: account for null frame_hosts in webContents.getMediaSourceId()

* fix: move webContents.getMediaSourceId definition to be more organised

* fix: move webContents.getMediaSourceId implementation

* fix: move webContents.getMediaSourceId docs
Sign up for free to join this conversation on GitHub . Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants
- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본