ThirdPartyAdapters/fyber/fyber/src/main/java/com/google/ads/mediation/fyber/FyberRewardedVideoRenderer.java
/**
   * Creates a listener for Fyber's fullscreen placement events.
   *
   * @param controller the full screen controller.
   */
Creates a listener for Fyber's fullscreen placement events.
@param controller the full screen controller.
Creates a listener for Fyber ' s fullscreen placement events . @param controller the full screen controller .
private void registerFyberAdListener(
      final @NonNull InneractiveFullscreenUnitController controller) {
    InneractiveFullscreenAdEventsListenerAdapter adListener =
        new InneractiveFullscreenAdEventsListenerAdapter() {
          @Override
          public void onAdImpression(InneractiveAdSpot inneractiveAdSpot) {
            mRewardedAdCallback.onAdOpened();
            if (isVideoAdAvailable(controller)) {
              mRewardedAdCallback.onVideoStart();
            }
            mRewardedAdCallback.reportAdImpression();
          }
          @Override
          public void onAdClicked(InneractiveAdSpot inneractiveAdSpot) {
            mRewardedAdCallback.reportAdClicked();
          }
          @Override
          public void onAdDismissed(InneractiveAdSpot inneractiveAdSpot) {
            mRewardedAdCallback.onAdClosed();
            if (!isVideoAdAvailable(controller)) {
              mRewardedAdCallback.onUserEarnedReward(RewardItem.DEFAULT_REWARD);
            }
          }
        };
    final InneractiveFullscreenVideoContentController videoContentController =
        new InneractiveFullscreenVideoContentController();
    videoContentController.setEventsListener(new VideoContentListenerAdapter() {
      /**
       * Called by inneractive when a rewarded video ad was played to the end.
       * <br>Note: This event does not indicate that the rewarded video was closed.
       */
      @Override
      public void onCompleted() {
        mRewardedAdCallback.onVideoComplete();
        mRewardedAdCallback.onUserEarnedReward(RewardItem.DEFAULT_REWARD);
      }
    });
    controller.addContentController(videoContentController);
    controller.setEventsListener(adListener);
  }
private void registerFyberAdListener ( final @ NonNull InneractiveFullscreenUnitController controller ) { InneractiveFullscreenAdEventsListenerAdapter adListener = new InneractiveFullscreenAdEventsListenerAdapter ( ) { @ Override public void onAdImpression ( InneractiveAdSpot inneractiveAdSpot ) { mRewardedAdCallback . onAdOpened ( ) ; if ( isVideoAdAvailable ( controller ) ) { mRewardedAdCallback . onVideoStart ( ) ; } mRewardedAdCallback . reportAdImpression ( ) ; } @ Override public void onAdClicked ( InneractiveAdSpot inneractiveAdSpot ) { mRewardedAdCallback . reportAdClicked ( ) ; } @ Override public void onAdDismissed ( InneractiveAdSpot inneractiveAdSpot ) { mRewardedAdCallback . onAdClosed ( ) ; if ( ! isVideoAdAvailable ( controller ) ) { mRewardedAdCallback . onUserEarnedReward ( RewardItem . DEFAULT_REWARD ) ; } } } ; final InneractiveFullscreenVideoContentController videoContentController = new InneractiveFullscreenVideoContentController ( ) ; videoContentController . setEventsListener ( new VideoContentListenerAdapter ( ) { /**
       * Called by inneractive when a rewarded video ad was played to the end.
       * <br>Note: This event does not indicate that the rewarded video was closed.
       */ @ Override public void onCompleted ( ) { mRewardedAdCallback . onVideoComplete ( ) ; mRewardedAdCallback . onUserEarnedReward ( RewardItem . DEFAULT_REWARD ) ; } } ) ; controller . addContentController ( videoContentController ) ; controller . setEventsListener ( adListener ) ; }
Creates a listener for Fyber's fullscreen placement events.
Creates a listener for Fyber ' s fullscreen placement events .
// Code review note: Report video start should be called before reporting ad impression // Check for the returned ad type to send back the reward callback properly. // For video ads, the reward is earned only if the video is completed. // For Display ads, the reward is earned when the ad is dismissed. // If the ad is a video ad, wait for the video completion event. // The video is completed. an end card is shown. // The ad is not dismissed yet, but a reward is in order.