GithubHelp home page GithubHelp logo

contently / videojs-annotation-comments Goto Github PK

View Code? Open in Web Editor NEW
167.0 28.0 50.0 105.51 MB

A plugin for video.js to add support for timeline moment/range comments and annotations

Home Page: https://contently.github.io/videojs-annotation-comments/

License: Other

JavaScript 75.08% HTML 11.16% CSS 2.02% SCSS 9.40% Handlebars 2.34%
videojs videojs-player annotations videojs-plugin

videojs-annotation-comments's Introduction

CircleCI

AnnotationComments : Collaborate in your VideoJS player

AnnotationComments Screenshot1

Upgrading v1 -> v2

Please note that the event based API has changed. In version 1, you can subscribe to plugin events with pluginInstance.on(). In version 2, the same functionality is available with pluginInstance.registerListener(). The following docs are for the latest version.

About

Background

Collaboration between videographers and clients can be tedious, with emails and phone calls that waste time trying to reference specific frames and areas of the screen. This plugin enables more efficient collaboration from the browser.

This plugin was conceived and developed as a Hack Week project at Contently by Evan Carothers and Jack Pope. Continuing our focus and commitment to multimedia support at Contently, the entire team productized and bulletproofed the plugin as a flexible solution to be used in our product and other open-source use cases.

Goals

  • Efficient for videographers and clients alike - Provides useful collaboration features including annotations, comments/replies, ranged time markers, and more, with intuitive controls.
  • SIMPLE & LIGHTWEIGHT - Everything is contained within the plugin and player element. There is no need to build additional UI components. Just install VideoJS, register the plugin, setup whatever backend storage you wish, and start collaborating.
  • EXTENSIBLE - The plugin can be integrated with existing commenting systems (as we did within Contently), and makes very few assumptions about how to store annotations. Custom events are available for communicating with external APIs, providing support for on-page interactions and data persistence. Simple CSS overrides can also allow for branding customizations with minimal effort, or completely custom UI/UX.

VideoJS Plugins

VideoJS is a popular open-source HTML5 video player library used by 400k+ sites. As of v6, there is an extendable plugin architecture which was used to create this plugin. This plugin is built and tested against VideoJS v7

Use it!

Install

yarn add @contently/videojs-annotation-comments

OR

npm install @contently/videojs-annotation-comments

Add it to your VideoJS player

As a script from build

// ...videojs & videojs-annotation-comments have been loaded in script tags...
var player = videojs('video-id');
var plugin = player.annotationComments(pluginOptions)

As a module

import videojs from 'video.js'
import AnnotationComments from '@contently/videojs-annotation-comments'
 videojs.registerPlugin('annotationComments', AnnotationComments(videojs))
 var player = videojs('video-id')
var plugin = player.annotationComments(pluginOptions)

Plugin options / configuration

When initializing the plugin, you can pass in an options array to override default options. Any excluded options are set to their default values, listed below:

const pluginOptions = {
    // Collection of annotation data to initialize
    annotationsObjects: [],
    // Flexible meta data object (currently used for user data, but addl data can be provided to wrap each comment with metadata - provide the id of the current user and fullname of the current user at minimum, which are required for the UI)
    meta: { user_id: null, user_name: null },
    // Use arrow keys to move through annotations when Annotation mode is active
    bindArrowKeys: true,
    // Show or hide the control panel and annotation toggle button (NOTE - if controls are hidden you must provide custom UI and events to drive the annotations - more on that in "Programmatic Control" below)
    showControls: true,
    // Show or hide the comment list when an annotation is active. If false, the text 'Click and drag to select', will follow the cursor during annotation mode
    showCommentList: true,
    // If false, annotations mode will be disabled in fullscreen
    showFullScreen: true,
    // Show or hide the tooltips with comment preview, and annotation shape, on marker hover or timeline activate
    showMarkerShapeAndTooltips: true,
    // If false, step two of adding annotations (writing and saving the comment) will be disabled
    internalCommenting: true,
    // If true, toggle the player to annotation mode immediately after init. (NOTE - "annotationModeEnabled" event is not fired for this initial state)
    startInAnnotationMode: false
};

