1.0.0 • Published 5 years ago

minicap-driver v1.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

minicap-driver

一个对 minicap 的 node.js 封装,不需要关注 minicap 的底层原理,让你轻松实现电脑浏览器实时投影 android 设备,并保证高帧率。

npm.io

server side

import * as minicapDriver from 'minicap-driver'
import { Server as WebSocketServer } from 'ws'

const wss = new WebSocketServer({ port: 9002 })

;(async () => {
	await minicapDriver.init()
	wss.on('connection', async ws => {
		console.log('conncetion')
		await minicapDriver.start(ws)
	})
})()

client side just like this:

import { minicapClient } from 'minicap-driver/dist/client'

minicapClient('ws://localhost:9002', '#canvas')

就是这么简单,例子可以看example