0.0.7-alpha • Published 6 years ago

maestro-videojs-vast v0.0.7-alpha

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

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

EventDescription
adcanplayad can play
adclickad link was clicked
vast-adendedad ended
adpausead was paused
adtimeupdatead time update
vast-preoroll-removedad has ended
vast-preroll-skipad was skipped

METHODS

All video.js methods plus...

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

CREDIT

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

0.0.7-alpha

6 years ago

0.0.6-alpha

6 years ago

0.0.5-alpha

6 years ago

0.0.4-alpha

6 years ago

0.0.3-alpha

6 years ago

0.0.2-alpha

6 years ago

0.0.1-alpha

6 years ago