0.1.0 • Published 2 years ago

@benshi.ai/bs-video v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

bs-video

bs-video is a wrapper over the native video element that automatically tracks the interactions (play, pause, etc) and sends the corresponding logs through @benshi.ai/js-sdk, which must be installed in the main application

Usage

In the main file of the project, import the module:

import '@benshi.ai/bs-video'

There is also need to include the polyfills to use the component within a framework:

import { applyPolyfills, defineCustomElements } from '@benshi.ai/bs-video/loader';


applyPolyfills().then(() => {
    defineCustomElements(window);
});

Finally, insert the <bs-video> tag in your HTML template:

<bs-video 
    ref={videoRef}
    media-id='video_123'
    src='<path to video>' 
    width='500' 
    controls
    content-block={ContentBlock.ELearning}
/>

Note the reference to the element. The reason for that is the need of an initialization:

import {
    Navigation,
    ContentBlock,
} from '@benshi-ai/js-sdk'

videoRef.current.injectNavigation(Navigation)

API

Properties

PropertyAttributeDescriptionTypeDefault
autoplayautoplayInherited from native componentbooleanundefined
contentBlockcontent-blockBlock where the video is inserted (i.e.: ContentBlock.ELearning, ContentBlock.ECommerce)stringundefined
controlscontrolsInherited from native componentbooleanundefined
heightheightInherited from native componentstringundefined
looploopInherited from native componentbooleanundefined
mediaIdmedia-idIdentifier for this video, as defined in the catalogstringundefined
metadatametadataObject with all the known properties of this media elementanyundefined
posterposterInherited from native componentstringundefined
srcsrcInherited from native componentstringundefined
widthwidthInherited from native componentstringundefined

Methods

injectNavigation(navigationModule: any) => Promise<void>

Call this method is mandatory to initialize the logger, otherwiser the component will be unable to send logs automatically

Returns

Type: Promise<void>

0.1.0

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago