MailOnline / VPAIDFLASHClient

Exposes FLASH VPAID API to JS
MIT License
22 stars 20 forks source link

VPAIDFLASHClient

bitHound Score Code Climate Build Status devDependency Status Test Coverage

About

JS + Flash wrapper for VPAID.

VPAID or Video Player Ad-Serving Interface Definition, establishes a common interface between video players and ad units, enabling a rich interactive in-stream ad experience.

Because some of the ad's are in flash, this projects will allow to expose the api to be used by js.

JS is responsible of:

Flash is responsible of:

The goals of VPAIDFLASHClient are:

check videosjs-vast-vpaid if you need VPAID in videojs

TODO

JS

The project uses:

Flash

Flash is compiled using Flex SDK.

Debug

Flash debugger

Allows to flash to throw errors in a popup like window. To install go to adobe support page and install the flash player with content debugger in the name for the correct OS. PS:

Running the project

Example of the usage

var flashVPaid = new VPAIDFLASHClient(element, flashVPAIDWrapperLoaded);
function flashVPAIDWrapperLoaded(err, result) {
    if (err) {
        //handle error here
        return;
    }

    flashVPaid.loadAdUnit('TestAd.swf', function (error, adUnit) {

        if (err) {
            //handle error here
            return;
        }

        adUnit.on('AdLoaded', function (err, result) {
            console.log('event:AdLoaded', err, result);
            startAd();
        });

        adUnit.on('AdStarted', function (err, result) {
            console.log('event:AdStarted', err, result);
            checkAdProperties();
        });

        adUnit.handshakeVersion('2.0', function (err, result) {
            initAd();
        });

        function initAd() {
            adUnit.initAd(0, 0, 'normal', -1, '', '', function (err) {
                console.log('initAd', err);
            });
        }

        function startAd() {
            adUnit.startAd(function (err, result) {
                console.log('startAd call', err, result);
            });
        }

        function checkAdProperties() {
            adUnit.getAdIcons(function (err, result) {
                console.log('getAdIcons', result);
            });
            adUnit.setAdVolume(10, function (err, result) {
                console.log('setAdVolume', result);
            });
            adUnit.getAdVolume(function (err, result) {
                console.log('getAdVolume', result);
            });
        }

    });
}

for the api of VPAIDFLASHClient check VPAIDFLASHClient.js, for adUnit api check IVPAIDAdUnit.js.

License

licensed under the MIT License, Version 2.0. View the license file

Copyright © 2015 MailOnline