Socket
Socket
Sign inDemoInstall

easy-ts-camera

Package Overview
Dependencies
0
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.1.2

2

dist/Camera.d.ts

@@ -7,2 +7,3 @@ import CameraBuilder from "./CameraBuilder";

canvasContext: CanvasRenderingContext2D | null;
cameraStreamListener: (MediaStream: any) => void | null;
constructor(cameraBuilder: CameraBuilder);

@@ -13,3 +14,2 @@ getDevicesAsync(): Promise<Array<MediaDeviceInfo>>;

snapAsBlobAsync(): Promise<Blob>;
get currentStreamingDeviceCapabilities(): MediaTrackCapabilities | null;
startAsync(): Promise<void>;

@@ -16,0 +16,0 @@ stop(): void;

@@ -7,2 +7,3 @@ export default class Camera {

this.canvasContext = this.builder.canvas.getContext('2d');
this.cameraStreamListener = cameraBuilder.cameraStreamListener;
}

@@ -51,10 +52,2 @@ getDevicesAsync() {

}
get currentStreamingDeviceCapabilities() {
if (!this.stream)
return null;
const streamVideoTracks = this.stream.getVideoTracks();
if (streamVideoTracks.length === 0)
return null;
return streamVideoTracks[0].getCapabilities();
}
startAsync() {

@@ -67,2 +60,3 @@ return new Promise(async (resolve, reject) => {

this.stream = stream;
this.cameraStreamListener(this.stream);
resolve();

@@ -69,0 +63,0 @@ }

@@ -7,2 +7,3 @@ import Camera from "./Camera";

video: HTMLVideoElement;
cameraStreamListener: (MediaStream: any) => void | null;
constructor(mediaConstraints: MediaConstraints);

@@ -18,2 +19,6 @@ /**

/**
* By passing this the function will be called every time the stream changes for any reason.
*/
withCameraStreamListener(cameraStreamListener: (MediaStream: any) => void): CameraBuilder;
/**
* It will try to stream the UltraHD resolution from the camera.

@@ -20,0 +25,0 @@ */

@@ -5,2 +5,3 @@ import Camera from "./Camera";

constructor(mediaConstraints) {
this.cameraStreamListener = null;
this.mediaConstraints = mediaConstraints;

@@ -23,2 +24,9 @@ }

/**
* By passing this the function will be called every time the stream changes for any reason.
*/
withCameraStreamListener(cameraStreamListener) {
this.cameraStreamListener = cameraStreamListener;
return this;
}
/**
* It will try to stream the UltraHD resolution from the camera.

@@ -25,0 +33,0 @@ */

{
"name": "easy-ts-camera",
"version": "1.1.1",
"version": "1.1.2",
"description": "A package which helps with adding camera support to a web application with typescript support",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -8,3 +8,3 @@ import CameraBuilder from "./CameraBuilder";

public canvasContext: CanvasRenderingContext2D | null = null;
public cameraStreamListener: (MediaStream) => void | null;
constructor(cameraBuilder: CameraBuilder) {

@@ -14,3 +14,3 @@ this.devices = new Array<MediaDeviceInfo>();

this.canvasContext = this.builder.canvas.getContext('2d');
this.cameraStreamListener = cameraBuilder.cameraStreamListener;
}

@@ -63,9 +63,2 @@

get currentStreamingDeviceCapabilities(): MediaTrackCapabilities | null {
if (!this.stream) return null;
const streamVideoTracks = this.stream.getVideoTracks();
if (streamVideoTracks.length === 0) return null;
return streamVideoTracks[0].getCapabilities();
}
public startAsync(): Promise<void> {

@@ -79,2 +72,3 @@ return new Promise<void>(async (resolve, reject) => {

this.stream = stream;
this.cameraStreamListener(this.stream);
resolve();

@@ -81,0 +75,0 @@ } catch (error) {

@@ -9,2 +9,4 @@ import Camera from "./Camera";

public cameraStreamListener: (MediaStream) => void | null = null;
public constructor(mediaConstraints: MediaConstraints) {

@@ -28,3 +30,12 @@ this.mediaConstraints = mediaConstraints;

/**
* By passing this the function will be called every time the stream changes for any reason.
*/
public withCameraStreamListener(cameraStreamListener: (MediaStream) => void): CameraBuilder {
this.cameraStreamListener = cameraStreamListener;
return this;
}
/**
* It will try to stream the UltraHD resolution from the camera.

@@ -31,0 +42,0 @@ */

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc