Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

opentok-screen-sharing

Package Overview
Dependencies
Maintainers
2
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

opentok-screen-sharing

OpenTok screen sharing accelerator pack

  • 1.0.35
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
415
decreased by-47.2%
Maintainers
2
Weekly downloads
 
Created
Source

Accelerator Screensharing for Javascript

Build Status GitHub release license MIT npm

Tokbox is now known as Vonage

Quick start

The OpenTok Screensharing Accelerator Pack provides functionality you can add to your OpenTok applications that enables users to share the screen. This section shows you how to use the accelerator pack.

Install

$ npm install --save opentok-screen-sharing

If using browserify or webpack:

const screenSharing = require('opentok-screen-sharing');

Otherwise, include the accelerator pack in your html:

<script src="../your/path/to/opentok-screen-sharing.js"></script>

. . . and it will be available in global scope as ScreenSharingAccPack


Click here for a list of all OpenTok accelerator packs.

Exploring the code

The ScreenShareAccPack class in opentok-screen-sharing.js is the backbone of the screen share feature for the app. This class sets up the screen share UI views and events, and provides functions for sending, receiving, and rendering shared screens.

Initialization

The following options fields are used in the ScreenShareAccPack constructor:

FeatureFieldRequired
Set the OpenTok session (object).sessiontrue
Set the screen container (string).screenSharingContainerfalse
Set the Common layer API (object).accPackfalse
Set the ID of the Chrome extension (string).extensionIDfalse
Append a link tag for Chrome Web Store inline install (boolean) (defaults to true).appendWebStoreLinkfalse
Set the download path for the FireFox extension (string).extentionPathFFfalse
Using screen sharing with the annotation accelerator pack.annotationfalse
If using annotation, should we use an external window.externalWindowfalse
Set the container to append the start/stop button (string).controlsContainerfalse
Append the start/stop button to the DOMappendControlfalse
Set custom properties for the publisher (object)localScreenPropertiesfalse
Allow screen sharing over http in development (boolean)devfalse

Once you define the options, you simply create a new instance of the ScreenShareAccPack:

      const screenShareOptions = {
       session: session,
       extensionID: myChromeExtensionID,
       extentionPathFF: myFirefoxExentionPath,
       screensharingParent: myParentContainer,
     };
     const screenSharing = new ScreenShareAccPack(screenShareOptions);
ScreenShareAccPack Methods

The ScreenShareAccPack component has the following methods:

MethodDescription
extensionAvailable()Test whether an extension is available.
start()Start sharing screen.
end()Stop sharing screen.
Events

The ScreenSharingAccPack component emits the following events:

EventDescription
startScreenSharing We've started publishing/sharing the screen.
endScreenSharing We've stopped publishing/sharing the screen.
screenSharingError A screen sharing error occurred.

If using the screen sharing accelerator pack with Accelerator Core, you can subscribe to these events by calling on on otCore and providing a callback function:

otCore.on('eventName', callback)

Multiparty video communication sample app using the Accelerator Screensharing with best-practices for Javascript (https://github.com/opentok/accelerator-sample-apps-js)

Development and Contributing

Interested in contributing? We :heart: pull requests! See the Contribution guidelines.

Getting Help

We love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either:

Further Reading

Keywords

FAQs

Package last updated on 01 Sep 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc