Skip to main content

Non Linear Ads

Non linear pause ads display an ad overlay inside the player when playback is paused. Configure pause ads under ads.nonLinear.pause.

Pause Ads

AttributeTypeRequiredDescription
provider"generic"noProvider of the pause ad configuration.
genericobjectnoGeneric non linear pause ad configuration.
generic.urlstringnoURL for the VAST tag that includes non linear ads.
generic.xPosition"left" | "center" | "right"noHorizontal position of the non linear ad display area.
generic.yPosition"top" | "center" | "bottom"noVertical position of the non linear ad display area.
generic.backgroundOpacitynumbernoBackground opacity of the ad display area.
generic.slideAnimationobjectnoSlide animation configuration for the non linear ad.
generic.slideAnimation.enabledbooleannoWhether slide animation is enabled.
generic.slideAnimation.direction"left" | "right" | "up" | "down"noSlide animation direction.
generic.slideAnimation.durationnumbernoSlide animation duration in seconds.
generic.paddingobjectnoPadding around the non linear ad display area.
generic.padding.topstringnoTop padding in accepted units.
generic.padding.bottomstringnoBottom padding in accepted units.
generic.padding.leftstringnoLeft padding in accepted units.
generic.padding.rightstringnoRight padding in accepted units.
import React, { useEffect, useRef } from "react";
import { SafeAreaView, StyleSheet, View } from "react-native";
import { LuraPlayer, type Configuration, type UnifiedPlaylist } from "@akta-tech/lura-player-react-native";
import { LuraPlayerControls } from "@akta-tech/lura-player-react-native-ui";

export default function App() {
const playerRef = useRef<UnifiedPlaylist>(null);
const config: Configuration = {
...
ads: {
nonLinear: {
pause: {
provider: "generic",
generic: {
url: "VAST_AD_TAG_URL_WITH_NON_LINEAR_ADS",
xPosition: "right",
yPosition: "center",
backgroundOpacity: 0.6,
slideAnimation: {
enabled: true,
direction: "left",
duration: 0.6,
},
padding: {
right: "5%",
},
},
},
},
},
...
};

useEffect(() => {
playerRef.current?.setConfig(config);
}, [playerRef]);

return (
<View>
<SafeAreaView />
<LuraPlayer ref={playerRef} style={styles.player} Controls={LuraPlayerControls} />
</View>
);
}

const styles = StyleSheet.create({
player: {
backgroundColor: "#000",
width: "100%",
maxWidth: 640,
aspectRatio: 16 / 9,
},
});

The cooldown between pause ad displays is controlled by ads.policy.pauseAdCooldown.