PRODUCT
Follow

Overview

Note

Note: To view the full list of components, see AdKit Components.

The Video component, (also known as MediaKit), provides many video related capabilities that are configurable and controlled through the API.

To view an example, see Gitlab Video Example.

Note

Note: This section is an extension of the general AdKit Configuration section.

Configuration

Example

              define({
   "banners": [{
      "id": "Master_Banner",
         "items": [
              // -- START OF THE RELEVANT COMPONENT CONFIGURATION --
              {
                 "id": "containerId",
                 "type": "adkit-media",
                 "showControls": true,
                 "muted": true,
                 "media": ["assets/SampleVideo_1080x720_1mb.mp4"],
                 "autoPlay": {
                 "delay": 0,
                 "mobile" : true
              },
                 "width": 240,
                 "height": 180,
                 "top": 0,
                 "left": 0,
                 "position": "absolute"
                }
                // -- END OF THE RELEVANT COMPONENT CONFIGURATION --
      ]}]
});


            

Parameters

Field

Type

Description

type

String

The value is adkit-media.

showControls

Boolean

Show or hide the video controls.

muted

Boolean

Mute or unmute the video.

media

Array of Strings

Array of video asset URLs.

autoplay

Object

The video will autoplay when the object exists. The Autoplay object can determine the delay in which the autoplay will start and whether it will support mobile.

Methods

play()

Description

Starts playing the video.

Example

                 adkit.onReady(function(){
      adkit.$('video1').play();
   });
         

pause()

Description

Pauses the currently played video.

Example

                 adkit.onReady(function()
       {adkit.$('video1').pause();
   });         

stop()

Description

Stops the currently played video and sets the playback position to zero.

Example

                adkit.onReady(function(){
     adkit.$('video1').stop();
  });         

Mute()

Description

Mutes the currently played video.

Example

                 adkit.onReady(function(){   
      adkit.$('video1').mute();
  });         

UnMute()

Description

Unmutes the currently played video.

Example

                adkit.onReady(function(){
    adkit.$('video1').unmute();
 });         

Event Registration Methods

onPlay(playCB)

Description

Subscribes to be notified when video starts playing.

Example

               adkit.onReady(function(){
      adkit.$('video1').onPlay(function(){
         // Do something
      });
  });
            

Parameters

Name

Mandatory/Optional

Type

Description

playCB

Mandatory

Function

Runs when video starts playing.

onPause(pauseCB)

Description

Subscribes to be notified when video pauses.

Example

                adkit.onReady(function(){ 
      adkit.$('video1').onPause(function(){ 
            // Do something
      });
  });
            

Parameters

Name

Mandatory/Optional

Type

Description

pauseCB

Mandatory

Function

Runs when video pauses.

onEnd(endCB)

Description

Subscribes to be notified when video ends.

Example

                 adkit.onReady(function(){
        adkit.$('video1').onEnd(function(){
             // Do something
       });
   });
            

Parameters

Name

Mandatory/Optional

Type

Description

endCB

Mandatory

Function

Runs when video ends.

onError(errorCB)

Description

Subscribes to be notified when errors occur.

Example

                adkit.onReady(function(){
      adkit.$('video1').onError(function(){
            // Do something
      });
  });
            

Parameters

Name

Mandatory/Optional

Type

Description

errorCB

Mandatory

Function

Runs when an error arises.

onTimeUpdate(timeUpdateCB)

Description

Subscribes to be notified when the playback position changes.

Example

                 adkit.onReady(function(){
       adkit.$('video1').onTimeUpdate(function(currentTime){
           // Do something
       });
   });
            

Parameters

Name

Mandatory/Optional

Type

Description

durationChangeCB

Mandatory

Function

Runs when video duration changes.

The new video duration returns as an argument for the specified callback function and it is represented is seconds.

onEnterFullscreen(enterFullscreenCB)

Description

Subscribes to be notified when the video enters full screen mode.

Example

                  adkit.onReady(function(){
        adkit.$('video1').onEnterFullscreen(function(){
             // Do something
        });
   });
            

Parameters

Name

Mandatory/Optional

Type

Description

enterFullscreenCB

Mandatory

Function

Runs when video enters full screen mode.

onExitFullscreen(exitFullscreenCB)

Description

Subscribes to be notified when video exits fullscreen mode.

Example

                 adkit.onReady(function(){
        adkit.$('video1').onExitFullscreen(function(){
           // Do something
        });
  });

            

Parameters

Name

Mandatory/Optional

Type

Description

exitFullscreenCB

Mandatory

Function

Runs when video exits full screen mode.

onEnterFullSize(enterFullSizeCB)

Description

Subscribes to be notified when video enters full size mode. Full size mode is when the video was enlarged to the maximum available size when there is no support for full screen.

Example

                 adkit.onReady(function(){
        adkit.$('video1').onEnterFullSize(function(){
              // Do something
        });
   });
            

Parameters

Name

Mandatory/Optional

Type

Description

enterFullSizeCB

Mandatory

Function

Runs when video enters full size mode.

onExitFullSize(exitFullSizeCB)

Description

Subscribes to be notified when video exits full size mode. Full size mode is when the video was enlarged to the maximum available size when there is no support for full screen.

Example

                  adkit.onReady(function(){
          adkit.$('video1').onExitFullSize(function(){
                // Do something
          });
    });
            

Parameters

Name

Mandatory/Optional

Type

Description

exitFullSizeCB

Mandatory

Function

Runs when video exits full size mode.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments