npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eyeson-node

v1.3.0

Published

eyeson video conferencing API package for nodejs

Downloads

8

Readme

eyeson-node JavaScript API Library

A NodeJS library for the Eyeson API. It provides a client that allows to easily build applications that can start and manage eyeson video conferences.

A full API documentation including all features is available at docs.eyeson.com/docs/rest/intro/.

Installation

Add eyeson-node to your JavaScript project using npm or yarn.

$ npm install --save eyeson-node
# or
$ yarn add eyeson-node

Usage

Get an API-KEY from developers.eyeson.team.

import Eyeson from 'eyeson-node'
const eyeson = new Eyeson({ apiKey: '< api-key >' }) // configure to use your api key

To create a new meeting join a room. Note: The string typed identifier id represents which room to join. Users joining the same room-id will be connected. If you do not specify an identifier, there will be a new meeting created with every join request.

Read more about creating a new meeting https://docs.eyeson.com/docs/rest/references/room

const user = await eyeson.join(username, roomIdentifier, options)
// Ensure the user (and meeting) is ready
await user.waitReady()

// Send a message into meeting chat...
await user.chat("/me sends a message")

// Update Layers and Layout
await user.setLayer({ url })
await user.clearLayer(layerIndex)

// Start a playback
await user.startPlayback({ url })

// Set a layout
await user.setLayout({ layout: "auto", show_names: false })

// Start and Stop Recoding
await user.startRecording()
await user.stopRecording()

// Start and Stop Broadcast
await user.startBroadcast(streamUrl)
await user.stopBroadcast()

// Stop a meeting for all participants
await user.stopMeeting()

Discover new functions:

// Snapshot info and delete
const snapshotInfo = await eyeson.getSnapshot(snapshotId)
const snapshots = await eyeson.getRoomSnapshots(roomId, page, startedAt)
await eyeson.deleteSnapshot(snapshotId)

// Recording info and delete
const recordingInfo = await eyeson.getRecording(recordingId)
const recordings = await eyeson.getRoomRecordings(roomId, page, startedAt)
await eyeson.deleteRecording(recordingId)

// Get user object after join
const user = await eyeson.getUser(accessKey)

// Register a guest user
const guest = await eyeson.registerGuest(username, guestToken, options)

// Start and stop a playback
await user.startPlayback({ play_id, url })
await user.stopPlayback(play_id)

// Send a custom message
await user.sendCustomMessage(message)

// Create a snapshot
await user.snapshot()

// Lock meeting to prevent new participants
await user.lockMeeting()

Layer updates

You can send local images:

import Eyeson from 'eyeson-node'
import fsPromise from 'node:fs/promise'

const eyeson = new Eyeson({ apiKey: '< api-key >' }) // configure to use your api key
const user = await eyeson.join(username)
const imageBuffer = await fsPromise.readFile('./overlay.png')
await user.sendLayer(imageBuffer, 1, 'png')
// or as jpg:
const imageBuffer = await fsPromise.readFile('./overlay.jpg')
await user.sendLayer(imageBuffer, 1, 'jpg')
// add an ID to check when it can be seen
await user.sendLayer(imageBuffer, 1, 'jpg', 'overlay-jpg')

Using the new eyeson-node-layer plugin you can create and send layers with ease.

import Eyeson from 'eyeson-node'
import EyesonLayer from 'eyeson-node-layer'

const user = eyeson.join('< username >', '< room id >', { options: { widescreen: true } })
const overlay = new EyesonLayer({ widescreen: true })
const timeEntry = overlay.addTextBox(new Date().toLocaleTimeString(), font, fontColor, x, y, origin, padding, maxWidth, radius, backgroundColor)
await user.sendLayer(overlay)
setTimeout(async () => {
    timeEntry.text = new Date().toLocaleTimeString()
    await user.sendLayer(overlay)
}, 60 * 1000) // update time every minute

Meeting observer

Since version 1.1.0, eyeson-node has the meeting observer included. You can read more about it here: https://docs.eyeson.com/docs/category/meeting-observer

import Eyeson from 'eyeson-node'
const eyeson = new Eyeson({ apiKey: '< api-key >' }) // configure to use your api key

const meeting = await eyeson.join(username)

const connection = eyeson.observer.connect(meeting.roomId)
connection.on('event', event => {
    if (event.type === 'room_update') {
        console.log(event.content)
    }
    else if (event.type === 'chat') {
        console.log(event.content)
    }
    else if (event.type === 'participant_update') {
        console.log(event.participant)
    }
    // and many more
})
// ...later...
connection.close() // closes automatically on shutdown

Permalink API

Since version 1.3.0, eyeson-node includes functions to use with Permalink API. You can read more about it here: https://docs.eyeson.com/docs/rest/features/permalink

import Eyeson from 'eyeson-node'
const eyeson = new Eyeson({ apiKey: '< api-key >' }) // configure to use your api key

const permalink = await eyeson.permalink.create('<username>', {
    name: '<room_name>',
    user: { id: '<user-id>' },
    options: { widescreen: true },
})
console.log(permalink.userToken, permalink.guestToken, permalink.data.links.gui, permalink.data.links.guest_join)

const list = await eyeson.permalink.getAll({ limit: 50, expired: false })

const permalink = await eyeson.permalink.getbyId('<permalink-id>') // can also be used to update "permalink.started"

const permalink = await eyeson.permalink.update('<permalink-id>', { options: { widescreen: false } })

await eyeson.permalink.delete('<permalink-id>')

const permalink = await eyeson.permalink.addUser('<permalink-id>', '<username>', { id: '<user-id>' })
console.log(permalink.userToken, permalink.data.links.gui)

await eyeson.permalink.removeUser('<permalink-id>', '<user-token>')

const user = await eyeson.permalink.joinMeeting('<user-token>')

const guest = await eyeson.permalink.registerGuest('<username>', '<guest-token>', { id: '<user-id>' }) // works only if permalink.started === true

Development

$ npm install
$ npm run test -- --watch
$ npm run build

Releases

  • 1.3.0 New: Permalink API
  • 1.2.1 sendLayer: add layer id parameter
  • 1.2.0 New functions; Layer updates
  • 1.1.0 Import/require; Type declaration; Meeting observer
  • 1.0.0 Initial release