1.0.0 • Published 2 years ago

@video-js-plugins/videojs-ads-markers v1.0.0

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

VideoJS Ads Marker Plugin

With this plugin you possible to add markers to videojs progress and render some component (HTML) inside videojs when progress hits markers.

Demo ads marker

Requirment

  • ReactJs version >= 17.0.2
  • Video.Js version ^7.18.1

Don't worry. This requirment will auto install if you haven't installed it.

Install

npm i @video-js-plugins/videojs-ads-marker

or with yarn

yarn add @video-js-plugins/videojs-ads-marker

Quick Use

import '@video-js-plugins/videojs-ads-markers'

const MyComponent = () => {
    return (
        <div className="my-component">
            <h1>Render Component Here</h1>
        </div>
    )
}

const markerData = [
    {
        time: '20',
        render: <MyComponent/>
    },
    {
        time: '30',
    }
]

player.adsMarker(markerData)

API

Marker

PropertyDescriptionTypeDefault
timeThe time at which the marker will be placed. This value in secondsfloat0
renderContent to be rendered in the videojsstring or react componentundefined
stopOnMarkerStop video when progress hits markerbooleantrue
markerShow or hide marker on video progress bar.booleanundefined
payloadAny custom data you want to pass through markerobject{}

Config

PropertyDescriptionTypeDefault
stopOnMarkerStop video when progress hits marker. this will apply to all marker data.booleantrue
onDetectedMarkerCallback when progress hits marker. with one parameter containing marker data.function(data)undefined
markerShow or hide marker on video progress bar. this will apply to all marker data.booleantrue