Plask logo

MOTION


Plask SDK

Plask offers a simple yet powerful solution: the Plask Motion SDK. Motion capture has evolved from a feature to a necessity across industries like gaming, healthcare, and virtual reality. With our SDK, you can effortlessly bring the magic of motion to your product, enhancing user engagement and interaction.

Seamless Integration

One of the standout features of Plask Motion SDK is its easy integration. Our SDK's extensible design ensures that it seamlessly merges with your existing product ecosystem. No need to disrupt your current design or functionality; our SDK smoothly blends in, providing users with a seamless transition into the world of motion.

Partnering for Success

Our commitment to your success goes beyond providing an exceptional SDK. Our dedicated team of experts is ready to assist you throughout the integration process. We collaborate closely with your development team, ensuring you make the most of our technology and achieve your vision.

Join Us Today

Don't miss the opportunity to enhance your product with motion capture capabilities. Reach out to us today to learn how Plask Motion SDK can make your vision a reality. The future of motion capture is here, and we invite you to be part of it with Plask.

Development docs

  • npm
  • pip (Coming soon!)

Usecase

"use client";

import { Client } from "@plask-ai/client";
import React from "react";
import { useEffect, useState, useContext } from "react";
import { Context as ModalContext } from "../context/ModelContext";
import createAnimationClip from "./AnimationConverter";

export default function ClientButton() {
  const [client, setClient] = useState(null);
  const [videoUrl, setVideoUrl] = useState('');
  const [startTime, setStartTime] = useState(0);
  const [endTime, setEndTime] = useState(0);

  const {
    addAnimations,
  } = useContext(ModalContext);

  useEffect(() => {
    async function initializeClient() {
      try {
        const client = new Client();
        await client.signIn("example@plask.ai", "password"); // TODO: change to your own email and password -> motion.plask.ai
        client.onMessageReceived((message) => {
            if (message.includes("Done")) {
                const beforeFilter = JSON.parse(message);
                const afterFilter = client.applyFilter(message);
                const animationClip = createAnimationClip(afterFilter)
                addAnimations([animationClip]);
            } else {
                console.log(message);
            }
        });

        setClient(client);
      } catch (error) {
        console.error("Error initializing client:", error);
      }
    }

    initializeClient();

    return () => {
      if (client) {
        client.closeConnection();
      }
    }

  }, []);

  const onClick = async () => {
    if (client && videoUrl) {
      const request = {
        jobId: "test",
        task: "pose_estimation",
        input: {
          fileUrl: videoUrl,
          startTime: Number(startTime),
          endTime: Number(endTime),
        },
        destination: { type: "client" },
      };

      client.sendMessage(request);
    }
  };

  return (
    <div>
        <input
          type="text"
          placeholder="Enter video URL here"
          value={videoUrl}
          onChange={(e) => setVideoUrl(e.target.value)}
          className="video-input"
        />
        <input
          type="text"
          placeholder="Enter start time here"
          value={startTime}
          onChange={(e) => setStartTime(e.target.value)} 
          className="startTime-input"
        />
        <input
          type="text"
          placeholder="Enter end time here"
          value={endTime}
          onChange={(e) => setEndTime(e.target.value)} 
        />
        <button
            onClick={onClick}
            className="z-10 max-w-5xl w-full items-center justify-between font-mono text-sm lg:flex bg-slate-700 text-white rounded-lg p-4"
        >
            Click Me
      </button>
    </div>
  );
}

contact: 📧 jaejun@plask.ai