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 🙏

© 2024 – Pkg Stats / Ryan Hefner

video-controller-next

v1.0.15

Published

A nodejs package for controlling phone depend on scrcpy protocol.

Downloads

52

Readme

VideoController

A nodejs package for controlling phone depend on scrcpy protocol.

Develop

npm install
npm run build
npm run dev

启动浏览器访问 localhost:9090

Getting Started

new VideoController({
  sendCtrl: this._sendCtrl.bind(this),
  videoElement: this.videoElement,
  textHelperElement: this.textHelperElement
});

协议内容

Key

{ "type": 0, "action": 0, "keyCode": $KEYCODE, "metaState": 0, "repeat": 0 }
{ "type": 0, "action": 1, "keyCode": $KEYCODE, "metaState": 0, "repeat": 0 }
export enum AndroidKeycode {
  Home = 3,
  Back = 4,
  Power = 26,
  Menu = 82,
  RencentApps = 187,
  Camera = 27,
  VoluneMute = 164,
  VoluneUp = 24,
  VolumeDown = 25,
}

Touch

{ "type": 2, "action": 0, "position": { "x": 0.812, "y": 0.284, "width": $realWidth, "height": $realHeight }, "buttons": 0, "pressure": 1 }
{ "type": 2, "action": 2, "position": { "x": 0.779, "y": 0.286, "width": $realWidth, "height": $realHeight }, "buttons": 0, "pressure": 1 }
{ "type": 2, "action": 2, "position": { "x": 0.762, "y": 0.286, "width": $realWidth, "height": $realHeight }, "buttons": 0, "pressure": 1 }
{ "type": 2, "action": 2, "position": { "x": 0.719, "y": 0.286, "width": $realWidth, "height": $realHeight }, "buttons": 0, "pressure": 1 }
{ "type": 2, "action": 1, "position": { "x": 0.719, "y": 0.286, "width": $realWidth, "height": $realHeight }, "buttons": 0, "pressure": 1 }

Scroll

{ "type": 3, "position": { "x": 0.433, "y": 0.191, "width": $realWidth, "height": $realHeight }, "hScroll": 0, "vScroll": 0.04 }
{ "type": 3, "position": { "x": 0.433, "y": 0.191, "width": $realWidth, "height": $realHeight }, "hScroll": 0, "vScroll": 0.04 }

TEXT

{ "type": 1, "text": "http://localhost:9090/", "paste": true }

Set_Clipboard

{ "type": 9, "text": "http://localhost:9090/", "paste": true }

Options

videoMode webrtc|image optional

使用的投流模式, 默认为 webrtc

videoElement HTMLVideoElement required

用来展示画面的video元素

textHelperElement HTMLInputElement required

用来辅助粘贴的text input元素

imageElement HTMLImageElement optional

使用图片流时用来展示画面的img元素

multiFingerCount number optional

发送触控事件使用的手指数量, 默认为1

multiFingerRotate number optional

发送触控事件使用的倾斜角度, 默认为0 (范围: 0 Deg - 180 Deg)

multiFingerOffset number optional

发送触控事件每个手指的间隔百分比, 默认为0.1 (范围: 0-1)

isPC boolean optional

指定投流终端是否为PC终端(Mouse Move事件的触发条件不同)

sendCtrl (msg: any) => void required

用于发送控制指令的函数(比如经过包装的websocket信息发送函数)

pcMouseSpeedFactor number optional

指定PC模式下的鼠标灵敏度,默认值为1.0

Methods

keyPress (code: AndroidKeycode) => void

模拟点击对端手机的某个功能按键键

rotate () => void

模拟发送转屏信号

backOrScreenOn () => void

模拟发送回到主页信号

resetFingerCount (number) => void

重置触控事件使用的手指数量

resetFingerRotate (number) => void

重置触控事件使用的倾斜角度

resetFingerOffset (number) => void

重置触控事件每个手指的间隔百分比

requestFullAndLockInput () => void

请求全屏并锁定鼠标以及键盘

resetPcSpeedFactor (number) => void

重置PC模式下的鼠标灵敏度,默认值为1.0