From acad1409090dfd84c315da43ef1b78b18fa19fba Mon Sep 17 00:00:00 2001 From: Chris Mills Date: Wed, 27 Nov 2024 17:49:33 +0000 Subject: [PATCH] Add DOM examples for Screen Capture API (#285) * Add DOM examples for Screen Capture API * Update screen-capture-api/README.md Co-authored-by: Brian Smith * Update screen-capture-api/README.md Co-authored-by: Brian Smith * Fixes for bsmth review comments --------- Co-authored-by: Brian Smith --- README.md | 2 + screen-capture-api/README.md | 5 ++ .../basic-screen-capture/index.css | 45 ++++++++++++ .../basic-screen-capture/index.html | 36 ++++++++++ .../basic-screen-capture/index.js | 63 ++++++++++++++++ screen-capture-api/element-capture/index.css | 53 ++++++++++++++ screen-capture-api/element-capture/index.html | 37 ++++++++++ screen-capture-api/element-capture/index.js | 72 +++++++++++++++++++ screen-capture-api/region-capture/index.css | 45 ++++++++++++ screen-capture-api/region-capture/index.html | 37 ++++++++++ screen-capture-api/region-capture/index.js | 72 +++++++++++++++++++ 11 files changed, 467 insertions(+) create mode 100644 screen-capture-api/README.md create mode 100644 screen-capture-api/basic-screen-capture/index.css create mode 100644 screen-capture-api/basic-screen-capture/index.html create mode 100644 screen-capture-api/basic-screen-capture/index.js create mode 100644 screen-capture-api/element-capture/index.css create mode 100644 screen-capture-api/element-capture/index.html create mode 100644 screen-capture-api/element-capture/index.js create mode 100644 screen-capture-api/region-capture/index.css create mode 100644 screen-capture-api/region-capture/index.html create mode 100644 screen-capture-api/region-capture/index.js diff --git a/README.md b/README.md index 8b4d72c7..3a565d47 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,8 @@ Code examples that accompany various MDN DOM and Web API documentation pages. - The "resize-event" directory contains a basic demo to show how you can use the [resize event](https://developer.mozilla.org/docs/Web/API/Window/resize_event). Resize the browser window either by height or width to see the size of your current window. [Run the demo live](https://mdn.github.io/dom-examples/resize-event). +- The "screen-capture-api" directory contains demos to show typical usage of the [Screen Capture API](https://developer.mozilla.org/docs/Web/API/Screen_Capture_API) and [Screen Capture Extensions](https://developer.mozilla.org/docs/Web/API/Screen_Capture_extensions). + - The "screenleft-screentop" directory contains a demo to show how you could use the [Window.screenLeft](https://developer.mozilla.org/docs/Web/API/Window/screenLeft) and [Window.screenTop](https://developer.mozilla.org/docs/Web/API/Window/screenTop) properties to draw a circle on a canvas that always stays in the same physical place on the screen when you move your browser window. [Run the demo live](https://mdn.github.io/dom-examples/screenleft-screentop/). - The "scrolltooptions" directory contains a demo to show how you could use the [ScrollToOptions](https://developer.mozilla.org/docs/Web/API/ScrollToOptions) dictionary along with the [Window.ScrollTo()](https://developer.mozilla.org/docs/Web/API/Window/scrollTo) method to programmatically scroll a web page. [Run the demo live](https://mdn.github.io/dom-examples/scrolltooptions/). diff --git a/screen-capture-api/README.md b/screen-capture-api/README.md new file mode 100644 index 00000000..09305c3a --- /dev/null +++ b/screen-capture-api/README.md @@ -0,0 +1,5 @@ +# Screen Capture API examples + +- [Screen Capture API example](https://mdn.github.io/dom-examples/screen-capture-api/basic-screen-capture): A basic example showing how to use the [Screen Capture API](https://developer.mozilla.org/docs/Web/API/Screen_Capture_API) to capture a surface (such as a window or tab) and broadcast the resulting stream in a `