maestro-videojs-vast

0.0.7-alpha • Public • Published

maestro-videojs-vast

Usage

import videojs from 'maestro-videojs-vast';
 
import React from 'react';
import videojs from 'maestro-videojs-vast/dist/maestroVideoJsVast.min.js'
import 'maestro-videojs-vast/dist/maestroVideoJsVast.css'
 
export default class VideoPlayer extends React.Component {
  componentDidMount() {
    // instantiate Video.js
    // make sure you pass in a fallback empty src URL for the video
    this.player = videojs(this.videoNode, this.props, function onPlayerReady() {
      console.log('onPlayerReady', this)
    });
    this.player.ads();
    this.player.vast({
      url: "<vast_url_here>"
    });
  }
 
  // destroy player on unmount
  componentWillUnmount() {
    if (this.player) {
      this.player.dispose()
    }
  }
 
  // 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"></video>
        </div>
      </div>
    )
  }
}
 

EVENTS

All HTML5 video events, plus videojs event and vast events

Event Description
adcanplay ad can play
adclick ad link was clicked
vast-adended ad ended
adpause ad was paused
adtimeupdate ad time update
vast-preoroll-removed ad has ended
vast-preroll-skip ad was skipped

METHODS

All video.js methods plus...

Method Description
player.trigger('vast-preroll-skip') skips vast ad

CREDIT

video.js
video-contrib-ads
videojsx-vast-plugin

Readme

Keywords

none

Package Sidebar

Install

npm i maestro-videojs-vast

Weekly Downloads

1

Version

0.0.7-alpha

License

MIT

Unpacked Size

484 kB

Total Files

24

Last publish

Collaborators

  • shazimajaz
  • ferm9494
  • luiz-maestro
  • sterlbuck
  • barbaradorame
  • maestro-devops-robot
  • eldade
  • bruno-albino
  • deliton
  • uzielvaldez
  • alexalmadav
  • marioario
  • sjanderson