GDTUnifiedNativeAdNetworkAdapterProtocol.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. //
  2. // GDTUnifiedNativeAdNetworkAdapterProtocol.h
  3. // GDTMobSDK
  4. //
  5. // Created by Nancy on 2019/6/27.
  6. // Copyright © 2019 Tencent. All rights reserved.
  7. //
  8. #import "GDTBaseAdNetworkAdapterProtocol.h"
  9. #import "GDTAdProtocol.h"
  10. #import "GDTVideoAdReporter.h"
  11. @class GDTUnifiedNativeAdDataObject;
  12. @protocol GDTUnifiedNativeAdNetworkConnectorProtocol;
  13. NS_ASSUME_NONNULL_BEGIN
  14. @protocol GDTUnifiedNativeAdNetworkAdapterProtocol <GDTBaseAdNetworkAdapterProtocol>
  15. @property (nonatomic, assign) NSInteger maxVideoDuration;
  16. @property (nonatomic, assign) NSInteger minVideoDuration;
  17. - (void)loadAdWithCount:(NSInteger)count;
  18. @end
  19. @class GDTVideoConfig;
  20. @protocol GDTUnifiedNativeAdDataObjectConnectorProtocol;
  21. @protocol GDTUnifiedNativeAdDataObjectAdapterProtocol <GDTAdProtocol>
  22. @property (nonatomic, copy, readonly) NSString *title;
  23. /**
  24. 广告描述
  25. */
  26. @property (nonatomic, copy, readonly) NSString *desc;
  27. /**
  28. 广告大图Url
  29. */
  30. @property (nonatomic, copy, readonly) NSString *imageUrl;
  31. /**
  32. 素材宽度,单图广告代表大图 imageUrl 宽度、多图广告代表小图 mediaUrlList 宽度
  33. */
  34. @property (nonatomic, readonly) NSInteger imageWidth;
  35. /**
  36. 素材高度,单图广告代表大图 imageUrl 高度、多图广告代表小图 mediaUrlList 高度
  37. */
  38. @property (nonatomic, readonly) NSInteger imageHeight;
  39. /**
  40. 应用类广告App 图标Url
  41. */
  42. @property (nonatomic, copy, readonly) NSString *iconUrl;
  43. /**
  44. 三小图广告的图片Url集合
  45. */
  46. @property (nonatomic, copy, readonly) NSArray *mediaUrlList;
  47. /**
  48. 应用类广告的星级(5星制度)
  49. */
  50. @property (nonatomic, readonly) CGFloat appRating;
  51. /**
  52. 应用类广告的价格
  53. */
  54. @property (nonatomic, strong, readonly) NSNumber *appPrice;
  55. /**
  56. 是否为应用类广告
  57. */
  58. @property (nonatomic, readonly) BOOL isAppAd;
  59. /**
  60. 是否为视频广告
  61. */
  62. @property (nonatomic, readonly) BOOL isVideoAd;
  63. /**
  64. 是否为三小图广告
  65. */
  66. @property (nonatomic, readonly) BOOL isThreeImgsAd;
  67. /**
  68. 返回广告的eCPM,单位:分
  69. @return 成功返回一个大于等于0的值,-1表示无权限或后台出现异常
  70. */
  71. @property (nonatomic, readonly) NSInteger eCPM;
  72. /**
  73. * 视频广告时长,单位 ms
  74. */
  75. @property (nonatomic, readonly) CGFloat duration;
  76. /**
  77. 视频广告播放配置
  78. */
  79. @property (nonatomic, strong, nullable) GDTVideoConfig *videoConfig;
  80. @optional
  81. @property (nonatomic, copy, readonly) NSString *eCPMLevel;
  82. @property (nonatomic, copy, readonly) NSString *callToAction;
  83. @property (nonatomic, copy, readonly) NSString *buttonText;
  84. @property (nonatomic, assign, readonly) BOOL skippable;
  85. /**
  86. * VAST Tag Url,可能为空。
  87. */
  88. @property (nonatomic, copy, readonly, nullable) NSString *vastTagUrl;
  89. /**
  90. * VAST Content,可能为空。
  91. */
  92. @property (nonatomic, copy, readonly, nullable) NSString *vastContent;
  93. /**
  94. * 是否为 VAST 广告
  95. */
  96. @property (nonatomic, readonly) BOOL isVastAd;
  97. /**
  98. * 是否为微信原生页广告
  99. */
  100. @property (nonatomic, readonly) BOOL isWechatCanvasAd;
  101. /**
  102. * 视频URL,当allowCustomVideoPlayer为YES时才会返回非空的URL
  103. */
  104. @property (nonatomic, readonly) NSString *videoUrl;
  105. /**
  106. * 是否允许自定义播放器功能,若要开启请联系运营同学
  107. */
  108. @property (nonatomic, readonly) BOOL allowCustomVideoPlayer;
  109. @property (nonatomic, readonly) id <GDTVideoAdReporter>videoAdReporter;
  110. /**
  111. 判断两个自渲染2.0广告数据是否相等
  112. @param dataObject 需要对比的自渲染2.0广告数据对象
  113. @return YES or NO
  114. */
  115. - (instancetype)initWithUnifiedNativeAdDataObject:(GDTUnifiedNativeAdDataObject *)dataObject;
  116. - (BOOL)equalsAdData:(id <GDTUnifiedNativeAdDataObjectAdapterProtocol>)dataObject;
  117. - (void)setRootViewController:(UIViewController * _Nullable)rootViewController;
  118. - (void)registerConnector:(id <GDTUnifiedNativeAdDataObjectConnectorProtocol>)connector
  119. clickableViews:(NSArray *)clickableViews;
  120. - (void)registerClickableCallToActionView:(UIView *)callToActionView;
  121. - (void)unregisterView;
  122. //是否需要主动检测曝光,默认NO
  123. - (BOOL)needsToDetectExposure;
  124. //检测到曝光后调用
  125. - (void)didRecordImpression;
  126. //发送竞胜结果
  127. - (void)sendWinNotification:(NSInteger)price;
  128. //发送竞败结果
  129. - (void)sendLossNotification:(NSInteger)price reason:(NSInteger)reason adnId:(NSString *__nullable)adnId;
  130. //设置实际结算价
  131. - (void)setBidECPM:(NSInteger)price;
  132. @end
  133. @protocol GDTMediaViewAdapterProtocol <NSObject>
  134. @optional
  135. /**
  136. * 视频广告时长,单位 ms
  137. */
  138. - (CGFloat)videoDuration;
  139. /**
  140. * 视频广告已播放时长,单位 ms
  141. */
  142. - (CGFloat)videoPlayTime;
  143. /**
  144. 播放视频
  145. */
  146. - (void)play;
  147. /**
  148. 暂停视频,调用 pause 后,需要被暂停的视频广告对象,不会再自动播放,需要调用 play 才能恢复播放。
  149. */
  150. - (void)pause;
  151. /**
  152. 停止播放,并展示第一帧
  153. */
  154. - (void)stop;
  155. /**
  156. 播放静音开关
  157. @param flag 是否静音
  158. */
  159. - (void)muteEnable:(BOOL)flag;
  160. /**
  161. 自定义播放按钮
  162. @param image 自定义播放按钮图片,不设置为默认图
  163. @param size 自定义播放按钮大小,不设置为默认大小 44 * 44
  164. */
  165. - (void)setPlayButtonImage:(UIImage *)image size:(CGSize)size;
  166. @end
  167. NS_ASSUME_NONNULL_END