New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

castiron

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

castiron

castiron sdk

latest
npmnpm
Version
2.3.3
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

Castiron SDK

Socket

runtime 环境 websocket 连接

    import { Socket } from 'castiron'

    const options = {
        "wsUrl": "ws://10.168.1.233:8765", // websocket 地址
    };

    const socket = new Socket(options)

    socket.on('data', (data) => {
        // 分析结果数据
        console.log(data);
    });

    socket.on('error', (data) => {
        // 错误信息
    });

on(eventName: string, cb: Function)

注册监听事件

  • eventName
    • open: socket 连接上
    • close: socket 已关闭
    • error: socket 错误
    • data: 数据信息

off(eventName: string, cb: Function)

移除事件监听

disconnect()

关闭 socket

setWsUrl(wsUrl: string)

变更 socket 地址

VideoPlayer

播放器

    import { VideoPlayer } from 'castiron'

    const config = {
        "wsUrl": "ws://10.168.1.233:8765", // websocket 地址
        "el": "#player"
    }

    const player = new VideoPlayer(config)

    player.play();

    // 监听分析结果信息
    player.socket.on('data', (data) => {
        console.log(data);
    });

on(eventName: string, cb: Function)

注册监听事件

  • eventName:
    • canvasAttr: cavnas 宽高变化

off(eventName: string, cb: Function)

移除事件监听

play()

开始播放

pause()

暂停播放

destroy()

销毁播放器

imageCanvas

视频播放的 canvas 的环境

poseCanvas

骨骼点绘画的 canvas 的环境

configCanvas

graph 配置信息绘画的 canvas 的环境

resultCanvas

分析结果绘画的 canvas 环境

canvasWidth

canvas 宽度

canvasHeight

canvas 高度

status

当前视频流的播放状态: pending, running, pauseing, closed

poseStatus: pending, running, pauseing, closed

当前骨骼点的播放状态

socket

socket 实例(如果传递了 wsUrl 参数就会有此属性)

API

API 接口

    import { API } from 'castiron'

    const config = {
        "bootstrapServer": "http://10.168.1.233:8000"
    }

    const api = new API(config)

    api.getSchedulerGraph().then(graph => {
        console.log(graph);
    });

getSchedulerGraph()

获取当前使用的 graph 配置新

setSchedulerGraph(params: GraphConfig)

设置新的 graph 配置信息

restartScheduler()

重启调度器

FAQs

Package last updated on 14 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts