YOUPAILCDynamicSendVideoByLinkVC.m 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //
  2. // YOUPAILCDynamicSendVideoByLinkVC.m
  3. // VQU
  4. //
  5. // Created by 肖浩然的mac on 2021/9/3.
  6. // Copyright © 2021 MS. All rights reserved.
  7. //
  8. #import "YOUPAILCDynamicSendVideoByLinkVC.h"
  9. #import "ZFPlayer.h"
  10. #import "ZFAVPlayerManager.h"
  11. #import "YOUPAIZFCustomControlView.h"
  12. @interface YOUPAILCDynamicSendVideoByLinkVC ()
  13. @property (nonatomic, strong) ZFPlayerController *youpaipzFplayer;
  14. @property (nonatomic, strong) YOUPAIZFCustomControlView *youpaipcontrolView;
  15. @property (nonatomic, strong) UIImageView *youpaipcontainerView;
  16. @end
  17. @implementation YOUPAILCDynamicSendVideoByLinkVC
  18. - (UIStatusBarStyle)preferredStatusBarStyle{
  19. return UIStatusBarStyleLightContent;
  20. }
  21. -(void)viewWillAppear:(BOOL)animated
  22. {
  23. [super viewWillAppear:animated];
  24. self.navigationController.navigationBar.translucent = YES;
  25. [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:HexColorFromRGBA(0xffffff, 0) size:CGSizeMake(KScreenWidth, NavBarHeight)] forBarMetrics:(UIBarMetricsDefault)];
  26. self.youpaipzFplayer.viewControllerDisappear = NO;
  27. }
  28. -(void)viewWillDisappear:(BOOL)animated
  29. {
  30. [super viewWillDisappear:animated];
  31. [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
  32. self.navigationController.navigationBar.translucent = NO;
  33. // [self.zFplayer.currentPlayerManager pause];
  34. self.youpaipzFplayer.viewControllerDisappear = YES;
  35. }
  36. - (void)viewDidLoad {
  37. [super viewDidLoad];
  38. self.sx_disableInteractivePop = YES;
  39. self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifbackClick) image:[UIImage imageNamed:@"vqu_images_D_dynamic_close"]];
  40. // self.zFplayer.assetURL =[NSURL URLWithString:self.mp4Url];
  41. [self.view addSubview:self.youpaipcontainerView];
  42. ZFAVPlayerManager *playerManager = [[ZFAVPlayerManager alloc] init];
  43. /// 播放器相关
  44. self.youpaipzFplayer = [ZFPlayerController playerWithPlayerManager:playerManager containerView:self.youpaipcontainerView];
  45. self.youpaipzFplayer.controlView = self.youpaipcontrolView;
  46. /// 设置退到后台继续播放
  47. self.youpaipzFplayer.pauseWhenAppResignActive = NO;
  48. /// 播放完成
  49. self.youpaipzFplayer.playerDidToEnd = ^(id _Nonnull asset) {
  50. // @zf_strongify(self)
  51. [self.youpaipzFplayer.currentPlayerManager replay];
  52. [self.youpaipzFplayer playTheNext];
  53. if (!self.youpaipzFplayer.isLastAssetURL) {
  54. [self.youpaipcontrolView showTitle:@"" coverURLString:self.youpaipvideoLikesModel.youpaipcover_url fullScreenMode:ZFFullScreenModeLandscape];
  55. } else {
  56. [self.youpaipzFplayer stop];
  57. }
  58. };
  59. playerManager.assetURL = [NSURL URLWithString:self.youpaipvideoLikesModel.youpaipfile_url];
  60. }
  61. - (void)youpaifbackClick{
  62. [self.navigationController popViewControllerAnimated:YES];
  63. }
  64. - (void)viewWillLayoutSubviews {
  65. [super viewWillLayoutSubviews];
  66. self.youpaipcontainerView.frame = self.view.frame;
  67. }
  68. - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
  69. if (self.youpaipzFplayer.isFullScreen) {
  70. return UIInterfaceOrientationMaskLandscape;
  71. }
  72. return UIInterfaceOrientationMaskPortrait;
  73. }
  74. - (YOUPAIZFCustomControlView *)youpaipcontrolView {
  75. if (!_youpaipcontrolView) {
  76. _youpaipcontrolView = [YOUPAIZFCustomControlView new];
  77. }
  78. return _youpaipcontrolView;
  79. }
  80. - (UIImageView *)youpaipcontainerView {
  81. if (!_youpaipcontainerView) {
  82. _youpaipcontainerView = [UIImageView new];
  83. [_youpaipcontainerView sd_setImageWithURL:[NSURL URLWithString:self.youpaipvideoLikesModel.youpaipcover_url]];
  84. }
  85. return _youpaipcontainerView;
  86. }
  87. @end