prebid / prebid-js-plugin-brightcove

Other
3 stars 4 forks source link

bc_prebid_vast

A free and open source library for publishers to quickly implement a plugin for a videoJS player, such as Brightcove Player. This plugin may be used to invoke prebid.js to execute the prebidding process. It may also be used to render the "selected" video ad within the player.

This README is for developers who want to use and/or contribute to bc_prebid_vast. Additional documentation can be found at the Brightcove Prebid Plugin homepage. Sample integrations can be found under "Samples" in the "Brightcove Plugin" section of Prebid.js External Plugins. Table of Contents

Plugin Partners

A successful deployment of this plugin includes not only a build of two plugin components but also builds of other components that are provided in this repository and a companion repository. The “plugin” itself is actually made up of two components:

When registering the plugin, either on the page or in Brightcove Studio, you should use the URL to the plugin loader. The loader will automatically know how to load the main plugin script, either from the default location or using a custom path.

The other components partners include:

Install

$ git clone https://github.com/prebid/prebid-js-plugin-brightcove.git
$ cd prebid-js-plugin-brightcove
$ npm install

Note: You need to have NodeJS 6.x or greater installed.

Build Stand-Alone Plugin

To build the project on your local machine, run:

$ gulp
or
$ gulp build

This runs some code quality checks and generates the following files:

Test Locally

To run the unit tests:

gulp test

To generate and view the code coverage reports:

gulp ci-test

Build and Run a Project Locally

Steps:

  1. (optional) Update host file
  2. (optional) Modify path to ad renderer - by default, MailOnline
  3. Build the plugin
  4. Select test page to test with
    a. Modify path to your prebid plugin build
    b. (optional) Modify path to prebid plugin CSS file
    c. (optional) Modify path to MailOnline CSS file
    d. (optional) Modify path to the prebid.js

Update Host File (optional step)

To build and run this project locally, if you are planning on using an AppNexus bidder you must first modify your host file to setup an alias for local.prebid. Otherwise, your "localhost" domain may become blacklisted by AppNexus.

Add the following line to your host file:

127.0.0.1       local.appnexus

Modify path to MailOnline plugin (optional step)

You can either create your own custom build of the MailOnline plugin or you can replace the MailOnline plugin with your own ad rendering code.

Using your own build of MailOnline plugin

If you have either created your own build of the MailOnline plugin or are replacing the MailOnline plugin with your own rendering code, you will need to modify the path that the plugin uses to load the rendering plugin.

Using your own rendering code

If you are replacing the MailOnline rendering plugin with your own custom rendering code, you need to change the code where currently an ad renderer is loaded and invoked.

Build the Plugin

Build and run the project locally with:

gulp dev-server

This builds the plugin and starts a web server at http://local.prebid:8082 serving from the project root.

Select Test Page

Sample Test Pages

There are several test pages provided with the plugin that use the plugin in a variety of ways. These test pages are provided in the repository at: ./tests/e2e/testPages/

You may select whichever style you want to test. See http://prebid.org/dev-docs/plugins/brightcove-prebid-plugin/BC-Prebid-Plugin-Options.html for details on all the options that can be passed to the plugin.

Test Page Modifications

Before testing, you may need to make the following changes to your selected test page:

As an example, to run the prebid-body.html test page, go to:

As you make code changes, the bundles will be rebuilt but you must refresh the page to test the new code.

Deploy the Plugin

When you are ready to deploy your build of this plugin, you need to make sure that all the paths are set up correctly. Depending on how you are integrating the plugin with your player, the paths can be defined:

Make sure the following paths are correct:

Contribute

SSPs and publishers may contribute to this project.

For guidelines, see Contributing.

Our PR review process can be found here.

Code Quality

Code quality is defined by .eslintrc and errors are reported in the terminal.

If you are contributing code, you should configure your editor with the provided .eslintrc settings.

Unit Testing with Karma

    $ gulp test

This will run the tests. To keep the Karma test browser open, you need to modify karma.conf.js to set singleRun to false.

Detailed code coverage reporting can be generated explicitly with

    $ gulp ci-test

The results will be in

    ./coverage

Supported Browsers

bc_prebid_vast is supported on Internet Explorer 11+ and modern browsers.

Governance

Review our governance model here.