Annotation Data Structure

To initialize the plugin with the annotationsObjects collection, use the following structure:

const annotationsObjects = [{
    id: 1,
    range: {
        start: 10,
        end: 15
    },
    shape: {
        x1: 23.47,
        y1: 9.88,
        x2: 60.83,
        y2: 44.2
    },
    comments: [{
        id: 1,
        meta: {
            datetime: '2017-03-28T19:17:32.238Z',
            user_id: 1,
            user_name: 'Jack Pope'
        },
        body: 'The first comment!'
    }]
}];

Programmatic Control

If you'd like to drive the plugin or render plugin data through external UI elements, you can configure the plugin to hide the internal components and pass data through custom events. There are two kinds of AnnotationComments API events, externally fired and internally fired.

Waiting for Plugin Ready

Before triggering any events on the plugin, you must wait for it to be ready. You can use the onReady function on the plugin:

plugin.onReady(() => {
    // do stuff with the plugin, such as fire events or setup listeners
});

Supported Externally Fired Events:

These events are external actions that can be called from your scripts to trigger events within the plugin:

// openAnnotation : Opens an annotation within the player given an ID
plugin.fire('openAnnotation', { id: myAnnotationId });
 // closeActiveAnnotation : Closes any active annotation
plugin.fire('closeActiveAnnotation');
 // newAnnotation : Adds a new annotation within the player and opens it given comment data
plugin.fire('newAnnotation', {
    id: 1,
    range: { start: 20, end: null },
    shape: { // NOTE - x/y vals are % based (Floats) in video, not pixel values
        x1: null,
        x2: null,
        y1: null,
        y2: null
    },
    commentStr: "This is my comment."
});
 // destroyAnnotation : Removes an annotation and it's marker within the player given comment data
plugin.fire('destroyAnnotation', { id: 1 });
 // newComment : Adds a new comment to an Annotation given an Annotation ID and a body
plugin.fire('newComment', { annotationId: 1, body: "My comment string" });
 // destroyComment : Removes a comment from an Annotation given a Comment ID
plugin.fire('destroyComment', { id: 1 });
 // addingAnnotation : Plugin enters the adding annotation state (adding an annotation at the current player timestamp)
plugin.fire('addingAnnotation');
 // cancelAddingAnnotation : Plugin exits the adding annotation state
plugin.fire('cancelAddingAnnotation');
 // toggleAnnotationMode : toggle annotation mode to alternative on/off value
plugin.fire('toggleAnnotationMode');

Supported Internally Fired Events:

These are events that are triggered from within the running plugin and can be listened for by binding to plugin.registerListener within your scripts:

// annotationOpened : Fired whenever an annotation is opened
plugin.registerListener('annotationOpened', (event) => {
   // event.detail =
   // {
   //      annotation: (object) annotation data in format {id:.., comments:..., range:..., shape:...},
   //      triggered_by_timeline: (boolean) TRUE = the event was triggered via a timeline action (like scrubbing or playing), FALSE = the annotation was opened via marker click, UI button interactions, or API/event input
   // }
});
// annotationClosed : Fired whenever an annotation is closed
plugin.registerListener('annotationClosed', (event) => {
   // event.detail = annotation (object) in format {id:.., comments:..., range:..., shape:...}
});
// addingAnnotationDataChanged : Fired from adding annotation state if:
//  1. the marker is dragged
//  2. the start of the marker is moved via control buttons
//  3. the shape is dragged
plugin.registerListener('addingAnnotationDataChanged', (event) => {
   var newRange = event.detail.range; // returns range data if range was changed
   var newShape = event.detail.shape; // returns shape data if shape was changed
   // do something with the data
});
// annotationDeleted : Fired when an annotation has been deleted via the UI
plugin.registerListener('annotationDeleted', (event) => {
   // annotationId = event.detail
});
// enteredAnnotationMode : Fired when the plugin enters adding annotation mode
// includes initial range data
plugin.registerListener('enteredAddingAnnotation', (event) => {
   var startTime = event.detail.range.start;
   // do something when adding annotation state begins
});
// onStateChanged: Fired when plugin state has changed (annotation added, removed, etc)
// This is a way to watch global plugin state, as an alternative to watching various annotation events
plugin.registerListener('onStateChanged', (event) => {
   // event.detail = annotation state data
});
// playerBoundsChanged : Fired when the player boundaries change due to window resize or fullscreen mode
plugin.registerListener('playerBoundsChanged', (event) => {
   var bounds = event.detail;
   // do something with the new boundaries
});
// Entering annotation mode (annotation icon was clicked when previously 'off')
plugin.registerListener('annotationModeEnabled', (event) => {
   // do something
});
// Exiting annotation mode (annotation icon was clicked when previously 'on')
plugin.registerListener('annotationModeDisabled', (event) => {
   // do something
});

