
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
npm install webrtclib
import videoWebrtc from "webrtclib";
import "webrtclib/lib/videoWebrtc.css"
Vue.use(videoWebrtc);
<video-webrtc
:server="server"
:stun="stun"
:sid="sid"
:orgId="orgId"
@saveVideo="saveVideo"
@capture="capture"
></video-webrtc>
参数 | 类型 | 类型 | 解释 |
---|---|---|---|
server | 必传 | String | 服务地址 |
stun | 必传 | String | ice协议服务地址 |
sid | 必传 | [Number, String] | 直播时候传入的设备id |
orgId | 必传 | [Number, String] | 直播时候传入的组织ID |
custTime | 非必传 | [Number, String] | 录像时间(秒),默认5分钟,最大1小时 |
saveVideo | 非必传 | 回调方法 | 返回录像地址url |
capture | 非必传 | 回调方法 | 返回截图文件base64 |
录像需要配置proxy
proxy: {
"/webrtcApi": {
target: "http://ip:port", // 目标接口域名
pathRewrite: {
"^/webrtcApi": ""
},
changeOrigin: true // 是否跨域
}
}
<template>
<div class="home">
<div class="video" v-for="item in arr" :key="item">
<video-webrtc
:server="server"
:stun="stun"
:sid="sid"
:orgId="orgId"
@saveVideo="saveVideo"
@capture="capture"
></video-webrtc>
</div>
<div class="dialog-mask" v-if="imgCapture" @click="imgCapture = null"></div>
<div class="dilog" v-if="imgCapture">
<img v-if="imgCapture" :src="imgCapture" alt="" />
</div>
</div>
</template>
<script>
export default {
name: "Home",
data() {
return {
arr: [1, 2, 3, 4, 5, 6, 7, 8, 9],
stun: "stun://ip:port",
server: "ws://ip:port/wsrtc",
sid: "摄像头ID",
orgId: "组织ID"
imgCapture: ""
};
},
methods: {
// 截图
capture(val) {
console.log(val);
this.imgCapture = val;
},
// 录像
saveVideo(val) {
console.log(val);
}
}
};
</script>
<style>
.home {
display: flex;
flex-wrap: wrap;
}
.video {
width: 320px;
height: 180px;
position: relative;
margin: 10px;
}
.dialog-mask {
position: absolute;
z-index: 1001;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #00000090;
}
.dilog {
position: absolute;
z-index: 1001;
width: 80%;
left: 10%;
top: 10%;
padding: 20px;
background-color: #fff;
}
</style>
FAQs
a webrtc lib for vue
The npm package webrtclib receives a total of 1 weekly downloads. As such, webrtclib popularity was classified as not popular.
We found that webrtclib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.