Ad Policy
Ad policy controls ad skipping and ad cooldown behavior. It is configured under ads.policy, independently from ads.clientSide and ads.serverSide, so the same policy applies whether playback uses client-side ads (CSAI) or server-side ads (SSAI).
| Attribute | Type | Required | Description |
|---|---|---|---|
| skipMode | "ad" | "pod" | no | Skip mode of the ads, "ad" will skip a single ad wherever possible, "pod" will skip the whole pod wherever possible. (Defaults to pod) |
| cooldown | number | no | Snapback cooldown duration in seconds after an ad break completes. Set to 0 to disable the cooldown. |
| pauseAdCooldown | number | no | Cooldown duration in seconds between non linear pause ad displays. Set to 0 to disable the cooldown. |
import React, { useRef, useEffect } from "react";
import { SafeAreaView, StyleSheet, View } from "react-native";
import { LuraPlayer, type UnifiedPlaylist, type Configuration } 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: {
policy: {
skipMode: "ad",
cooldown: 300,
pauseAdCooldown: 300
}
},
...
};
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,
},
});