Optional options: boolean | AddEventListenerOptionsAdds additional modules like face_tracker, background and many others to the Player and makes them available for effects
Rest ...modules: Module[]const frx = new Module("/path/to/face_tracker.zip")
await player.addModule(frx)
Evaluates JavaScript in context of applied effect.
Use evalJs instead.
Destroys the Player instance, clears all the resources used
Starts input processing.
Accepts playback options object with optional fps and pauseOnEmpty keys.
/// The `fps` playback option persists between invocations:
const desiredFps = 25
player.play({ fps: desiredFps })
player.play() // same as passing `{ fps: desiredFps }`
/// The `pauseOnEmpty` playback option resets to `true` between invocations:
await player.use(new Image(file))
player.applyEffect(new Effect("path/to/Spider.zip")) // an effect with animations
player.play({ pauseOnEmpty: false })
player.play() // same as passing `{ pauseOnEmpty: true }`
Optional options: boolean | EventListenerOptionsUses the input as frames source
Optional options: InputOptionsplayer.use(new Webcam())
Static createCreates Player instance.
See SDKOptions and PlayerOptions for all the possible parameters.
const player = await Player.create({ clientToken: "xxx-xxx-xxx", devicePixelRatio: 1 })
Static Readonly EFFECT_Static Readonly FRAME_Triggered when a new FrameData is ready
player.addEventListener("framedata", ({ detail: frameData }) => {
const hasFace = frameData.get("frxRecognitionResult.faces.0.hasFace")
if (!hasFace) return
const landmarks = frameData.get("frxRecognitionResult.faces.0.landmarks")
console.log(landmarks)
})
Static Readonly FRAME_Triggered when a frame is processed by underlying neural networks
Static Readonly FRAME_Triggered when a frame is received from the specified Input
Static Readonly FRAME_Triggered when a frame is rendered
High level API over compiled Banuba SDK