Develop and Build

We're using yarn for package management and gulp as our build system.

The fastest way to get started:

  • Clone the repo
  • Run yarn install
  • Run yarn build
  • Run yarn watch
  • Visit http://localhost:3004/test.html to see the magic happen.

Templates

We're using the Handlebars templating library to render various components within the plugin. For performance, the templates are pre-compiled into a JS file within the development environment. That way we only need to require the Handlebars runtime, saving nearly 100kb from the minified build! ⚡️

The gulp templates task is used to precompile every template to /src/js/compiled/templates.js. This file should not be modified directly, but rather the templates themselves in /src/templates should be modified if changes are needed. The templates task will run automatically within gulp watch.

UI / CSS Customization

The plugin uses SASS and all styles are defined in annotaitons.scss. There is extenssive commenting on classes and styles in the file. The plugin uses a deep level of specificity to prevent styles from polluting elements on the page, and all classes are prefixed with vac- to prevent classname collisions in the global namespace.

You can extend/modify colors and elements quite easily by writing an overrides stylesheet to address the specific elements that you wish to modify. You can also change the variable colors in the stylesheet and compile yourself for more customization.

NOTE - our gulp build tasks use an auto-prefixer to make the styles work cross-browser, so be sure to run that yourself if you compile the SASS files with changes.

Testing

Feature tests

Feature tests are currently browser-based and run by visiting http://localhost:3004/mocha/features/index.html. Feature tests can be added as files in the /test/mocha/features/ directory and then included within the index.html file as a external scripts.

Unit tests

Unit tests are run through the gulp test task. If the tdd task is included in gulp watch, the tests will run with every change to the test files. Each module should have a corresponding unit test file within the /test/mocha/modules directory.

Gulp commands

gulp watch: Fires up webserver @ http://localhost:3004/test.html, watches for any file changes in /src, including js, css (scss), and templates (.hbs), repackages, and transpiles to an unminified file in /build on change.

gulp transpile: Transpiles modules/files to build file in /build with JS maps

gulp build: Runs transpilation, browserify, sass, then minifies to distribution filename in /build with attribution

gulp templates: Uses Handlebars to pre-compile templates into a javascript file. See Templates section above.

gulp test: Runs the mocha unit tests within the /test/mocha/modules/ directory.

gulp lint: Runs jshint linter on javascript files in /src

License

This plugin is licensed under the Apache License, Version 2.0, which is the same license used by Video.js

videojs-annotation-comments's People

Contributors

aaackerman avatar allankcrain avatar dglatstein avatar drichar avatar ecaroth avatar eyaylagul avatar jackpope avatar semantic-release-bot avatar zodern avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

videojs-annotation-comments's Issues

ERROR: TypeError: Templates[templateName] is not a function

After gulp build in compiled version and as well as test page, I am getting below error

