0.3.4 • Published 6 months ago

@codd-tech/video-ad-sdk v0.3.4

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Video AD Player SDK Documentation

Overview

The Video AD Player SDK provides a simple interface for initializing and displaying video ads in your application. Import the SDK and use its functions to integrate video ads with customizable skip settings and callback methods for handling the completion of ads.

Installation

To use this SDK, first install it in your project:

npm install @teleads/tma-sdk

or

yarn add @teleads/tma-sdk

Quick Start

Import the SDK into your file and initialize the app using the provided token.

import TeleAdsTMA from '@teleads/tma-sdk';

// Initialize the TeleAds SDK for TMA using the SDK token
TeleAdsTMA.init('YOUR_SDK_TOKEN');

// Show advertising
TeleAdsTMA.showAD({
  adUnitId: 'AD_UNIT_ID',
  onVideoEnded: (status) => {
    console.log(`Ad ended with status: ${status}`);
  },
});

Also, you can use Promises

First, ensure that you've set up the SDK as usual:

import TeleAdsTMA from '@teleads/tma-sdk';

// Initialize the TeleAds SDK for TMA using the SDK token
TeleAdsTMA.init('YOUR_SDK_TOKEN');

// Show advertising with Promise-like API
TeleAdsTMA.showAD({
  adUnitId: 'AD_UNIT_ID'
}).then(status => {
  console.log(`Ad ended with status: ${status}`);
}).catch(error => {
  console.error('Ad failed to show:', error);
});

API Overview

Methods

init(token: string): void

Initializes the application with the provided token.

  • token (string): Your API token for initializing the SDK.

showAD(options: ShowAdOptions): void

Displays a video with the specified options.

  • options (ShowAdOptions): An object containing options for displaying the video.

Interfaces

ShowAdOptions

Options for displaying the video.

  • adUnitId (string): The ad unit id to be displayed.
  • onEnded (function, optional): A callback invoked when the video ends.
    • Accepts values: 'skipped' | 'closed'
  • onClick (function, optional): A callback invoked when the user clicked on AD.

Types

VideoPlayedStatus

The status of the completed video.

  • Values: 'skipped', 'closed'
0.3.4

6 months ago

0.3.3

6 months ago

0.3.2

6 months ago

0.3.1

6 months ago

0.3.0

6 months ago

0.2.4

7 months ago

0.2.3

7 months ago

0.2.2

7 months ago

0.2.1

7 months ago

0.2.0

7 months ago

0.1.11

7 months ago

0.1.10

11 months ago

0.1.9

11 months ago

0.1.8

11 months ago

0.1.7

11 months ago

0.1.6

11 months ago

0.1.5

11 months ago

0.1.4

11 months ago

0.1.3

11 months ago

0.1.2

11 months ago

0.1.1

11 months ago

0.1.0

11 months ago

0.0.1

11 months ago