GDTUnifiedInterstitialAd.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. //
  2. // GDTUnifiedInterstitialAd.h
  3. // GDTMobApp
  4. //
  5. // Created by nimomeng on 2019/3/4.
  6. // Copyright © 2019 Tencent. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "GDTSDKDefines.h"
  10. NS_ASSUME_NONNULL_BEGIN
  11. @class GDTUnifiedInterstitialAd;
  12. @protocol GDTUnifiedInterstitialAdDelegate <NSObject>
  13. @optional
  14. /**
  15. * 插屏2.0广告预加载成功回调
  16. * 当接收服务器返回的广告数据成功且预加载后调用该函数
  17. */
  18. - (void)unifiedInterstitialSuccessToLoadAd:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  19. /**
  20. * 插屏2.0广告预加载失败回调
  21. * 当接收服务器返回的广告数据失败后调用该函数
  22. */
  23. - (void)unifiedInterstitialFailToLoadAd:(GDTUnifiedInterstitialAd *)unifiedInterstitial error:(NSError *)error;
  24. /**
  25. * 插屏2.0广告将要展示回调
  26. * 插屏2.0广告即将展示回调该函数
  27. */
  28. - (void)unifiedInterstitialWillPresentScreen:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  29. /**
  30. * 插屏2.0广告视图展示成功回调
  31. * 插屏2.0广告展示成功回调该函数
  32. */
  33. - (void)unifiedInterstitialDidPresentScreen:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  34. /**
  35. * 插屏2.0广告视图展示失败回调
  36. * 插屏2.0广告展示失败回调该函数
  37. */
  38. - (void)unifiedInterstitialFailToPresent:(GDTUnifiedInterstitialAd *)unifiedInterstitial error:(NSError *)error;
  39. /**
  40. * 插屏2.0广告展示结束回调
  41. * 插屏2.0广告展示结束回调该函数
  42. */
  43. - (void)unifiedInterstitialDidDismissScreen:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  44. /**
  45. * 当点击下载应用时会调用系统程序打开其它App或者Appstore时回调
  46. */
  47. - (void)unifiedInterstitialWillLeaveApplication:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  48. /**
  49. * 插屏2.0广告曝光回调
  50. */
  51. - (void)unifiedInterstitialWillExposure:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  52. /**
  53. * 插屏2.0广告点击回调
  54. */
  55. - (void)unifiedInterstitialClicked:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  56. /**
  57. * 点击插屏2.0广告以后即将弹出全屏广告页
  58. */
  59. - (void)unifiedInterstitialAdWillPresentFullScreenModal:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  60. /**
  61. * 点击插屏2.0广告以后弹出全屏广告页
  62. */
  63. - (void)unifiedInterstitialAdDidPresentFullScreenModal:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  64. /**
  65. * 全屏广告页将要关闭
  66. */
  67. - (void)unifiedInterstitialAdWillDismissFullScreenModal:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  68. /**
  69. * 全屏广告页被关闭
  70. */
  71. - (void)unifiedInterstitialAdDidDismissFullScreenModal:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  72. /**
  73. * 插屏2.0视频广告 player 播放状态更新回调
  74. */
  75. - (void)unifiedInterstitialAd:(GDTUnifiedInterstitialAd *)unifiedInterstitial playerStatusChanged:(GDTMediaPlayerStatus)status;
  76. /**
  77. * 插屏2.0视频广告详情页 WillPresent 回调
  78. */
  79. - (void)unifiedInterstitialAdViewWillPresentVideoVC:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  80. /**
  81. * 插屏2.0视频广告详情页 DidPresent 回调
  82. */
  83. - (void)unifiedInterstitialAdViewDidPresentVideoVC:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  84. /**
  85. * 插屏2.0视频广告详情页 WillDismiss 回调
  86. */
  87. - (void)unifiedInterstitialAdViewWillDismissVideoVC:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  88. /**
  89. * 插屏2.0视频广告详情页 DidDismiss 回调
  90. */
  91. - (void)unifiedInterstitialAdViewDidDismissVideoVC:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
  92. @end
  93. @interface GDTUnifiedInterstitialAd : NSObject
  94. /**
  95. * 插屏2.0广告预加载是否完成
  96. */
  97. @property (nonatomic, readonly) BOOL isAdValid;
  98. /**
  99. * 委托对象
  100. */
  101. @property (nonatomic, weak) id<GDTUnifiedInterstitialAdDelegate> delegate;
  102. @property (nonatomic, readonly) NSString *placementId;
  103. /**
  104. * 构造方法
  105. * 详解:placementId - 广告位 ID
  106. */
  107. - (instancetype)initWithPlacementId:(NSString *)placementId;
  108. /**
  109. * 构造方法
  110. * 详解:appId - 媒体 ID
  111. * placementId - 广告位 ID
  112. */
  113. - (instancetype)initWithAppId:(NSString *)appId placementId:(NSString *)placementId GDT_DEPRECATED_MSG_ATTRIBUTE("接口即将废弃,请使用 initWithPlacementId:");
  114. /**
  115. * 广告发起请求方法
  116. * 详解:[必选]发起拉取广告请求
  117. */
  118. - (void)loadAd;
  119. /**
  120. * 插屏全屏视频广告发起请求方法
  121. * 详解:[必选]发起拉取广告请求
  122. */
  123. - (void)loadFullScreenAd;
  124. /**
  125. * 广告展示方法
  126. * 详解:[必选]发起展示广告请求, 必须传入用于显示插播广告的UIViewController
  127. */
  128. - (void)presentAdFromRootViewController:(UIViewController *)rootViewController;
  129. /**
  130. * 插屏视频全屏广告展示方法
  131. * 详解:[必选]发起展示广告请求, 必须传入用于显示插播广告的UIViewController
  132. */
  133. - (void)presentFullScreenAdFromRootViewController:(UIViewController *)rootViewController;
  134. /**
  135. 返回广告的eCPM,单位:分
  136. @return 成功返回一个大于等于0的值,-1表示无权限或后台出现异常
  137. */
  138. - (NSInteger)eCPM;
  139. /**
  140. 返回广告的eCPM等级
  141. @return 成功返回一个包含数字的string,@""或nil表示无权限或后台异常
  142. */
  143. - (NSString *)eCPMLevel;
  144. /**
  145. * 非 WiFi 网络,是否自动播放。默认 YES。loadAd 前设置。
  146. */
  147. @property (nonatomic, assign) BOOL videoAutoPlayOnWWAN;
  148. /**
  149. * 自动播放时,是否静音。默认 YES。loadAd 前设置。
  150. */
  151. @property (nonatomic, assign) BOOL videoMuted;
  152. /**
  153. * 视频详情页播放时是否静音。默认NO。loadAd 前设置。
  154. */
  155. @property (nonatomic, assign) BOOL detailPageVideoMuted;
  156. /**
  157. 请求视频的时长下限。
  158. 以下两种情况会使用 0,1:不设置 2:minVideoDuration大于maxVideoDuration
  159. */
  160. @property (nonatomic) NSInteger minVideoDuration;
  161. /**
  162. 请求视频的时长上限,视频时长有效值范围为[5,180]。
  163. */
  164. @property (nonatomic) NSInteger maxVideoDuration;
  165. /**
  166. * 是否是视频插屏2.0广告
  167. */
  168. @property (nonatomic, assign, readonly) BOOL isVideoAd;
  169. /**
  170. * 视频插屏2.0广告时长,单位 ms
  171. */
  172. - (CGFloat)videoDuration;
  173. /**
  174. * 视频插屏广告已播放时长,单位 ms
  175. */
  176. - (CGFloat)videoPlayTime;
  177. /**
  178. 返回广告平台名称
  179. @return 当使用流量分配功能时,用于区分广告平台;未使用时为空字符串
  180. */
  181. - (NSString *)adNetworkName;
  182. @end
  183. NS_ASSUME_NONNULL_END