0.1.2 • Published 3 years ago

vue-webrtc-audio v0.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
3 years ago

vue-webrtc

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

Join npm npm Contributions welcome License

See this for browser compatibility.

Installation

npm install vue-webrtc --save

yarn add vue-webrtc

Usage

import Vue from 'vue'
import WebRTC from 'vue-webrtc'

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

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

Testing & Dev

npm run dev
npm run demo

Props

proptypedefaultnotes
roomIdstring'public-room'id of the room to join
socketURLstring''URL of the signaling server
cameraHeightnumber160height of video element
autoplaybooleantrueautoplay attribute
screenshotFormatstring'image/jpeg'format of screenshot
enableAudiobooleantrueenables audio on join
enableVideobooleantrueenables video on join
enableLogsbooleanfalseenables webrtc console logs
stunServerstringnullset STUN server url to 'stun:yourSTUN.com:port'
turnServerstringnullset TURN server url to 'username@password%turn:yourTURN.com:port'

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
1.2.2Added stunServer and turnServer properties
1.2.1Added Vue CLI sample, npm audit fixes
1.2.0Added the Screen Share button

Quick Start with Vue CLI

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

Now open the App.vue file and add the code in the Usage section above.

npm run serve

See the /sample folder

Roadmap

There are many more features provided by the RTCMultiConnection library that we'd like to support, including:

  • Camera selection (we currently use the default camera)
  • 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 the excellent work found at WebRTC Experiments: https://www.rtcmulticonnection.org/

The Vue.js work is based on this camera component:
@vinceg vue-web-cam