123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- //
- // YOUPAILCDynamicSendVideoByLinkVC.m
- // VQU
- //
- // Created by 肖浩然的mac on 2021/9/3.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILCDynamicSendVideoByLinkVC.h"
- #import "ZFPlayer.h"
- #import "ZFAVPlayerManager.h"
- #import "YOUPAIZFCustomControlView.h"
- @interface YOUPAILCDynamicSendVideoByLinkVC ()
- @property (nonatomic, strong) ZFPlayerController *youpaipzFplayer;
- @property (nonatomic, strong) YOUPAIZFCustomControlView *youpaipcontrolView;
- @property (nonatomic, strong) UIImageView *youpaipcontainerView;
- @end
- @implementation YOUPAILCDynamicSendVideoByLinkVC
- - (UIStatusBarStyle)preferredStatusBarStyle{
- return UIStatusBarStyleLightContent;
- }
- -(void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- self.navigationController.navigationBar.translucent = YES;
- [self.navigationController.navigationBar setBackgroundImage:[UIImage imageWithColor:HexColorFromRGBA(0xffffff, 0) size:CGSizeMake(KScreenWidth, NavBarHeight)] forBarMetrics:(UIBarMetricsDefault)];
-
- self.youpaipzFplayer.viewControllerDisappear = NO;
-
-
- }
- -(void)viewWillDisappear:(BOOL)animated
- {
- [super viewWillDisappear:animated];
- [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
- self.navigationController.navigationBar.translucent = NO;
- // [self.zFplayer.currentPlayerManager pause];
-
- self.youpaipzFplayer.viewControllerDisappear = YES;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.sx_disableInteractivePop = YES;
- self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifbackClick) image:[UIImage imageNamed:@"vqu_images_D_dynamic_close"]];
-
- // self.zFplayer.assetURL =[NSURL URLWithString:self.mp4Url];
-
- [self.view addSubview:self.youpaipcontainerView];
- ZFAVPlayerManager *playerManager = [[ZFAVPlayerManager alloc] init];
- /// 播放器相关
- self.youpaipzFplayer = [ZFPlayerController playerWithPlayerManager:playerManager containerView:self.youpaipcontainerView];
- self.youpaipzFplayer.controlView = self.youpaipcontrolView;
- /// 设置退到后台继续播放
- self.youpaipzFplayer.pauseWhenAppResignActive = NO;
- /// 播放完成
-
- self.youpaipzFplayer.playerDidToEnd = ^(id _Nonnull asset) {
- // @zf_strongify(self)
- [self.youpaipzFplayer.currentPlayerManager replay];
- [self.youpaipzFplayer playTheNext];
- if (!self.youpaipzFplayer.isLastAssetURL) {
- [self.youpaipcontrolView showTitle:@"" coverURLString:self.youpaipvideoLikesModel.youpaipcover_url fullScreenMode:ZFFullScreenModeLandscape];
- } else {
- [self.youpaipzFplayer stop];
- }
- };
-
- playerManager.assetURL = [NSURL URLWithString:self.youpaipvideoLikesModel.youpaipfile_url];
-
- }
- - (void)youpaifbackClick{
- [self.navigationController popViewControllerAnimated:YES];
- }
- - (void)viewWillLayoutSubviews {
- [super viewWillLayoutSubviews];
- self.youpaipcontainerView.frame = self.view.frame;
- }
- - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
- if (self.youpaipzFplayer.isFullScreen) {
- return UIInterfaceOrientationMaskLandscape;
- }
- return UIInterfaceOrientationMaskPortrait;
- }
- - (YOUPAIZFCustomControlView *)youpaipcontrolView {
- if (!_youpaipcontrolView) {
- _youpaipcontrolView = [YOUPAIZFCustomControlView new];
- }
- return _youpaipcontrolView;
- }
- - (UIImageView *)youpaipcontainerView {
- if (!_youpaipcontainerView) {
- _youpaipcontainerView = [UIImageView new];
- [_youpaipcontainerView sd_setImageWithURL:[NSURL URLWithString:self.youpaipvideoLikesModel.youpaipcover_url]];
- }
- return _youpaipcontainerView;
- }
- @end
|