Skip to content

Added ImageCapture #410

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

Merged
merged 7 commits into from
Sep 4, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Post-merge fixes + prePR
  • Loading branch information
japgolly committed Sep 4, 2021
commit ef3ecb524920676060d35a76042e232d232c29db
4 changes: 4 additions & 0 deletions api-reports/2_12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13250,6 +13250,7 @@ IDBVersionChangeEventInit[JT] var composed: js.UndefOr[Boolean]
IDBVersionChangeEventInit[JT] var newVersion: js.UndefOr[Integer]
IDBVersionChangeEventInit[JT] var oldVersion: js.UndefOr[Int]
IDBVersionChangeEventInit[JT] var scoped: js.UndefOr[Boolean]
ImageBitmap[JT] def close(): Unit
ImageBitmap[JT] def height: Double
ImageBitmap[JT] def width: Double
ImageData[JC] def data: js.Array[Int]
Expand Down Expand Up @@ -23627,6 +23628,9 @@ experimental/mediastream/AudioTrackList[JT] var onchange: js.Function1[Event, An
experimental/mediastream/AudioTrackList[JT] var onremovetrack: js.Function1[Event, Any]
experimental/mediastream/AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
experimental/mediastream/AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
experimental/mediastream/ImageCapture[JC] def grabFrame(): js.Promise[ImageBitmap]
experimental/mediastream/ImageCapture[JC] def takePhoto(): js.Promise[Blob]
experimental/mediastream/ImageCapture[JC] val track: MediaStreamTrack
experimental/mediastream/MediaDeviceInfo[JT] val deviceId: String
experimental/mediastream/MediaDeviceInfo[JT] val groupId: String
experimental/mediastream/MediaDeviceInfo[JT] val kind: MediaDeviceKind
Expand Down
4 changes: 4 additions & 0 deletions api-reports/2_13.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13250,6 +13250,7 @@ IDBVersionChangeEventInit[JT] var composed: js.UndefOr[Boolean]
IDBVersionChangeEventInit[JT] var newVersion: js.UndefOr[Integer]
IDBVersionChangeEventInit[JT] var oldVersion: js.UndefOr[Int]
IDBVersionChangeEventInit[JT] var scoped: js.UndefOr[Boolean]
ImageBitmap[JT] def close(): Unit
ImageBitmap[JT] def height: Double
ImageBitmap[JT] def width: Double
ImageData[JC] def data: js.Array[Int]
Expand Down Expand Up @@ -23627,6 +23628,9 @@ experimental/mediastream/AudioTrackList[JT] var onchange: js.Function1[Event, An
experimental/mediastream/AudioTrackList[JT] var onremovetrack: js.Function1[Event, Any]
experimental/mediastream/AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
experimental/mediastream/AudioTrackList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
experimental/mediastream/ImageCapture[JC] def grabFrame(): js.Promise[ImageBitmap]
experimental/mediastream/ImageCapture[JC] def takePhoto(): js.Promise[Blob]
experimental/mediastream/ImageCapture[JC] val track: MediaStreamTrack
experimental/mediastream/MediaDeviceInfo[JT] val deviceId: String
experimental/mediastream/MediaDeviceInfo[JT] val groupId: String
experimental/mediastream/MediaDeviceInfo[JT] val kind: MediaDeviceKind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ trait ImageBitmap extends js.Object {
/** An unsigned long representing the width, in CSS pixels, of the ImageData.
*/
def width: Double = js.native

/** Dispose of all graphical resources associated with an ImageBitmap.
*/
def close(): Unit = js.native
}

trait CreateImageBitmapOptions extends js.Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*/
package org.scalajs.dom.experimental.mediastream

import org.scalajs.dom.{Event, EventInit, EventTarget, TimeRanges}
import org.scalajs.dom._
import scala.scalajs.js
import scala.scalajs.js.annotation._
import scala.scalajs.js.|
Expand Down Expand Up @@ -525,40 +525,34 @@ trait MediaTrackSupportedConstraints extends js.Object {
var groupId: js.UndefOr[Boolean] = js.undefined
}

/**
* The ImageCapture interface of the MediaStream Image Capture API provides methods
* to enable the capture of images or photos from a camera or other photographic
* device referenced through a valid MediaStreamTrack.
*
* MDN
*/
/** The ImageCapture interface of the MediaStream Image Capture API provides methods to enable the capture of images or
* photos from a camera or other photographic device referenced through a valid MediaStreamTrack.
*
* MDN
*/
@js.native
@JSGlobal
class ImageCapture(
init: MediaStreamTrack
) extends js.Object {

/**
* Returns a reference to the MediaStreamTrack passed to the constructor.
*
* MDN
*/
/** Returns a reference to the MediaStreamTrack passed to the constructor.
*
* MDN
*/
val track: MediaStreamTrack = js.native

/**
* Takes a single exposure using the video capture device sourcing a MediaStreamTrack and
* returns a Promise that resolves with a Blob containing the data.
*
* MDN
*/
/** Takes a single exposure using the video capture device sourcing a MediaStreamTrack and returns a Promise that
* resolves with a Blob containing the data.
*
* MDN
*/
def takePhoto(): js.Promise[Blob] = js.native

/**
* Takes a snapshot of the live video in a MediaStreamTrack, returning an ImageBitmap, if
* successful.
*
* MDN
*/
/** Takes a snapshot of the live video in a MediaStreamTrack, returning an ImageBitmap, if successful.
*
* MDN
*/
def grabFrame(): js.Promise[ImageBitmap] = js.native
}

Expand Down
34 changes: 0 additions & 34 deletions src/main/scala/org/scalajs/dom/lib.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5059,40 +5059,6 @@ class ImageData extends js.Object {
def height: Int = js.native
}

/**
* The ImageBitmap interface represents a bitmap image which can be drawn to a &lt;canvas&gt;
* without undue latency. It can be created from a variety of source objects using the
* createImageBitmap() factory method. ImageBitmap provides an asynchronous and resource
* efficient pathway to prepare textures for rendering in WebGL.
*
* MDN
*/
@js.native
@JSGlobal
class ImageBitmap extends js.Object {

/**
* Is an unsigned long representing the height, in CSS pixels, of the ImageBitmap.
*
* MDN
*/
def height: Int = js.native

/**
* Is an unsigned long representing the width, in CSS pixels, of the ImageBitmap.
*
* MDN
*/
def width: Int = js.native

/**
* Dispose of all graphical resources associated with an ImageBitmap.
*
* MDN
*/
def close(): Unit = js.native
}

/** A collection of nodes returned by Node.attributes (also potentially for DocumentType.entities,
* DocumentType.notations). NamedNodeMaps are not in any particular order (unlike NodeList, although they may be
* accessed by an index as in an array (they may also be accessed with the item method). A NamedNodeMap object are live
Expand Down