bitmovin-player-react-native-analytics-conviva
Version:
Conviva Analytics Integration for the Bitmovin Player React Native SDK
88 lines • 3.35 kB
JavaScript
import BitmovinPlayerReactNativeAnalyticsConvivaSsaiModule from './modules/BitmovinPlayerReactNativeAnalyticsConvivaSsaiModule';
export var SsaiAdPosition;
(function (SsaiAdPosition) {
SsaiAdPosition["PREROLL"] = "preroll";
SsaiAdPosition["MIDROLL"] = "midroll";
SsaiAdPosition["POSTROLL"] = "postroll";
})(SsaiAdPosition || (SsaiAdPosition = {}));
/**
* Enables reporting of server-side ad breaks and ads.
* @platform Android, iOS, tvOS
*/
export class SsaiApi {
/**
* The native conviva analytics id that this SSAI API is attached to.
*/
nativeId;
constructor(nativeId) {
this.nativeId = nativeId;
}
/**
* Reports if a server-side ad break is currently active.
* @returns true if an ad break is currently active, false otherwise
*
* @platform Android, iOS, tvOS
*/
isAdBreakActive = async () => {
return BitmovinPlayerReactNativeAnalyticsConvivaSsaiModule.isAdBreakActive(this.nativeId);
};
/**
* Reports the start of a server-side ad break. Must be called before the first ad starts.
* Has no effect if a server-side ad break is already playing.
* @param adBreakInfo Map containing metadata about the server-side ad break. Can be `undefined`.
*
* @platform Android, iOS, tvOS
*/
reportAdBreakStarted = async (adBreakInfo = undefined) => {
return BitmovinPlayerReactNativeAnalyticsConvivaSsaiModule.reportAdBreakStarted(this.nativeId, adBreakInfo);
};
/**
* Reports the end of a server-side ad break. Must be called after the last ad has finished.
* Has no effect if no server-side ad break is currently active.
*
* @platform Android, iOS, tvOS
*/
reportAdBreakFinished = async () => {
return BitmovinPlayerReactNativeAnalyticsConvivaSsaiModule.reportAdBreakFinished(this.nativeId);
};
/**
* Reports the start of a server-side ad.
*
* Has to be called after calling the `reportAdBreakStarted()` method.
*
* @param adInfo {@link SsaiAdInfo} containing metadata about the server-side ad.
* @platform Android, iOS, tvOS
*/
reportAdStarted = async (adInfo) => {
return BitmovinPlayerReactNativeAnalyticsConvivaSsaiModule.reportAdStarted(this.nativeId, adInfo);
};
/**
* Reports the end of a server-side ad.
* Has no effect if no server-side ad is currently playing.
*
* @platform Android, iOS, tvOS
*/
reportAdFinished = async () => {
return BitmovinPlayerReactNativeAnalyticsConvivaSsaiModule.reportAdFinished(this.nativeId);
};
/**
* Reports that the current ad was skipped.
* Has no effect if no server-side ad is playing.
*
* @platform Android, iOS, tvOS
*/
reportAdSkipped = async () => {
return BitmovinPlayerReactNativeAnalyticsConvivaSsaiModule.reportAdSkipped(this.nativeId);
};
/**
* Updates the ad metadata during an active client-side or server-side ad.
* Has no effect if no server-side ad is playing.
*
* @param adInfo Object containing metadata about the ad.
* @platform Android, iOS, tvOS
*/
updateAdInfo = async (adInfo) => {
BitmovinPlayerReactNativeAnalyticsConvivaSsaiModule.updateAdInfo(this.nativeId, adInfo);
};
}
//# sourceMappingURL=ssaiApi.js.map