# Advertisement

Note

This feature is available only to ByteArk Video Cloud for Business customers. Please contact sales@byteark.com if you would like to use it.

ByteArk Player supports advertisement playback using the Google Interactive Media Ads SDK (Google IMA SDK for HTML5) (opens new window), following the Video Ad Serving Template (VAST) (opens new window) standard.

ByteArk Player can request ads from many ad servers, including:

  • Google DoubleClick for Publishers (DFP)
  • Google AdSense network
  • Any VAST-compliant ad server

# Supported ad formats

Because ads are rendered via Google IMA SDK for HTML5, refer to Google's Support and Compatibility (opens new window) document for supported formats.


# Enable advertisement

Enable advertisement playback by specifying plugins.bytearkAds in options. Configure the parameters per the options table below.

{
  fluid: true,
  poster: '/assets/samples/player/images/poster-big-buck-bunny.jpg',
  sources: [{
    title: 'Big Buck Bunny',
    src: '<MEDIA_URL>',
    type: 'application/x-mpegURL'
  }],
  plugins: {
    bytearkAds: {
      adTagUrl: '<VAST_TAG_URL>',
    }
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# Options

Name Type Required Description
adTagUrl String No URL of the VAST, VMAP, or VPAID ad tag
integration String No Ad integration to use: google-ima or castoola
adTagParameters Object No Key-value parameters to send to the ad server
adsResponse String No XML string of the VAST/VMAP/VPAID response
showAdMarker Boolean No Show ad markers on the control bar
ads Array No List of inline ads

# Example

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
  </head>
  <body>
    <div id="video-player"></div>
    <script src="https://byteark-sdk.cdn.byteark.com/player/v2/byteark-player.min.js"></script>
    <script>
      var player = bytearkPlayer('video-player', {
        fluid: true,
        sources: [{
          title: 'Big Buck Bunny',
          src: '<MEDIA_URL>',
          type: 'application/x-mpegURL'
        }],
        plugins: {
          bytearkAds: {
            adTagUrl: '<VAST_TAG_URL>',
          }
        }
      });
    </script>
  </body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

# Sending adTagParameters to Google Ad Manager

  1. Add integration: 'google-ima' to the bytearkAds plugin options.
  2. Add adTagParameters with the keys and values you want to send. See the VAST ad tag URL parameters documentation for Google Ad Manager (opens new window).

Note

If a key in adTagParameters matches a key already in the adTagUrl query string, the value from adTagParameters overrides the one in adTagUrl.

# Using macros for Google Ad Manager

The ByteArk Ads plugin substitutes known macros automatically — e.g., [url] is replaced with the current page URL before sending to Google Ad Manager.

{
  ...
  integration: 'google-ima',
  adTagParameters: {
    url: '[url]'
  }
}
1
2
3
4
5
6
7

Supported macros

Macro Type Value Description
url String [url] Current page URL where the video is playing

# Sending adTagParameters to Castoola

  1. Add integration: 'castoola' to the bytearkAds plugin options.
  2. Add adTagParameters with the keys and values from the documentation provided by Castoola.

# Using macros for Castoola

Many runtime values can be passed via macros. The plugin detects the value at runtime and substitutes the macro before sending to Castoola.

{
  ...
  integration: 'castoola',
  adTagParameters: {
    operating_system: '[operating_system]'
  }
}
1
2
3
4
5
6
7

Supported macros

Macro Type Value Description
device_type String [device_type] 1=PC, 2=Smartphone, 3=Tablet, 4=STB, 5=Smart TV
dt String [dt] Short form of device_type
operating_system String [operating_system] 1=Windows, 2=macOS, 3=Linux, 4=ChromeOS, 5=Android, 6=iOS, 7=Android TV, 8=Tizen TV, 9=WebOS, 10=tvOS, 11=VIDAA TV, 12=Roku TV, 13=Fire TV, 0=Other
os String [os] Short form of operating_system
content_id String [content_id] From videoId in the Source Object
cid String [cid] Short form of content_id
content_name String [content_name] From title of the Source Object, or lighthouse.video.videoTitle
cnam String [cnam] Short form of content_name
genre String [genre] From lighthouse.video.genres
gnr String [gnr] Short form of genre