Skip to content

Commit

Permalink
Merge pull request #149 from cloudinary/APPS-2454-shoppable-video-sid…
Browse files Browse the repository at this point in the history
…ebar

APPS-2454-shoppable - Interactive plugin clean up
  • Loading branch information
tsi authored Apr 22, 2020
2 parents b2fb09d + 84de6a0 commit 8b15be1
Showing 5 changed files with 20 additions and 16 deletions.
5 changes: 4 additions & 1 deletion src/components/shoppable-bar/shoppable-widget.js
Original file line number Diff line number Diff line change
@@ -23,7 +23,10 @@ class ShoppableWidget {
constructor(player, options = {}) {
this.options_ = videojs.mergeOptions(OPTIONS_DEFAULTS, options);
this.player_ = player;
this.render();

this.init = () => {
this.render();
};

if (this.options_.showPostPlayOverlay) {
this.player_.on('ended', () => {
11 changes: 0 additions & 11 deletions src/plugins/cld-interactive-video/index.js

This file was deleted.

4 changes: 2 additions & 2 deletions src/plugins/index.js
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import 'videojs-contrib-ads';
import './ima';
import 'dashjs';
import 'videojs-contrib-dash';
import shoppable from './cld-interactive-video';
import interactive from './interactive-plugin';
// #endif
import 'videojs-per-source-behaviors';
import autoplayOnScroll from './autoplay-on-scroll';
@@ -21,6 +21,6 @@ export {
cloudinary,
analytics,
// #if (!process.env.WEBPACK_BUILD_LIGHT)
shoppable
interactive
// #endif
};
10 changes: 10 additions & 0 deletions src/plugins/interactive-plugin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import ShoppableWidget from '../../components/shoppable-bar/shoppable-widget';

export default function interactivePlugin(player, options) {

// Shoppable Video
if (options.shoppable) {
new ShoppableWidget(player, options.shoppable).init();
}

}
6 changes: 4 additions & 2 deletions src/video-player.js
Original file line number Diff line number Diff line change
@@ -522,8 +522,10 @@ class VideoPlayer extends Utils.mixin(Eventable) {
if (publicId instanceof VideoSource) {
return this.videojs.cloudinary.source(publicId, options);
}
if (this.videojs.shoppable) {
this.videojs.shoppable(this.videojs, options.shoppable);

// Interactive plugin - available in full (not light) build only
if (this.videojs.interactive) {
this.videojs.interactive(this.videojs, options);
}

if (VideoPlayer.allowUsageReport()) {

0 comments on commit 8b15be1

Please sign in to comment.