BUFullscreenVideoAd.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. //
  2. // BUFullscreenVideoAd.h
  3. // BUAdSDK
  4. //
  5. // Copyright © 2018年 bytedance. All rights reserved.
  6. //
  7. #import <Foundation/Foundation.h>
  8. #import <UIKit/UIKit.h>
  9. #import "BUAdSlot.h"
  10. #import "BUMopubAdMarkUpDelegate.h"
  11. typedef NS_ENUM(NSUInteger, BUFullScreenVideoAdType) {
  12. BUFullScreenAdTypeEndcard = 0, // video + endcard
  13. BUFullScreenAdTypeVideoPlayable = 1, // video + playable
  14. BUFullScreenAdTypePurePlayable = 2 // pure playable
  15. };
  16. NS_ASSUME_NONNULL_BEGIN
  17. @class BUFullscreenVideoAd;
  18. @protocol BUFullscreenVideoAdDelegate <NSObject>
  19. @optional
  20. /**
  21. This method is called when video ad material loaded successfully.
  22. */
  23. - (void)fullscreenVideoMaterialMetaAdDidLoad:(BUFullscreenVideoAd *)fullscreenVideoAd;
  24. /**
  25. This method is called when video ad materia failed to load.
  26. @param error : the reason of error
  27. */
  28. - (void)fullscreenVideoAd:(BUFullscreenVideoAd *)fullscreenVideoAd didFailWithError:(NSError *_Nullable)error;
  29. /**
  30. This method is called when video cached successfully.
  31. */
  32. - (void)fullscreenVideoAdVideoDataDidLoad:(BUFullscreenVideoAd *)fullscreenVideoAd;
  33. /**
  34. This method is called when video ad slot will be showing.
  35. */
  36. - (void)fullscreenVideoAdWillVisible:(BUFullscreenVideoAd *)fullscreenVideoAd;
  37. /**
  38. This method is called when video ad slot has been shown.
  39. */
  40. - (void)fullscreenVideoAdDidVisible:(BUFullscreenVideoAd *)fullscreenVideoAd;
  41. /**
  42. This method is called when video ad is clicked.
  43. */
  44. - (void)fullscreenVideoAdDidClick:(BUFullscreenVideoAd *)fullscreenVideoAd;
  45. /**
  46. This method is called when video ad is about to close.
  47. */
  48. - (void)fullscreenVideoAdWillClose:(BUFullscreenVideoAd *)fullscreenVideoAd;
  49. /**
  50. This method is called when video ad is closed.
  51. */
  52. - (void)fullscreenVideoAdDidClose:(BUFullscreenVideoAd *)fullscreenVideoAd;
  53. /**
  54. This method is called when video ad play completed or an error occurred.
  55. @param error : the reason of error
  56. */
  57. - (void)fullscreenVideoAdDidPlayFinish:(BUFullscreenVideoAd *)fullscreenVideoAd didFailWithError:(NSError *_Nullable)error;
  58. /**
  59. This method is called when the user clicked skip button.
  60. */
  61. - (void)fullscreenVideoAdDidClickSkip:(BUFullscreenVideoAd *)fullscreenVideoAd;
  62. /**
  63. this method is used to get the type of fullscreen video ad
  64. */
  65. - (void)fullscreenVideoAdCallback:(BUFullscreenVideoAd *)fullscreenVideoAd withType:(BUFullScreenVideoAdType)fullscreenVideoAdType;
  66. @end
  67. @interface BUFullscreenVideoAd : NSObject <BUMopubAdMarkUpDelegate>
  68. @property (nonatomic, weak, nullable) id<BUFullscreenVideoAdDelegate> delegate;
  69. @property (nonatomic, getter=isAdValid, readonly) BOOL adValid __attribute__((deprecated("Use fullscreenVideoMaterialMetaAdDidLoad: instead.")));
  70. /// media configuration parameters.
  71. @property (nonatomic, copy, readonly) NSDictionary *mediaExt;
  72. /**
  73. Initializes video ad with slot id.
  74. @param slotID : the unique identifier of video ad.
  75. @return BUFullscreenVideoAd
  76. */
  77. - (instancetype)initWithSlotID:(NSString *)slotID;
  78. /**
  79. Initializes video ad with slot.
  80. @param slot : A object, through which you can pass in the fullscreen unique identifier, ad type, and so on.
  81. @return BUFullscreenVideoAd
  82. */
  83. - (instancetype)initWithSlot:(BUAdSlot *)slot;
  84. /**
  85. Load video ad datas.
  86. */
  87. - (void)loadAdData;
  88. /**
  89. Display video ad.
  90. @param rootViewController : root view controller for displaying ad.
  91. @return : whether it is successfully displayed.
  92. */
  93. - (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController;
  94. /**
  95. Display video ad.
  96. @param rootViewController : root view controller for displaying ad.
  97. @param sceneDescirbe : optional. Identifies a custom description of the presentation scenario.
  98. @return : whether it is successfully displayed.
  99. */
  100. - (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController ritSceneDescribe:(NSString *_Nullable)sceneDescirbe;
  101. @end
  102. NS_ASSUME_NONNULL_END