Skip to content

Commit

Permalink
fix: cancel video loading after destroying (#883)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lanfei authored Jan 24, 2025
0 parents commit a00c6ab
Show file tree
Hide file tree
Showing 481 changed files with 474,642 additions and 0 deletions.
Empty file added .nojekyll
Empty file.
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
artplayer.org
1 change: 1 addition & 0 deletions ads.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
google.com, pub-8579453810848662, DIRECT, f08c47fec0942fa0
10 changes: 10 additions & 0 deletions assets/@mediapipe/selfie_segmentation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# MediaPipe JavaScript Solutions

MediaPipe offers out of the box solutions to use our ML technology with live and streaming media.

Visit us as [mediapipe.dev]()

See live demos of our JavaScript solutions at [code.mediapipe.dev/codepen]()

For more information on each of the solutions and how to use them, visit https://google.github.io/mediapipe/getting_started/javascript.

111 changes: 111 additions & 0 deletions assets/@mediapipe/selfie_segmentation/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/**
* @fileoverview Declarations for the face tracking API.
*/

/**
* Version number of this package.
*/
export const VERSION: string;

/**
* We support several ways to get image inputs.
*/
export type InputImage = HTMLVideoElement | HTMLImageElement | HTMLCanvasElement;

/**
* Legal inputs.
*/
export interface InputMap {
image: InputImage;
}

/**
* GpuBuffers should all be compatible with Canvas' `drawImage`
*/
type GpuBuffer = HTMLCanvasElement | HTMLImageElement | ImageBitmap;

/**
* Possible results from SelfieSegmentation.
*/
export interface Results {
image: GpuBuffer;
segmentationMask: GpuBuffer;
}

/**
* Configurable options for SelfieSegmentation.
*/
export interface Options {
selfieMode?: boolean;
modelSelection?: number;
}

/**
* Listener for any results from SelfieSegmentation.
*/
export type ResultsListener = (results: Results) => (Promise<void>|void);

/**
* Contains all of the setup options to drive the face solution.
*/
export interface SelfieSegmentationConfig {
locateFile?: (path: string, prefix?: string) => string;
}

/**
* Declares the interface of SelfieSegmentation.
*/
declare interface SelfieSegmentationInterface {
close(): Promise<void>;
onResults(listener: ResultsListener): void;
initialize(): Promise<void>;
reset(): void;
send(inputs: InputMap): Promise<void>;
setOptions(options: Options): void;
}

/**
* Encapsulates the entire SelfieSegmentation solution. All that is needed from the
* developer is the source of the image data. The user will call `send`
* repeatedly and if a face is detected, then the user can receive callbacks
* with this metadata.
*/
export declare class SelfieSegmentation implements SelfieSegmentationInterface {
constructor(config?: SelfieSegmentationConfig);

/**
* Shuts down the object. Call before creating a new instance.
*/
close(): Promise<void>;

/**
* Registers a single callback that will carry any results that occur
* after calling Send().
*/
onResults(listener: ResultsListener): void;

/**
* Initializes the solution. This includes loading ML models and mediapipe
* configurations, as well as setting up potential listeners for metadata. If
* `initialize` is not called manually, then it will be called the first time
* the developer calls `send`.
*/
initialize(): Promise<void>;

/**
* Tells the graph to restart before the next frame is sent.
*/
reset(): void;

/**
* Processes a single frame of data, which depends on the options sent to the
* constructor.
*/
send(inputs: InputMap): Promise<void>;

/**
* Adjusts options in the solution. This may trigger a graph reload the next
* time the graph tries to run.
*/
setOptions(options: Options): void;
}
27 changes: 27 additions & 0 deletions assets/@mediapipe/selfie_segmentation/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@mediapipe/selfie_segmentation",
"version": "0.1.1675465747",
"description": "Mediapipe Selfie Segmentation Solution",
"main": "selfie_segmentation.js",
"module": "selfie_segmentation.js",
"jsdelivr": "selfie_segmentation.js",
"unpkg": "selfie_segmentation.js",
"types": "index.d.ts",
"author": "[email protected]",
"license": "Apache-2.0",
"homepage": "https://google.github.io/mediapipe/solutions/selfie_segmentation",
"keywords": [ "AR", "ML", "Augmented" ],
"devDependencies": {
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
},
"browser": {
"node-fetch": false,
"util": false,
"crypto": false
},
"sideEffects" : []
}
Binary file not shown.
93 changes: 93 additions & 0 deletions assets/@mediapipe/selfie_segmentation/selfie_segmentation.js

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Empty file.

Large diffs are not rendered by default.

Binary file not shown.

Large diffs are not rendered by default.

Binary file not shown.
Loading

0 comments on commit a00c6ab

Please sign in to comment.