Skip to content

Quick Start Guide

Get up and running with Moveris Liveness Detection in minutes.

In plain terms

Capture frames from the camera (count depends on model—e.g. 10 for mixed-10-v2, 30 for mixed-30-v2), encode them as base64, send them to the API with your API key, and receive a live/fake verdict with a confidence score. The code examples below show the full flow.

Using React or React Native?

The official SDK provides ready-to-use components and hooks for the fastest integration. See the SDK Documentation to get started in 5 minutes.

Prerequisites

Basic Flow

  1. Capture 10 video frames from user's camera (~1 second at 10 FPS)
  2. Encode frames as base64 PNG
  3. Send frames to Moveris API with your API key
  4. Receive verdict ("live" or "fake") with confidence score

Code Examples

async function checkLiveness(videoElement) {
  const frames = [];

  // Capture frames (e.g. 10 for mixed-10-v2, 30 for mixed-30-v2)
  const frameCount = 10;
  for (let i = 0; i < frameCount; i++) {
    const canvas = document.createElement('canvas');
    canvas.width = 640;
    canvas.height = 480;
    const ctx = canvas.getContext('2d');
    ctx.drawImage(videoElement, 0, 0, 640, 480);

    frames.push({
      index: i,
      timestamp_ms: performance.now(),
      pixels: canvas.toDataURL('image/png').split(',')[1]
    });

    // Wait ~100ms between frames (10 FPS)
    await new Promise(r => setTimeout(r, 100));
  }

  const response = await fetch('https://api.moveris.com/api/v1/fast-check', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': 'sk-your-api-key'
    },
    body: JSON.stringify({
      session_id: crypto.randomUUID(),
      source: 'live',
      model: 'mixed-10-v2',
      frames: frames
    })
  });

  const body = await response.json();
  if (!body.success) {
    throw new Error(body.message ?? 'Request failed');
  }
  return body.data;
}
import base64
import uuid
import cv2
import requests

def check_liveness(video_path: str, api_key: str) -> dict:
    """Check liveness. Frame count matches model (e.g. 10 for mixed-10-v2)."""
    cap = cv2.VideoCapture(video_path)
    frames = []

    for i in range(10):  # 10 for mixed-10-v2
        ret, frame = cap.read()
        if not ret:
            break

        frame = cv2.resize(frame, (640, 480))
        _, png_data = cv2.imencode('.png', frame)
        pixels = base64.b64encode(png_data.tobytes()).decode('utf-8')

        frames.append({
            'index': i,
            'timestamp_ms': i * 100,
            'pixels': pixels
        })

    cap.release()

    response = requests.post(
        'https://api.moveris.com/api/v1/fast-check',
        headers={
            'Content-Type': 'application/json',
            'X-API-Key': api_key
        },
        json={
            'session_id': str(uuid.uuid4()),
            'source': 'live',
            'model': 'mixed-10-v2',
            'frames': frames
        }
    )

    body = response.json()
    if not body.get("success", False):
        raise RuntimeError(body.get("message", "Request failed"))
    return body["data"]

Frame Capture

Frame count must match your model (e.g. 10 for mixed-10-v2, 30 for mixed-30-v2). Capture at ~10 FPS. For mixed-10-v2, that's about 1 second of video.

Next Steps