BURewardedVideoAd.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. //
  2. // BURewardedVideoAd.h
  3. // BUAdSDK
  4. //
  5. // Copyright © 2018年 bytedance. All rights reserved.
  6. //
  7. #import <UIKit/UIKit.h>
  8. #import "BUAdSDKDefines.h"
  9. #import "BUMopubAdMarkUpDelegate.h"
  10. NS_ASSUME_NONNULL_BEGIN
  11. /// define the type of rewarded video ad
  12. typedef NS_ENUM(NSUInteger, BURewardedVideoAdType) {
  13. BURewardedVideoAdTypeEndcard = 0, // video + endcard
  14. BURewardedVideoAdTypeVideoPlayable = 1, // video + playable
  15. BURewardedVideoAdTypePurePlayable = 2 // pure playable
  16. };
  17. @protocol BURewardedVideoAdDelegate;
  18. @class BURewardedVideoModel;
  19. @interface BURewardedVideoAd : NSObject <BUMopubAdMarkUpDelegate>
  20. @property (nonatomic, strong) BURewardedVideoModel *rewardedVideoModel;
  21. @property (nonatomic, weak, nullable) id<BURewardedVideoAdDelegate> delegate;
  22. /**
  23. Whether material is effective.
  24. Setted to YES when data is not empty and has not been displayed.
  25. Repeated display is not billed.
  26. */
  27. @property (nonatomic, getter=isAdValid, readonly) BOOL adValid __attribute__((deprecated("Use rewardedVideoAdDidLoad: instead.")));
  28. /// media configuration parameters.
  29. @property (nonatomic, copy, readonly) NSDictionary *mediaExt;
  30. - (instancetype)initWithSlotID:(NSString *)slotID rewardedVideoModel:(BURewardedVideoModel *)model;
  31. /**
  32. Initializes Rewarded video ad with ad slot and frame.
  33. @param slot A object, through which you can pass in the reward unique identifier, ad type, and so on.
  34. @param model Rewarded video model.
  35. @return BURewardedVideoAd
  36. */
  37. - (instancetype)initWithSlot:(BUAdSlot *)slot rewardedVideoModel:(BURewardedVideoModel *)model;
  38. - (void)loadAdData;
  39. /**
  40. Display video ad.
  41. @param rootViewController : root view controller for displaying ad.
  42. @return : whether it is successfully displayed.
  43. */
  44. - (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController;
  45. /**
  46. If ritSceneType is custom, you need to pass in the values for sceneDescirbe.
  47. @param ritSceneType : optional. Identifies a custom description of the presentation scenario.
  48. @param sceneDescirbe : optional. Identify the scene of presentation.
  49. */
  50. - (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController ritScene:(BURitSceneType)ritSceneType ritSceneDescribe:(NSString *_Nullable)sceneDescirbe;
  51. @end
  52. @protocol BURewardedVideoAdDelegate <NSObject>
  53. @optional
  54. /**
  55. This method is called when video ad material loaded successfully.
  56. */
  57. - (void)rewardedVideoAdDidLoad:(BURewardedVideoAd *)rewardedVideoAd;
  58. /**
  59. This method is called when video ad materia failed to load.
  60. @param error : the reason of error
  61. */
  62. - (void)rewardedVideoAd:(BURewardedVideoAd *)rewardedVideoAd didFailWithError:(NSError *_Nullable)error;
  63. /**
  64. This method is called when cached successfully.
  65. */
  66. - (void)rewardedVideoAdVideoDidLoad:(BURewardedVideoAd *)rewardedVideoAd;
  67. /**
  68. This method is called when video ad slot will be showing.
  69. */
  70. - (void)rewardedVideoAdWillVisible:(BURewardedVideoAd *)rewardedVideoAd;
  71. /**
  72. This method is called when video ad slot has been shown.
  73. */
  74. - (void)rewardedVideoAdDidVisible:(BURewardedVideoAd *)rewardedVideoAd;
  75. /**
  76. This method is called when video ad is about to close.
  77. */
  78. - (void)rewardedVideoAdWillClose:(BURewardedVideoAd *)rewardedVideoAd;
  79. /**
  80. This method is called when video ad is closed.
  81. */
  82. - (void)rewardedVideoAdDidClose:(BURewardedVideoAd *)rewardedVideoAd;
  83. /**
  84. This method is called when video ad is clicked.
  85. */
  86. - (void)rewardedVideoAdDidClick:(BURewardedVideoAd *)rewardedVideoAd;
  87. /**
  88. This method is called when video ad play completed or an error occurred.
  89. @param error : the reason of error
  90. */
  91. - (void)rewardedVideoAdDidPlayFinish:(BURewardedVideoAd *)rewardedVideoAd didFailWithError:(NSError *_Nullable)error;
  92. /**
  93. Server verification which is requested asynchronously is succeeded.
  94. @param verify :return YES when return value is 2000.
  95. */
  96. - (void)rewardedVideoAdServerRewardDidSucceed:(BURewardedVideoAd *)rewardedVideoAd verify:(BOOL)verify;
  97. /**
  98. Server verification which is requested asynchronously is failed.
  99. Return value is not 2000.
  100. */
  101. - (void)rewardedVideoAdServerRewardDidFail:(BURewardedVideoAd *)rewardedVideoAd __attribute__((deprecated("Use rewardedVideoAdServerRewardDidFail: error: instead.")));
  102. /**
  103. Server verification which is requested asynchronously is failed.
  104. @param rewardedVideoAd rewarded Video ad
  105. @param error request error info
  106. */
  107. - (void)rewardedVideoAdServerRewardDidFail:(BURewardedVideoAd *)rewardedVideoAd error:(NSError *)error;
  108. /**
  109. This method is called when the user clicked skip button.
  110. */
  111. - (void)rewardedVideoAdDidClickSkip:(BURewardedVideoAd *)rewardedVideoAd;
  112. /**
  113. this method is used to get type of rewarded video Ad
  114. */
  115. - (void)rewardedVideoAdCallback:(BURewardedVideoAd *)rewardedVideoAd withType:(BURewardedVideoAdType)rewardedVideoAdType;
  116. @end
  117. NS_ASSUME_NONNULL_END