Socket
Socket
Sign inDemoInstall

vue-webrtc

Package Overview
Dependencies
57
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    vue-webrtc

WebRTC video component for Vue 3


Version published
Weekly downloads
87
increased by4.82%
Maintainers
1
Install size
28.3 MB
Created
Weekly downloads
 

Readme

Source

vue-webrtc

WebRTC component designed for Vue 3 ... See the DEMO

Join npm npm Contributions welcome License

See this for browser compatibility.

Installation

npm install vue-webrtc --save

Usage

import Vue from 'vue'
import WebRTC from 'vue-webrtc'
Vue.use(WebRTC)

// or
import { VueWebRTC } from 'vue-webrtc'
Vue.component(VueWebRTC.name, VueWebRTC)

// or
import { VueWebRTC } from 'vue-webrtc';
export default {
    name: 'App',
    components: {
        'vue-webrtc': VueWebRTC
    },
    ...

// template
<vue-webrtc ref="webrtc" width="100%" roomId="sample-room">
</vue-webrtc>

Testing & Dev

npm run serve

Props

proptypedefaultnotes
roomIdstring'public-room'id of the room to join
socketURLstring'https://weston-vue-webrtc-lobby.azurewebsites.net'URL of the signaling server, use this default or run your own, see .\vue-webrtc-lobby
cameraHeightnumber160height of video element
autoplaybooleantrueautoplay attribute
screenshotFormatstring'image/jpeg'format of screenshot
enableAudiobooleantrueenables audio on join
enableVideobooleantrueenables video on join
enableLogsbooleanfalseenables webrtc console logs
deviceIdstringnullset video device id to a camera from navigator.mediaDevices.enumerateDevices()
peerOptionsstring{ }set SimplePeer options such as STUN and TURN from here https://github.com/feross/simple-peer
ioOptionsstring{ rejectUnauthorized: false, transports: ['polling', 'websocket'] }set Socket IO from here https://socket.io/docs/v4/client-options/

Events

nameparamnotes
opened-roomroomidemitted when the first user opens the room
joined-roomvideoemitted when anyone joins the room
left-roomvideo.idemitted when anyone leaves the room
share-startedvideo.idemitted when a local screen share stream starts
share-stoppedvideo.idemitted when a local screen share stream stops

Methods

nameparamnotes
joinvoidJoin a room, opening it if needed
leavevoidLeave a room
capturevoidCapture the current image through the webcam as base64 encoded string
shareScreenvoidShare your screen or an app as video

Styles

.video-list

.video-item

History

VersionNotes
3.0.1Added ioOptions for Socket IO
3.0.0Migrated from Vue 2 to Vue 3
2.0.0Replaced signaling server and webrtc library with SimplePeer
1.2.2Added stunServer and turnServer properties
1.2.1Added Vue CLI sample, npm audit fixes
1.2.0Added the Screen Share button

Upgrading from V2 to V3

V3 of this component is a migration from Vue 2 to Vue 3. There is no new functionality yet. The older V2 will only be patched as needed and maintained as Vue 2.

Upgrading from V1 to V2

V2 of this component is mostly compatible with V1 but it completely replaces the internals with a new signaling server and a new SimplePeer client. Due to this, you will need to set the [socketUrl] to a new instance of the included .\vue-webrtc-lobby socket server. There is a default instance that you are welcome to use but you should run your own. If you are using STUN and TURN settings, you will now need to set those in [peerOptions] .

Quick Start with Vue CLI

vue create sample
cd sample
yarn install
npm install vue-webrtc --save

Now open the App.vue file and replace the HelloVue component with the code in the Usage section above.

npm run serve

See the /sample folder for a working project

Roadmap

Some features that we would like to see added are:

  • Chat component
  • Audio selection
  • WebRTC data events

Let us know what you'd like to see next and vote for a feature.

License

MIT

Credits

Author: @AndyWeston on GitHub at vue-webrtc

This project is based off of:

SimplePeer

SimpleSignal

FAQs

Last updated on 19 Apr 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc