To keep a better control over the video playback during the ad experience, you can use our listeners.
The listener let you add code on different methods:
import { NativeEventEmitter, NativeModules } from "react-native";
const eventEmitter = new NativeEventEmitter(
NativeModules.TeadsAdLifecycleEvents
);
// Subscribe to the event
eventEmitter.addListener("didPlay", (event) => {
const { adId } = event;
// called when the ad start or if it was resumed after a pause
});
eventEmitter.addListener("didPause", (event) => {
const { adId } = event;
// fired when the ad is paused for example if the app is not visible anymore
});
eventEmitter.addListener("didComplete", (event) => {
const { adId } = event;
// called when the ad reach the end
});
Also, the following methods can help you for the audio management.
// Subscribe to the event
eventEmitter.addListener("adStartPlayingAudio", (event) => {
const { adId } = event;
// you can choose for example to shut down any other sound in your app
});
eventEmitter.addListener("adStopPlayingAudio", (event) => {
const { adId } = event;
// you can reactivate all sound in your app
});