BUNativeExpressFullscreenVideoAd.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. //
  2. // BUNativeExpressFullscreenVideoAd.h
  3. // BUAdSDK
  4. //
  5. // Copyright © 2019 bytedance. All rights reserved.
  6. //
  7. #import <UIKit/UIKit.h>
  8. #import "BUMaterialMeta.h"
  9. #import "BUMopubAdMarkUpDelegate.h"
  10. @class BUNativeExpressFullscreenVideoAd;
  11. //define the type of native express video ad
  12. typedef NS_ENUM(NSUInteger, BUNativeExpressFullScreenAdType) {
  13. BUNativeExpressFullScreenAdTypeEndcard = 0, // video + endcard
  14. BUNativeExpressFullScreenAdTypeVideoPlayable = 1, // video + playable
  15. BUNativeExpressFullScreenAdTypePurePlayable = 2 // pure playable
  16. };
  17. NS_ASSUME_NONNULL_BEGIN
  18. @protocol BUNativeExpressFullscreenVideoAdDelegate <NSObject>
  19. @optional
  20. /**
  21. This method is called when video ad material loaded successfully.
  22. */
  23. - (void)nativeExpressFullscreenVideoAdDidLoad:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
  24. /**
  25. This method is called when video ad materia failed to load.
  26. @param error : the reason of error
  27. */
  28. - (void)nativeExpressFullscreenVideoAd:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd didFailWithError:(NSError *_Nullable)error;
  29. /**
  30. This method is called when rendering a nativeExpressAdView successed.
  31. It will happen when ad is show.
  32. */
  33. - (void)nativeExpressFullscreenVideoAdViewRenderSuccess:(BUNativeExpressFullscreenVideoAd *)rewardedVideoAd;
  34. /**
  35. This method is called when a nativeExpressAdView failed to render.
  36. @param error : the reason of error
  37. */
  38. - (void)nativeExpressFullscreenVideoAdViewRenderFail:(BUNativeExpressFullscreenVideoAd *)rewardedVideoAd error:(NSError *_Nullable)error;
  39. /**
  40. This method is called when video cached successfully.
  41. For a better user experience, it is recommended to display video ads at this time.
  42. And you can call [BUNativeExpressFullscreenVideoAd showAdFromRootViewController:].
  43. */
  44. - (void)nativeExpressFullscreenVideoAdDidDownLoadVideo:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
  45. /**
  46. This method is called when video ad slot will be showing.
  47. */
  48. - (void)nativeExpressFullscreenVideoAdWillVisible:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
  49. /**
  50. This method is called when video ad slot has been shown.
  51. */
  52. - (void)nativeExpressFullscreenVideoAdDidVisible:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
  53. /**
  54. This method is called when video ad is clicked.
  55. */
  56. - (void)nativeExpressFullscreenVideoAdDidClick:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
  57. /**
  58. This method is called when the user clicked skip button.
  59. */
  60. - (void)nativeExpressFullscreenVideoAdDidClickSkip:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
  61. /**
  62. This method is called when video ad is about to close.
  63. */
  64. - (void)nativeExpressFullscreenVideoAdWillClose:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
  65. /**
  66. This method is called when video ad is closed.
  67. */
  68. - (void)nativeExpressFullscreenVideoAdDidClose:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
  69. /**
  70. This method is called when video ad play completed or an error occurred.
  71. @param error : the reason of error
  72. */
  73. - (void)nativeExpressFullscreenVideoAdDidPlayFinish:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd didFailWithError:(NSError *_Nullable)error;
  74. /**
  75. This method is used to get the type of nativeExpressFullScreenVideo ad
  76. */
  77. - (void)nativeExpressFullscreenVideoAdCallback:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd withType:(BUNativeExpressFullScreenAdType) nativeExpressVideoAdType;
  78. /**
  79. This method is called when another controller has been closed.
  80. @param interactionType : open appstore in app or open the webpage or view video ad details page.
  81. */
  82. - (void)nativeExpressFullscreenVideoAdDidCloseOtherController:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd interactionType:(BUInteractionType)interactionType;
  83. @end
  84. @interface BUNativeExpressFullscreenVideoAd : NSObject <BUMopubAdMarkUpDelegate>
  85. @property (nonatomic, weak, nullable) id<BUNativeExpressFullscreenVideoAdDelegate> delegate;
  86. @property (nonatomic, getter=isAdValid, readonly) BOOL adValid __attribute__((deprecated("Use nativeExpressFullscreenVideoAdDidLoad: instead.")));
  87. /// media configuration parameters.
  88. @property (nonatomic, copy, readonly) NSDictionary *mediaExt;
  89. /**
  90. Initializes video ad with slot id.
  91. @param slotID : the unique identifier of video ad.
  92. @return BUFullscreenVideoAd
  93. */
  94. - (instancetype)initWithSlotID:(NSString *)slotID;
  95. /**
  96. Initializes video ad with slot.
  97. @param slot : A object, through which you can pass in the fullscreen unique identifier, ad type, and so on.
  98. @return BUNativeExpressFullscreenVideoAd
  99. */
  100. - (instancetype)initWithSlot:(BUAdSlot *)slot;
  101. /**
  102. Load video ad datas.
  103. */
  104. - (void)loadAdData;
  105. /**
  106. Display video ad.
  107. @param rootViewController : root view controller for displaying ad.
  108. @return : whether it is successfully displayed.
  109. */
  110. - (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController;
  111. /**
  112. Display video ad.
  113. @param rootViewController : root view controller for displaying ad.
  114. @param sceneDescirbe : optional. Identifies a custom description of the presentation scenario.
  115. @return : whether it is successfully displayed.
  116. */
  117. - (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController ritSceneDescribe:(NSString *_Nullable)sceneDescirbe;
  118. @end
  119. NS_ASSUME_NONNULL_END