...
Code Block | ||
---|---|---|
| ||
var placementConfig = { publisherId: '[Publisher_ID]', channelId: '[Channel_ID]', ref1: '', width: 300, height: 250, autoPlayerrorLimit: 5, true, position loop: 'aniplayer' true, vastRetry: 3, errorLimit: 5,}; |
Placement Javascript
The player code is located at https://player.aniview.com/webm/aniview-display.js
Placement Instantiation
Code Block | ||
---|---|---|
| ||
myPlacement = new avDisplay(placementConfig);
myPlacement.play(); |
Putting it all together
Code Block | ||
---|---|---|
| ||
<div id="aniplayer"></div> <script type="text/javascript" id="aniviewJS"> (function() { var myPlacement; var placementConfig = { soundButtonpublisherId: true'[Publisher_ID]', pauseButtonchannelId: true, '[Channel_ID]', preloader: { ref1: type: '', width: link : 300, '', height: clickthrough: '', }250, midRollTimeerrorLimit: 2 5, position : 'aniplayer' }; |
Player Javascript
The player code is located at https://player.aniview.com/script/6.1/aniview.js
Player Instantiating
Code Block | ||
---|---|---|
| ||
myPlayer= new avPlayer(adConfig);
myPlayer.play(); |
Putting it all together
Code Block | ||
---|---|---|
| ||
<div id="aniplayer"></div> <script type="text/javascript" id="aniviewJS"> (function( (new Image).src = "https://track1.aniview.com/track?pid="+placementConfig.publisherId+"&cid="+placementConfig.channelId+"&e=playerLoaded"+"&cb="+Date.now(); var placementUrl = 'https://player.aniview.com/webm/aniview-display.js'+'?v=1&type=s&pid='+placementConfig.publisherId; function downloadScript(src,adData) { var myPlayer; var adConfig = { publisherId: scp = document.createElement('script'); scp.src = src; scp.onload = function() { myPlacement = new avDisplay(placementConfig); myPlacement.play(); '[Publisher_ID]', channelId: '[Channel_ID]', ref1: '', width: 300, height: 250, autoPlay: true, loop: true, vastRetry: 3, errorLimit: 5, soundButton: true, pauseButton: true, preloader: { type: '', link : '', clickthrough: '', }, midRollTime: 2, position : 'aniplayer' }; (new Image).src = "https://track1.aniview.com/track?pid="+adConfig.publisherId+"&cid="+adConfig.channelId+"&e=playerLoaded"+"&cb="+Date.now(); var PlayerUrl = 'https://player.aniview.com/script/6.1/player.js'+'?v=1&type=s&pid='+adConfig.publisherId; function downloadScript(src,adData) { var scp = document.createElement('script'); scp.src = src; scp.onload = function() { myPlayer= new avPlayer(adData); myPlayer.play(adConfig); }; document.getElementsByTagName('head')[0].appendChild(scp); }; downloadScript(PlayerUrl,adConfig); })(); </script> |
adConfig Configuration Options
...
Name
...
Mandatory
...
Default Value
...
Values
...
Description
...
publisherId
...
Yes
...
String
...
Aniview publisher id
...
channelId
...
Yes
...
String
...
Aniview channel id from the same account of the publisher id used
...
position
...
Yes
...
String
...
the div id where the player should be created
...
loop
...
No
...
false
...
Boolean
...
loop is used to control looping of video preloader
true: At the end of content video, continue looping
false: No content loop
To control ad loops, use maxrun or maximp
...
width
...
yes
...
Number
...
The player width in pixels
If width = 100 and height = 0, width is auto detected based on containing element
...
height
...
yes
...
Number
...
The player height in pixels
If width = 100 and height = 0, height is auto detected based on containing element and is calculated as width / 1.777
...
minHeight
...
No
...
Number
...
Minimum player height - Used with width/height of 100/0
...
minWidth
...
No
...
Number
...
Minimum player width - Used with width/height of 100/0
...
maxRun
...
No
...
Number
...
Maximum number of waterfall runs in the player session
...
maxImp
...
No
...
Number
...
Maximum number of impressions per player session
...
vastRetry
...
No
...
Number
...
Number of consecutive waterfall retries without delay so the number of runs is 1 + vastRetry
...
errorLimit
...
No
...
Number
...
Maximum number of (1 + vastRetry) runs of the waterfall that do not generate impression.
This means (1 + vastRetry) * (1 + errorLimit) - max number of consecutive waterfall runs that do not generate impression
If there is an impression the counter reset to 0
...
format
...
No
...
“all”
...
String with “js”, “html5“
...
Choose a format to play, If “html5” than vpaids will not run in the player
...
autoplay
...
No
...
true
...
Boolean
...
Defines if calling startAd automatically. If false, startAd should be called after getting onLoad callback event.
With the ShortTag template this is managed automatically in order to play the ad when in view.
...
ref1
...
No
...
String
...
Macro list
ref1: “AV_MACRO1=value1&AV_MACRO2=value2“
Values should be URL encoded
...
preloader
...
Used to display content while the player is searching for ads
...
type
...
No
...
String
...
“Content” : video preloader
“Image“ : Image
“js“ : Javascript that runs in an iframe
...
link
String
Array
Object
...
Link to resource url
If preloader type is Content, can also be an array of videos
If preloader is type js, it can be an object defining the iframe to run - similar to the options in passbackUrl
...
clickthrough
String
Array
...
Clickthrough url when clicking on the content. Not relevant in js
If preloader is Content, can also be an array of clickthrough urls per video in the content array
...
poster
...
String
...
If preloader type is Content, url of an image to display while content is loading
...
autoplay
...
String
...
If preloader type is Content, indicate if to start the content video automatically or its click to play
...
midrolltime
...
No
...
0
...
Number
...
Number of seconds to wait between each (1 + vastRetry) waterfall runs
...
midrolldelay
...
No
...
0
...
Number
...
Number of seconds to wait before running the waterfall the first time
...
startaddelay
...
No
...
Auto calculated
...
Number
...
Number of seconds to wait for higher priority ad source to return with AdLoaded before calling startAd to the highest priority ad source that already responded with AdLoaded
...
startmidroll
...
No
...
0
...
Number
...
Delay in seconds to wait before calling startAd after the end of an impression. This will create a minimal delay between ad videos
...
startdelay
...
No
...
0
...
Number
...
Delay in seconds of calling startAd the first time
...
midrollfunc
...
No
...
null
...
function
...
If midrollfunc is defined, it is called before running the waterfall every time. its parameter is a callback function to call and will continue the operation
Its a way to control the calls to the waterfall in a very granular way
...
soundbutton
...
No
...
true
...
Boolean
...
Show or not show the sound button
...
pausebutton
...
No
...
true
...
Boolean
...
Show or not the pause/play button
...
closebutton
...
No
...
true
...
Boolean
...
Show or not the close button
...
Skip
...
No
...
false
...
Boolean
...
Show or not the skip button
...
skipTimer
...
No
...
Number
...
Time to wait before showing the skip button. Required to be > 0 for skip button functionality
...
skipText
...
No
...
String
...
Text to show in skip button
...
closeevent
...
No
...
false
...
Boolean
...
If true, when clicking the close x button, the player is not closed and AdClosed event is fired. Its the responsibility of the wrapping code to close the player with the close() api
...
passbackUrl
...
No
...
string
...
Link to a javascript that will execute in an iframe and will be displayed after the player finishes all its retries and impressions, contact support for the exact format
It can also be an object as defined below
...
reqOnView
...
No
...
Boolean
...
If true, play calls ad sources only when in view
...
startAdOnView
...
No
...
Boolean
...
If true, calls to startAd will be done only when the player is in view
...
startAdOnViewPerc
...
No
...
Number
...
Viewability % used for startAdOnView. Default is 50
...
reqOnViewTopDist
...
No
...
Number
...
Player will send requests only if the distance of the top of the player to the bottom of the viewport is below reqOnViewTopDist pixels
Requires reqOnView: true
...
passbackUrl
...
No
...
object
...
url
...
No
...
String
...
Link to javascript to write into the iframe. passback tags can be used as is without any special formatting
...
width
...
No
...
100%
...
Number
...
width of passback iframe
iframe is centered
...
height
...
No
...
100%
...
Number
...
height of passback iframe
iframe is centered
...
color
...
No
...
“#000“
...
String
...
background color
...
passbackpriority
...
No
...
false
...
Boolean
...
If true, passback will be used also if preloader is defined
...
hideControls
...
No
...
false
...
Boolean
...
Hide player controls or not
...
logo
...
No
...
true
...
Boolean
...
If false, does not show the player logo
...
customLogo
...
Enable showing a custom logo
...
link
...
String
...
Link to logo image
...
height
...
Number
...
height in pixels of the logo
...
width
...
Number
...
width in pixels of the logo
...
text
...
String
...
Text to display near the logo, for example, “Ads by“
...
top
...
Number
...
Amount of pixels from the top to show the logo
...
clickthrough
...
String
...
Url to open when clicking on logo
...
waitforconsent
...
No
...
true
...
Boolean
...
If true, player will open only after receiving consent
...
maxp
...
No
...
5
...
Number
...
Max concurrent calls to vpaid initAd
...
autosounddetect
...
No
...
False
...
Boolean
...
If autosounddetect is true, the ads player will try to start ads with volume on. If its not supported ads will start muted. (Not supported on IOS)
...
autosoundvolume
...
No
...
Number
...
Volume set up, between 0-1
...
imarpm
...
No
...
Number
...
Limit max requests per minute for all IMA ad sources in the waterfall
...
vastIconEnabled
...
No
...
Boolean
...
If true, if a vast includes an icon definition, the icon will be displayed on one of the ad corners
...
adscontrolpositioning
...
No
...
'right'
...
String
...
Moves the volume and fullscreen icons away from the right side.
This config can be use to avoid conflict with google IMA skip button
Player API
new avPlayer(adConfig)
Instantiate the player object with the adConfig configuration
play()
Start the player instance. Should be called only once
mute()
Mute the audio of the currently playing video
unmute()
Unmute the current playing video
Must be called as a result of user click action in the page
pause()
Pause the currently playing video
resume()
Resume the player if it’s paused
startAd()
Should be used only with autoPlay: false
After getting the AdLoaded event, can be used in order to call startAd to the ad. The player will automatically continue after that to call the next ads
close()
Close the player and stop its functionality
updateGui(config)
Can be used to set specific gui options
config is an object that can include one or more configurations. Possible settings:
close: true/false
show or hide the close buttonskip: true/false
Show or hide the skip buttonplayPause: true/false
Show or hide the play/pause buttonsound: true/false
Show or hide the sound buttonlogo: true/false
Show or hide the player logo
resize(width, height)
Resize the player to the requested width and height
getAdDuration()
Returns the current ad duration in seconds
getAdRemainingTime()
Returns the number of seconds remaining till the end of the current playing ad
getAdVolume()
Returns the volume of the current playing ad
setAdVolume(vol)
Set the current ad volume
getAdCompanions()
Returns the ad companions string of the current playing ads from the vast response
getWidth()
Returns the player width in pixels
getHeight()
Returns the player height in pixels
on(evt, func, context)
Register an event listener for player events
off(evt, func)
Unregister an event/function
startViewability(elid, callback, ratio)
Start viewability monitoring in the player
Parameters:
elid: The element to measure, by default will use the player position
callback: Callback function to call on every viewability change. Callback function parameters:
Boolean: in view or not
Number: Current ratio of viewability
String: State that indicates if below/above/partial the fold
Viewability ratio defined as viewable. Default is 0.5
stopViewability()
Stop viewability monitoring
getViewability()
Returns current viewability of the player
getContentPaused()
Returns a boolean to indicate if the content video is playing or not
getContentCurrentTime()
Returns the content video current time
pauseContent()
Pause the currently playing video content
resumeContent()
Resume playing of the video content
setContentVolume(vol)
Set the volume of the content
pausePlayer()
Pause calls to startAd
ResumePlayer()
Resume calls to startAd
getReadyAds()
Returns the number of ready ads (Ads in AdLoaded state)
setWaterfallState(state, force)
Pause or resume additional calls to startAd.
...
state
...
force
...
description
...
true
...
true
...
Resume calls to startAd. If there is a loaded event call startAd
...
true
...
false
...
Do not use
...
false
...
false
...
Pause calls to startAd. Do not stop currently running call to startAd if there is any
...
false
...
true
...
Pause calls to startAd. If there is an active call to startAd that did not respond yet, kill it.
startTemplate(aniBox)
Start player template implementation. See below for details on template configuration
setAdConfig({atribute:value})
Update the player config
startFloat({attribute:value})
Start or restart the floating using an alternate floating object, for example:
startFloat({"closeButton":true,"floatOnBottom":true,"position":"Bottom-Right","size":0.7,"bottom":5,"right":5,"resize":true})
stopFloat()
...
};
document.getElementsByTagName('head')[0].appendChild(scp);
};
downloadScript(placementUrl,placementConfig);
})();
</script> |
placementConfig Configuration Options
Name | Mandatory | Default Value | Values | Description |
publisherId | Yes | String | Aniview publisher id | |
channelId | Yes | String | Aniview channel id from the same account of the publisher id used | |
position | Yes | String | the div id where the player should be created | |
width | yes | Number | The player width in pixels If width = 100 and height = 0, width is auto detected based on containing element | |
height | yes | Number | The player height in pixels If width = 100 and height = 0, height is auto detected based on containing element and is calculated as width / 1.777 | |
minHeight | No | Number | Minimum player height - Used with width/height of 100/0 | |
minWidth | No | Number | Minimum player width - Used with width/height of 100/0 | |
maxRun | No | Number | Maximum number of waterfall runs in the player session | |
maxImp | No | Number | Maximum number of impressions per player session | |
errorLimit | No | Number | Maximum number of (1 + vastRetry) runs of the waterfall that do not generate impression. This means (1 + vastRetry) * (1 + errorLimit) - max number of consecutive waterfall runs that do not generate impression If there is an impression the counter reset to 0 | |
ref1 | No | String | Macro list ref1: “AV_MACRO1=value1&AV_MACRO2=value2“ Values should be URL encoded | |
clickthrough | String Array | Clickthrough url when clicking on the content. Not relevant in js If preloader is Content, can also be an array of clickthrough urls per video in the content array | ||
Skip | No | false | Boolean | Show or not the skip button |
skipTimer | No | Number | Time to wait before showing the skip button. Required to be > 0 for skip button functionality | |
skipText | No | String | Text to show in skip button | |
passbackUrl | No | string | Link to a javascript that will execute in an iframe and will be displayed after the player finishes all its retries and impressions, contact support for the exact format It can also be an object as defined below | |
passbackUrl | No | object | ||
width | No | 100% | Number | width of passback iframe iframe is centered |
height | No | 100% | Number | height of passback iframe iframe is centered |
hideControls | No | false | Boolean | Hide player controls or not |
Placement API
avDisplay(placementConfig)
Instantiate the placement object with the placementConfig configuration
play()
Start the player instance. Should be called only once
pause()
Pause the currently playing video
resume()
Resume the player if it’s paused
close()
Close the player and stop its functionality
resize(width, height)
Resize the player to the requested width and height
getWidth()
Returns the player width in pixels
getHeight()
Returns the player height in pixels
on(evt, func, context)
Register an event listener for player events
off(evt, func)
Unregister an event/function
startViewability(elid, callback, ratio)
Start viewability monitoring in the player
Parameters:
elid: The element to measure, by default will use the player position
callback: Callback function to call on every viewability change. Callback function parameters:
Boolean: in view or not
Number: Current ratio of viewability
String: State that indicates if below/above/partial the fold
Viewability ratio defined as viewable. Default is 0.5
stopViewability()
Stop viewability monitoring
getViewability()
Returns current viewability of the player
getReadyAds()
Returns the number of ready ads (Ads in AdLoaded state)
Player Events
The player on() function can be used to subscribe to events. Multiple listeners can be set for each event
...
Code Block |
---|
player.startTemplate(document.getElementById(adConfigplacementConfig.position).parentNode) |
Templates Configuration
The templates configuration ads additional configurations to adConfigplacementConfig
Those configurations are used only if startTemplate is called
...