woodstage / webrtc-api

webrtc promisify API

Home Page:https://woodstage.github.io/webrtc-api/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

webrtc

webrtc promisify API

NPM

Coveralls

npm package NPM downloads Average time to resolve an issue

Get to started

Initialize media stream

import { MediaStream, PeerConnection, DataChannel } from 'webrtc-api'

let mediaStream = new MediaStream({ video: true, audio: true });
mediaStream.initialize()
  .then(stream => {
    if (window.URL) {
      video.src = window.URL.createObjectURL(stream);
    } else {
      video.srcObject = stream;
    }
  })

Peer connection and data channel

let peerConnection = new PeerConnection();
let dataChannel = new dataChannel(peerConnection, 'message');
peerConnection.initialize()
  .then(() => {
    dataChannel.initialize();
    return connA.createOffer();
  })
  .then(offer => {
    //Send offer to oppsite client through backend signaling server
  })

There are lots of living demos.

LICENSE

Apache License 2.0

About

webrtc promisify API

https://woodstage.github.io/webrtc-api/

License:Apache License 2.0


Languages

Language:JavaScript 100.0%