npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zhaoshijun/tg-video-sdk

v1.0.3

Published

视频SDK工具,支持Vue3和Element Plus

Readme

TG Video SDK

一个用于视频处理的SDK工具,支持在Vue3和Element Plus项目中使用。

安装

npm install tg-video-sdk

在Vue3项目中使用

全局引入

在main.js中:

import { createApp } from 'vue'
import App from './App.vue'
import { TG_VIDEO_SDK } from 'tg-video-sdk'

const app = createApp(App)
app.config.globalProperties.$videoSDK = TG_VIDEO_SDK
app.mount('#app')

组件中使用

<template>
  <div>
    <div ref="videoContainer" style="width: 640px; height: 480px;"></div>
    <button @click="startPlay">开始播放</button>
  </div>
</template>

<script setup>
import { ref, onMounted, getCurrentInstance } from 'vue'
import { TG_VIDEO_SDK } from 'tg-video-sdk'

const { proxy } = getCurrentInstance()
const videoContainer = ref(null)
let player = null

onMounted(() => {
  // 初始化SDK
  TG_VIDEO_SDK.JS_API.login('127.0.0.1:8080', 'admin', 'admin')
    .then(res => {
      console.log('登录成功', res)
    })
    .catch(err => {
      console.error('登录失败', err)
    })
})

const startPlay = () => {
  player = TG_VIDEO_SDK.JS_Rtc.StartPlayerService(videoContainer.value, {
    devId: 'your-device-id',
    playId: 0,
    playMode: '2D'
  })
  
  player.play({
    devId: 'your-device-id',
    playId: 0
  })
    .then(res => {
      console.log('播放成功', res)
    })
    .catch(err => {
      console.error('播放失败', err)
    })
}
</script>

API文档

登录

TG_VIDEO_SDK.JS_API.login(serverAddress, username, password)

视频播放

// 创建播放器实例
const player = TG_VIDEO_SDK.JS_Rtc.StartPlayerService(domElement, options)

// 开始播放
player.play({
  devId: 'your-device-id',
  playId: 0
})

// 停止播放
player.close()

云台控制

// 向左转动
TG_VIDEO_SDK.JS_Ptz.Left(deviceId, speed)

// 向右转动
TG_VIDEO_SDK.JS_Ptz.Right(deviceId, speed)

// 向上转动
TG_VIDEO_SDK.JS_Ptz.Up(deviceId, speed)

// 向下转动
TG_VIDEO_SDK.JS_Ptz.Down(deviceId, speed)

// 放大
TG_VIDEO_SDK.JS_Ptz.ZoomIn(deviceId, speed)

// 缩小
TG_VIDEO_SDK.JS_Ptz.ZoomOut(deviceId, speed)

// 停止
TG_VIDEO_SDK.JS_Ptz.Stop(deviceId)

注意事项

  • 使用前请确保已正确安装依赖
  • 需要在Vue3环境下使用
  • 支持Element Plus组件库