VIDEOJS: ERROR: TypeError: Templates[templateName] is not a function
at PlayerButton.renderTemplate (player_ui_component.js:70)
at PlayerButton.render (player_button.js:29)
at new PlayerButton (player_button.js:12)
at new Controls (controls.js:34)
at AnnotationComments.postLoadDataConstructor (annotation_comments.js:61)
at HTMLDivElement.data.dispatcher (video.js:1866)
at trigger (video.js:2002)
at Player.trigger$1 [as trigger] (video.js:2887)
at Player. [as handleTechLoadeddata_] (video.js:28708)
at HTMLVideoElement.data.dispatcher (video.js:1866)
(anonymous) @ video.js:80
log.error @ video.js:268
data.dispatcher @ video.js:1868
trigger @ video.js:2002
trigger$1 @ video.js:2887
Player. @ video.js:28708
data.dispatcher @ video.js:1866

Video JS version: 7.6.6
Videojs-annotation-comments: 2.0.1
Node: 10.6.3
NPM: 6.9.0

How can I use videojs-annotation-comments in React?

Hello sir.
I am a new developer in react and video.js.
I am going to use videojs-annotation-comments plugin in Reactjs.
when I import videojs-annotation-comments plugin, I can get such error .
>>Error: Cannot find module './videojs-annotation_comments' from '..\plugins\editor.video\res\build\ warning: Error running grunt-browserify. Use --force to continue
I have downloaded videojs-annotation-comments file.
but there is no components videojs-annotation-comments for using react.js.
how can I fix this issue?

Template pre-compilation shouldn't require handlebars to be installed globally

Referenced gulp task

A gulp-shell cmd is used to pre-compile the handlebars templates because the available gulp libraries wouldn't provide a working commonJS format. Even the handlebars cli -c option, which should handle the runtime requirement seems to have a bug which replaces the runtime with the first template filename. So the requirement is manually added to the top of the file.

A quick improvement would be to check if the handlebars cli is available within the task and install it if it is not.

Ideally, this process would not require an additional cli or gulp-shell.

Ability to edit an existing comment

Currently one cannot edit the text of an existing comment. Also, one cannot change the shape or range via UI. Is this intentional? If that is the case, what is the purpose of the following event addingAnnotationDataChanged .

Ability to update annotations from state object (onStateChanged) - emitStateChangeEvent

We have listener

// onStateChanged: Fired when plugin state has changed (annotation added, removed, etc)
// This is a way to watch global plugin state, as an alternative to watching various annotation events

plugin.registerListener('onStateChanged', (event) => {
// event.detail = annotation state data
});

Currently there is no alternatives for this event in emitters api, it may be tricky to roll updated state using atomic operations. And it will be great to allow full rerender just passing new state data into some event emitter.

Cannot delete comments that were created programmatically

Expected Behavior

Any comment can be deleted programmatically via API with the destroyComment event

Actual Behavior

Comments created by the UI or defined in annotationsObjects on initialization can be deleted with destroyComment, but comments created programmatically with the newComment event result in this error:

Uncaught (in promise) TypeError: Cannot read property 'destroyComment' of undefined

if(comment) comment.commentList.destroyComment(event);

It seems that comments created programmatically are set inside plugin.annotationState with the commentList property undefined:
image

Steps to Reproduce the Problem

  1. Initialize plugin with an annotation in annotationsObjects with id: 1
  2. Add a new comment to annotation via API: plugin.fire('newComment', { annotationId: 1, body: "My comment string" })
  3. Call plugin.fire('destroyComment', { id: newCommentId })

I confirmed this is happening by calling destroyComment in this test:

