@werift/whip
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

https://github.com/medooze/whip-whep-js

Example

browser

import { WhipSender } from "@shinyoshiaki/whip";

//Get mic+cam
const stream = await navigator.mediaDevices.getUserMedia({
  audio: true,
  video: true,
});

//Create peerconnection
const pc = new RTCPeerConnection();

//Send all tracks
for (const track of stream.getTracks()) {
  //You could add simulcast too here
  pc.addTrack(track);
}

//Create whip client
const whip = new WhipSender();

const url = "https://whip.test/whip/endpoint";
const token =
  "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IndoaXAgdGVzdCIsImlhdCI6MTUxNjIzOTAyMn0.jpM01xu_vnSXioxQ3I7Z45bRh5eWRBEY2WJPZ6FerR8";

//Start publishing
whip.publish(pc, url, token);

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @werift/whip

    Weekly Downloads

    0

    Version

    0.0.3

    License

    MIT

    Unpacked Size

    16.6 kB

    Total Files

    5

    Last publish

    Collaborators

    • shinyoshiaki