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

@bouncedinc/opentok-annotation

v2.0.63

Published

OpenTok annotation accelerator pack

Downloads

37

Readme

OpenTok Labs

Disclaimer: Please keep in mind that this is an OpenTok Labs project which means that it's not officially supported by TokBox.

Accelerator Annotation for JavaScript

Build Status GitHub release license MIT npm

Quick start

The OpenTok Accelerator Annotation provides functionality you can add to your OpenTok applications that enables users to have the ability to annotate on a local or remote screen. This section shows you how to prepare and use the OpenTok Annotations Accelerator Pack as part of an application.

Install

$ npm install --save opentok-annotation

If using browserify or webpack:

const annotation = require('opentok-annotation');

Otherwise, include the accelerator pack in your html:

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

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


Click here for a list of all OpenTok accelerator packs.

Explore the code

The following options fields are used in the AnnotationAccPack constructor:

| Feature | Field | Required | | ------------- | ------------- | -----| | Set the OpenTok session (object).| session |true| | Set the Common layer API (object) - Automatically set if using Core. | accPack |false| | Set the callback to receive the image data on screen capture (function). | onScreenCapture |false|

To initialize the accelerator pack:

var annotation = new annotationAccPack(options);

Once initialized, the following methods are available:

start

Creates an external window (if required) and links the annotation toolbar to the session. An external window is ONLY required if sharing the current browser window.

@param {Object} session
@param {Object} [options]
@param {Boolean} [options.screensharing] - Using an external window
@param {Array} [options.items] - Custom set of tools
@param {Array} [options.colors] - Custom color palette
@returns {Promise} < Resolve: undefined | {Object} Reference to external annotation window >

linkCanvas

Create and link a canvas to the toolbar and session. See notes about resizing the canvas below

@param {Object} pubSub - Either the publisher(sharing) or subscriber(viewing)
@param {Object} container - The parent container for the canvas element
@param {Object} options
@param {Object} [options.externalWindow] - Reference to the an external annotation window (publisher only)
@param {Object} [options.absoluteParent] - Reference element for resize if other than container

resizeCanvas

Trigger a manual resize of the canvas.

addSubscriberToExternalWindow

Add a subscriber's video to the external annotation window.

@param {Object} stream - The subscriber stream object

end

End annotation, clean up the toolbar and canvas(es)


The AnnotationAccPack triggers the following events via the common layer:

| Event | Description | | ------------- | ------------- | | startAnnotation | Annotation linked to session and toolbar created.| | linkAnnotation | Annotation canvas has been linked to the toolbar. | | resizeCanvas | The annotation canvas has been resized. | | annotationWindowClosed (screen sharing only) | The external annotation window has been closed.| | endAnnotation | Annotation has ended. Toolbar and canvases have been cleaned up. |

If using the common layer, you can subscribe to these events by calling registerEventListener on _accPack and providing a callback function:

accPack.registerEventListener('eventName', callback);

If using the Accelerator Core you can subscribe to these events by calling on on otCore and providing a callback function:

otCore.on('eventName', callback)

Best Practices for Resizing the Canvas

The linkCanvas method refers to a parent DOM element called the absoluteParent. When resizing the canvas, the annotation accelerator pack also resizes the canvas container element using inline properties. Because of this, we need another element to reference for dimensions. For this, we use the absoluteParent.

Multiparty video communication sample app using the Screensharing and Accelerator Annotation with best-practices for Javascript here.