1.0.35 • Published 3 years ago

opentok-screen-sharing v1.0.35

Weekly downloads
1,851
License
MIT
Repository
github
Last release
3 years ago

Accelerator Screensharing for Javascript

Build Status GitHub release license MIT npm

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
startScreenSharingWe've started publishing/sharing the screen.
endScreenSharingWe've stopped publishing/sharing the screen.
screenSharingErrorA 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

1.0.35

3 years ago

1.0.34

4 years ago

1.0.33

5 years ago

1.0.32

6 years ago

1.0.30

6 years ago

1.0.29

6 years ago

1.0.28

6 years ago

1.0.27

7 years ago

1.0.26

7 years ago

1.0.25

7 years ago

1.0.24

7 years ago

1.0.23

7 years ago

1.0.22

8 years ago

1.0.21

8 years ago

1.0.20

8 years ago

1.0.19

8 years ago

1.0.18

8 years ago

1.0.17

8 years ago

1.0.16

8 years ago

1.0.15

8 years ago

1.0.14

8 years ago

1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago