Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@theoplayer/adscript-connector-web

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@theoplayer/adscript-connector-web

A connector implementing AdScript with THEOplayer

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

adscript-connector-web

The AdScript connector provides an AdScript integration for THEOplayer.

Installation

Install using your favorite package manager for Node (such as npm or yarn):

npm

npm install @theoplayer/adscript-connector-web

yarn

yarn add @theoplayer/adscript-connector-web

Usage

First you need to add the AdScript connector to your app :

  • Add as a regular script

<script type="text/javascript" src="path/to/adscript-connector.umd.js"></script>
<script type="text/javascript">
    const player = new THEOplayer.Player(element, configuration);

    // Define your configuration for the connector:
    const adScriptConfig = {
        implementationId: 'your-implementation-id', // Replace this!
        metadata: {
            "assetid": "v0000001",
            "type": "content",
            "program": "Big Buck Bunny",
            "title": "Sample Video - Extended",
            "length": "635",
            "crossId": "000 111 22222",
            "livestream": "0",
            "channelId": "",
            "attribute": "1"
        },
        debug: false
    }

    // Create the AdScriptConnector:
    const adScriptConnector = new THEOplayerAdScriptConnector.AdScriptConnector(player, adScriptConfig);
</script>
  • Add as an ES2015 module

<script type="module">
    import {AdScriptConnector} from "@theoplayer/adscript-connector-web";

    const player = new THEOplayer.Player(element, configuration);

    // Define your configuration for the connector:
    const adScriptConfig = {
        implementationId: 'your-implementation-id', // Replace this!
        metadata: {
            "assetid": "v0000001",
            "type": "content",
            "program": "Big Buck Bunny",
            "title": "Sample Video - Extended",
            "length": "635",
            "crossId": "000 111 22222",
            "livestream": "0",
            "channelId": "",
            "attribute": "1"
        },
        debug: false
    }

    // Create the AdScriptConnector:
    const adScriptConnector = new AdScriptConnector(player, adScriptConfig);
</script>

Updating metadata

If the metadata has changed during playback, you can update it with:

adScriptConnector.updateMetadata(newMetadata);

Updating userInfo

If the user info has changed during playback, you can update it with:

adScriptConnector.updateUser(i12n);

FAQs

Package last updated on 09 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc