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

mse-player-next

v1.0.6

Published

基于MSE的云手机投流组件库,websocket接收h264裸流,控制流基于[video-controller-next](https://www.npmjs.com/package/video-controller-next)

Downloads

147

Readme

MSE Player

基于MSE的云手机投流组件库,websocket接收h264裸流,控制流基于video-controller-next

Develop

本地node version >= 18.0

  1. 视频控制同一个websocket,修改example/single.html下60行以后的js代码
npm install
npm run build
npm run start-single

启动浏览器打开 localhost:9091

  1. 视频控制不同websocket,有需要直接修改 example/multiple.html下60行以后的js代码
npm install
npm run build
npm run start-multiple

启动浏览器打开 localhost:9092

Getting Started

video和control用同一个webscoket

new MSEPlayer({
  videoElement: document.querySelector('#video'),
  textHelperElement: document.querySelector('.video-input-helper'),
  wsVideoAddress: 'wss://xxxxxx/v1/websocket/video',
  buildInitVideoMsg: () => {
    return {"cmd":"startvideo","device_id":xxx,"test_id_str":"xxx","controlkey":"xxx","video_config":""};
  }
});

video和control用两个webscoket

new MSEPlayer({
  videoElement: document.querySelector('#video'),
  textHelperElement: document.querySelector('.video-input-helper'),
  wsVideoAddress: 'wss://xxxxx/v1/websocket/video',
  buildInitVideoMsg: () => {
    return {"cmd":"startvideo","device_id":xxx,"test_id_str":"xxx","controlkey":"xxx","video_config":""};
  },
  // 新增
  multiplexing: false,
  wsCtrlAddress: 'wss://xxxxx/v1/websocket/control',
  buildInitCtrlMsg: () => {
    return {"xxxx": "xxxxx"};
  }
});

Options

videoElement HTMLVideoElement required

用来展示画面的video元素

textHelperElement HTMLInputElement required

用来辅助粘贴的text input元素

wsVideoAddress string required

连接目标的video websocket地址

buildInitVideoMsg () => any required

用来构造websocket视频流的初始信息的模版函数(类似joinRoom)

multiplexing boolean optional

是否video和控制流用同一个webscoket接收和发送,默认为true

wsCtrlAddress string optional

连接目标的control websocket地址, 若为空则默认使用 wsVideoAddress

buildInitCtrlMsg () => any optional

video和控制流使用两个webscoket(即multiplexing为false),新建控制流时的初始信息的模版函数

buildHeartbeat () => any optional

websocket的心跳信息构造函数,返回一个对象。 对象的结构为单个

  { 
    "xxx": "xxx"
  }

复合分别指定

  { 
    "video": { "xxx": "xxx" },
    "control": { "xxx": "xxx" } 
  }

默认为 { type: 'heartbeat' }

heartbeatChannel ('video'|'control')[] optional

指定需要发送心跳的websocket流,默认为空

heartbeatInterval number optional

指定发送心跳的间隔时间, 默认30000ms

Methods

keyPress (code: AndroidKeycode) => void

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

rotate () => void

模拟发送转屏信号

backOrScreenOn () => void

模拟发送回到主页信号

destroy () => void

卸载player实例,关闭websocket连接以及卸载eventlistener

reconnect () => void

重新连接