BUVideoAdView.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. //
  2. // BUVideoAdView.h
  3. // BUAdSDK
  4. //
  5. // Copyright © 2017年 bytedance. All rights reserved.
  6. //
  7. #import <UIKit/UIKit.h>
  8. #import "BUPlayerPublicDefine.h"
  9. #import "BUMaterialMeta.h"
  10. @class BUMaterialMeta;
  11. NS_ASSUME_NONNULL_BEGIN
  12. /**
  13. Control TikTok Audience Network video player.
  14. */
  15. @protocol BUVideoEngine <NSObject>
  16. /**
  17. Get the already played time.
  18. */
  19. - (CGFloat)currentPlayTime;
  20. /**
  21. Set video play when you support CustomMode
  22. **/
  23. - (void)play;
  24. /**
  25. Set video pause when you support CustomMode
  26. **/
  27. - (void)pause;
  28. @end
  29. @protocol BUVideoAdViewDelegate;
  30. @interface BUVideoAdView : UIView<BUVideoEngine>
  31. @property (nonatomic, weak, nullable) id<BUVideoAdViewDelegate> delegate;
  32. /**
  33. required. Root view controller for handling ad actions.
  34. **/
  35. @property (nonatomic, weak, readwrite) UIViewController *rootViewController;
  36. /**
  37. Whether to allow pausing the video by clicking, default NO. Only for draw video(vertical video ads).
  38. **/
  39. @property (nonatomic, assign) BOOL drawVideoClickEnable;
  40. /**
  41. AdType information.
  42. */
  43. @property (nonatomic, assign) NSInteger AdType;
  44. /**
  45. material information.
  46. */
  47. @property (nonatomic, strong, readwrite, nullable) BUMaterialMeta *materialMeta;
  48. /**
  49. Set your Video autoPlayMode when you support CustomMode
  50. if support CustomMode , default autoplay Video
  51. **/
  52. @property (nonatomic, assign) BOOL supportAutoPlay;
  53. - (instancetype)initWithMaterial:(BUMaterialMeta *)materialMeta;
  54. /**
  55. Resume to the corresponding time.
  56. */
  57. - (void)playerSeekToTime:(CGFloat)time;
  58. /**
  59. Support configuration for pause button.
  60. @param playImg : the image of the button
  61. @param playSize : the size of the button. Set as cgsizezero to use default icon size.
  62. */
  63. - (void)playerPlayIncon:(UIImage *)playImg playInconSize:(CGSize)playSize;
  64. @end
  65. @protocol BUVideoAdViewDelegate <NSObject>
  66. @optional
  67. /**
  68. This method is called when videoadview failed to play.
  69. @param error : the reason of error
  70. */
  71. - (void)videoAdView:(BUVideoAdView *)videoAdView didLoadFailWithError:(NSError *_Nullable)error;
  72. /**
  73. This method is called when videoadview ready to play.
  74. */
  75. - (void)playerReadyToPlay:(BUVideoAdView *)videoAdView;
  76. /**
  77. This method is called when videoadview playback status changed.
  78. @param playerState : player state after changed
  79. */
  80. - (void)videoAdView:(BUVideoAdView *)videoAdView stateDidChanged:(BUPlayerPlayState)playerState;
  81. /**
  82. This method is called when videoadview end of play.
  83. */
  84. - (void)playerDidPlayFinish:(BUVideoAdView *)videoAdView;
  85. /**
  86. This method is called when videoadview is clicked.
  87. */
  88. - (void)videoAdViewDidClick:(BUVideoAdView *)videoAdView;
  89. /**
  90. This method is called when videoadview's finish view is clicked.
  91. */
  92. - (void)videoAdViewFinishViewDidClick:(BUVideoAdView *)videoAdView;
  93. /**
  94. This method is called when another controller has been closed.
  95. @param interactionType : open appstore in app or open the webpage or view video ad details page.
  96. */
  97. - (void)videoAdViewDidCloseOtherController:(BUVideoAdView *)videoAdView interactionType:(BUInteractionType)interactionType;
  98. @end
  99. NS_ASSUME_NONNULL_END