describe('newComment', () => {

Specifications

  • Version: 2.0.0

Error: Cannot find module

I've been very excited to start using v2.0.0! After the new release I installed via npm and imported as a module in my project. I got the following errors in Gulp:

[18:49:47] [app:js] Error: Cannot find module './handlebars/safe-string' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './handlebars/exception' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './handlebars/utils' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './handlebars/runtime' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './handlebars/no-conflict' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './utils' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './exception' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './helpers' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './decorators' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './logger' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './decorators/inline' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module '../utils' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './helpers/block-helper-missing' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './helpers/each' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './helpers/helper-missing' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './helpers/if' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './helpers/log' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './helpers/lookup' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './helpers/with' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module '../exception' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './base' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './lib/polyfills' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './dist/cjs/handlebars.runtime' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './lib/utils' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './components/controls' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './components/annotation_state' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './lib/event_dispatcher' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './../lib/player_ui_component' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './../lib/utils.js' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './comment_list' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './marker' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './comment' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './shape' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './../lib/utils' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './../lib/player_component' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './annotation' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './draggable_marker.js' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './selectable_shape.js' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './player_button' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './player_component' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module './../compiled/templates' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module 'ie-array-find-polyfill' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'
[18:49:47] [app:js] Error: Cannot find module 'es6-object-assign' from '/Users/drichar/Projects/Pixwel/platform/ui/node_modules/@contently/videojs-annotation-comments/build'

Weird issue whenever I change the src of the video

Hello,

My company is currently testing to see whether this plugin suits our needs. We are seeing if it could be used for a tool in which the user can select between different video clips and annotate each one. However, whenever we change the src attribute of the video, this visual bug comes up...

screen shot 2019-01-03 at 4 09 49 pm

Every time I change the src attribute of the video, a duplicate annotation button is added to the video player.
So if I change the src attribute of the video player three times, three notification buttons show up on the controls.

We are integrating it with AngularJS. And we are doing it all within a single page. Is there anyway we can resolve this issue?

Yarn build error.

image

Node: v12.16.0
Glup verions
CLI version: 2.2.1
Local version: 4.0.2

Can you pls anyone help me to fix it?

Importing plugin with ES6: videojs_annotation_comments_1.default is not a function

Trying to initialize the plugin (v1.1.1 with videojs v6.9.0 and @types/videojs v7.2.5) with with ES6+React using this import code:

import videojs from 'video.js';
import AnnotationComments from 'videojs-annotation-comments';

and this code to register the plugin and initialize the player:

    videojs.registerPlugin('annotationComments', AnnotationComments(videojs));
    this.player = videojs(this.videoNode, videojsOptions);

And I am getting this error:

TypeError: videojs_annotation_comments_1.default is not a function

I believe it may be related to this similar issue with generator-videojs-plugin, related to the plugin using browserify, but I'm not sure. Any ideas?

Adapting videojs-annotation-comments to images

Hi there,
We are considering using this awesome plugin with videojs and we want to make it work with images too. Have anyone an idea about how we can do this? what are the dependencies between videojs and this plugin ? how we can remove these dependencies or how we can update the code to work on both videos and images?

Thank's

Viewing of comments/annotations in mobile devices

We are evaluating this plugin to see if this can be used to create video annotations.

We noted that this plugin is tested against various desktop browsers. We did some initial responsive/mobile devices testing, mainly looking to see if the annotations/comments can be viewed in mobile devices.

  • iOS - Able to view annotations, however, it does not load the annotations UI elements in full screen mode.
  • Andorid - The button appears. However, none of the UI elements are shown (not able to view).

Is there any plan to support viewing of annotations in mobile/responsive devices?

Cannot select a shape

Hello,

Currently the 'select shape + range' function does not work for me. I was wondering if the typos in file 'selectable_shape.js' are causing the issue. For example:
in line 58 $(document).on(mouseup.vac-sshape-${this.playerId}, e => { instead of vac-sshape shouldn't it be vac-shape?

jQuery implicit dependency ?

Hi guys,
Very nice plugin here! I'd love to try to integrate it, but it seems to me that there is an implicit dependency to jQuery (and we don't want to load jQuery globally). Can you confirm me that, or am i wrong?
Would it be possible to build a js file that would include $ (or maybe a more lightweight alternative) inside the build scope ?
Thx!

Drupal integration

I am currently using Video.js for a Drupal 8 site. The owner of the site was wanting the ability for Annotated video. That is what led me to your plugin.
My question is have you tried adding it to a drupal installation?

Cannot dispose, teardown, or reset plugin without error

Hi I am attempting to use this plugin with videojs v6.2.0 since that is the latest that you have said is supported. I am working on a student project where I am making a video viewing type page. My goal is to be able to switch the video and add a new set of annotations to each video. To do this I would need to reset the annotations each time I set a new source to the videojs object. When I attempt to dispose the plugin I get this error:

TypeError: Cannot read property 'teardown' of undefined at AnnotationComments.dispose

I noticed that there is a "resetData" event in the source code, but this is not available in the event registry. If it is possible to easily reset the plugin, so I can change the source of the videojs object, then add new annotations for the new video source after clearing the old ones, that would be awesome.

Uncaught ReferenceError: pluginOptions is not defined

Hello there,

When I add the following codes to the app.js file, I get the error in the header on the google browser screen.

Where exactly do I post comments and how can I resolve the error. I only have index.html and app.js files. I have completed my other npm install installations.
I read the documentation but did not fully understand it. I give an example. I want to comment on the 5th second.

app.js

var player = videojs('my-video');
var plugin = player.annotationComments(pluginOptions)

index.html
`

  <!-- If you'd like to support IE8 (for Video.js versions prior to v7) -->
  <script src="https://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>
  <script type="module" src="/app.js"></script>
  <script type="module" src="/demo.js"></script>

  </head>

  <body>
   <video id="my-video" class="video-js" controls preload="auto" width="640" height="264" poster="jordan.jpg"
    data-setup="{}">
    <source src="jordan.mp4" type="video/mp4" />
    <source src="MY_VIDEO.webm" type="video/webm" />
    <p class="vjs-no-js">
        To view this video please enable JavaScript, and consider upgrading to a
        web browser that
        <a href="https://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
    </p>
   </video>
  <script src="/node_modules/video.js/dist/video.min.js"></script>
  <script src="/dist/Youtube.min.js"></script>
  <script src="https://vjs.zencdn.net/7.8.4/video.js"></script>

  <script src="/videojs-annotation-comments.min.js"></script>
`

Any updates soon?

Hello,

are there any updates coming soon? the source getting outdated 🤖
at least you can update the gulpfile.js to match the new NodeJS and GulpJs versions :)

How to listen for new comment replies/annotation being added

I could not find listeners to the following events:

  1. Annotation Added
  2. Comment Added
  3. Comment Deleted

All the 3 events are emitted via the onStateChanged event, thus determining the specific atomic event that just occurred is difficult.

Is there something I am missing here? Or, do I need to write some logic on my end to figure these operations out from the onStateChaged listener

$ is not defined

Hi,

I have tried to use this plugin but I could not start the basic example. You can see my project here

On the console window, you will see the error I am getting.

What is the problem here?

Thanks

Test page rises a error

Hello, I've been trying to test the plugin in order to better understand how to manage annotations.
I've cloned the repo, and followet the instructions in Readme concerning "Develop and build", but once launched the yarn watch, and opened the browser, looking at the console, the following error is shown.
How to deal with it?

VIDEOJS: ERROR: TypeError: "Templates[templateName] is not a function" renderTemplate player_ui_component.js:70 render comment.js:38 Comment comment.js:21 comments comment_list.js:19 CommentList comment_list.js:17 buildComments annotation.js:28 Annotation annotation.js:19 _annotations annotation_state.js:34 set annotation_state.js:34 postLoadDataConstructor annotation_comments.js:59 dispatcher video.min.js:12 le video.min.js:12 trigger video.min.js:12 <anonymous> video.min.js:12 dispatcher video.min.js:12 video.min.js:12:695 e http://localhost:3004/video.js/dist/video.min.js:12 error http://localhost:3004/video.js/dist/video.min.js:12 dispatcher http://localhost:3004/video.js/dist/video.min.js:12 le http://localhost:3004/video.js/dist/video.min.js:12 trigger http://localhost:3004/video.js/dist/video.min.js:12 <anonima> http://localhost:3004/video.js/dist/video.min.js:12 dispatcher http://localhost:3004/video.js/dist/video.min.js:12

Change annotationsObjects after initialization

Is there a way to update the annotationsObjects property after the plugin has been initialized?

Use case:
I have an API that is polled to fetch changes to annotation made by other users every X seconds. This is an attempt to make the collaboration more real-time. Once the data is fetched I wanted to switch the initial annotationsObjects with the fresh annotationsObjects fetched over the wire.

I am currently using React, and in case this is a React-only thing, please do let me know so that I can narrow my scope to debug the issue.

Sample Code:

import React from "react";
import videojs from "video.js";
import "video.js/dist/video-js.css";
import AnnotationComments from "@contently/videojs-annotation-comments";
import "@contently/videojs-annotation-comments/build/css/annotations.css";

export default class VideoPlayer extends React.Component {
  constructor(props) {
    super(props);
    this.state = { init: false };
  }

  componentDidMount() {
    // instantiate Video.js
    this.player = videojs(this.videoNode, this.props, function onPlayerReady() {
      console.log("onPlayerReady", this);
    });
    videojs.registerPlugin("annotationComments", AnnotationComments(videojs));
  }

  // destroy player on unmount
  componentWillUnmount() {
    if (this.player) {
      this.player.dispose();
    }
  }

  componentDidUpdate() {
    this.updateAnnotations();
  }

  updateAnnotations() {
    const pluginOptions = {
      // Collection of annotation data to initialize
      annotationsObjects: this.props.annotationsObjects,
      // Flexible meta data object (currently used for user data, but addl data can be provided to wrap each comment with metadata - provide the id of the current user and fullname of the current user at minimum, which are required for the UI)
      meta: this.props.userDetails,
      // Use arrow keys to move through annotations when Annotation mode is active
      bindArrowKeys: false,
      // Show or hide the control panel and annotation toggle button (NOTE - if controls are hidden you must provide custom UI and events to drive the annotations - more on that in "Programmatic Control" below)
      showControls: true,
      // Show or hide the comment list when an annotation is active. If false, the text 'Click and drag to select', will follow the cursor during annotation mode
      showCommentList: true,
      // If false, annotations mode will be disabled in fullscreen
      showFullScreen: true,
      // Show or hide the tooltips with comment preview, and annotation shape, on marker hover or timeline activate
      showMarkerShapeAndTooltips: true,
      // If false, step two of adding annotations (writing and saving the comment) will be disabled
      internalCommenting: true,
      // If true, toggle the player to annotation mode immediately after init. (NOTE - "annotationModeEnabled" event is not fired for this initial state)
      startInAnnotationMode: false,
    };
    this.annotationPlugin = this.player.annotationComments(pluginOptions);
    this.annotationPlugin.onReady(() => {
      this.annotationPlugin.teardown();
      this.annotationPlugin.registerListener("onStateChanged", (event) => {
        this.props.syncAnnotations(event.detail);
      });
    });
  }

  // wrap the player in a div with a `data-vjs-player` attribute
  // so videojs won't create additional wrapper in the DOM
  // see https://github.com/videojs/video.js/pull/3856
  render() {
    return (
      <div>
        <div data-vjs-player>
          <video
            ref={(node) => (this.videoNode = node)}
            className="video-js vjs-theme-forest"
          ></video>
        </div>
      </div>
    );
  }
}

Here annotationObjects are passed to this component as a prop, but changes to the prop don't reflect the annotation to become updated.

Thanks in advance

Edit ranged marker on progress bar

Description

I want to add ranged marker on progress bar which has:

  1. Start and end point dragable (in case editing marker) on progress bar when clicked.
  2. Action trigger after dragging start/end point
  3. Color can be customize

Question

a. It is possible to having 1,2 when adding new annotation. But I can not edit annotation. Is there something I miss out?
b. Is 3 possible (eg. adding custom class for annotation)

Additional Information

versions

    "@contently/videojs-annotation-comments": "^2.0.1",
    "imports-loader": "^0.8.0",
    "jquery": "^3.4.1",
    "video.js": "^7.6.6"

browsers

Currently using Chrome, also experienced on Firefox

OS

Windows 10

Demo repo

https://github.com/vanlinha3k35pbc/progress-bar-marker-demo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.