Bolt.BOLT_MIDPOINT
Description
The BOLT_MIDPOINT
event fires when 50% of the ad creative plays through.
Usage
If you are looking for a way to listen to when 50% of an ad plays, you can simply listen to the Bolt.BOLT_MIDPOINT
player event. In the code snippet below, the video player with the data-id
of myPlayer
will fire a function when the event is triggered.
Bolt.on( 'myPlayer', Bolt.BOLT_MIDPOINT, function() {
// do something
console.log( 'BOLT_MIDPOINT Fired' );
});
Example
In this example, the player will load and call the bolt_midpoint()
function once fully loaded via the data-onready
attribute. When the ad creative plays 50% through, the BOLT_MIDPOINT
event will fire and a console.log
message will appear.
HTML
<!-- BOLT_MIDPOINT example -->
<script
data-config="https://support.playwire.com/configs/config_spotx.json"
data-height="100%"
data-width="100%"
data-id="myPlayer"
data-onready="bolt_midpoint"
src="//cdn.playwire.com/bolt/js/zeus/embed.js"
type="text/javascript">
</script>
<!-- / BOLT_MIDPOINT example -->
JavaScript
function bolt_midpoint(){
Bolt.on('myPlayer', Bolt.BOLT_MIDPOINT, function(){
var message = 'BOLT_AD_MIDPOINT - Event Fired'
console.log(message)
})
}