BogoVideoPlayViewController.m 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. //
  2. // BogoVideoPlayViewController.m
  3. // BuguLive
  4. //
  5. // Created by 宋晨光 on 2021/4/20.
  6. // Copyright © 2021 xfg. All rights reserved.
  7. //
  8. #import "BogoVideoPlayViewController.h"
  9. #import "BogoVideoPlayCell.h"
  10. #import "BogoVideoModel.h"
  11. @interface BogoVideoPlayViewController ()<BogoVideoTableViewCellDelegate,BogoVideoTableViewCellDataSource>
  12. @property(nonatomic, strong) NSMutableArray<BogoVideoModel *> *listArr;
  13. @end
  14. @implementation BogoVideoPlayViewController
  15. - (instancetype)initWithModelArr:(NSMutableArray *)arr{
  16. BogoVideoPlayViewController *vc = [BogoVideoPlayViewController new];
  17. vc.listArr = arr;
  18. return vc;;
  19. }
  20. - (void)viewDidLoad {
  21. [super viewDidLoad];
  22. // Do any additional setup after loading the view.
  23. [self setUpTable];
  24. [self setUpPlayerView];
  25. // _player.URLAsset = [[BogoVideoPlayerURLAsset alloc] initWithURL:URL playModel:[BogoPlayModel playModelWithTableView:_tableView indexPath:indexPath]];
  26. }
  27. -(void)setUpPlayerView{
  28. // _player = SJVideoPlayer.player;
  29. // [self.view addSubview:_player.view];
  30. // [_player.view mas_makeConstraints:^(MASConstraintMaker *make) {
  31. // if (@available(iOS 11.0, *)) {
  32. // make.top.equalTo(self.view.mas_safeAreaLayoutGuideTop);
  33. // } else {
  34. // make.top.offset(20);
  35. // }
  36. // make.left.right.offset(0);
  37. // make.height.equalTo(self.player.view.mas_width).multipliedBy(9/16.0);
  38. // }];
  39. }
  40. -(void)setUpTable{
  41. _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
  42. _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  43. _tableView.backgroundColor = [UIColor whiteColor];
  44. _tableView.delegate = self;
  45. _tableView.dataSource = self;
  46. [self.view addSubview:_tableView];
  47. [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  48. make.edges.offset(0);
  49. }];
  50. [BogoVideoPlayCell registerWithTableView:_tableView];
  51. // // 创建测试数据
  52. // _listArr = NSMutableArray.array;
  53. // __auto_type items = [BogoVideoModel testItemsWithCount:3];
  54. // for ( BogoVideoModel *item in items ) {
  55. // [_listArr addObject:[BogoVideoModel alloc] init];
  56. //// WithItem:item]];
  57. // }
  58. [_tableView reloadData];
  59. }
  60. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
  61. return _listArr.count;
  62. }
  63. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  64. return 40;
  65. // [_listArr[indexPath.row] height];
  66. }
  67. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  68. return [BogoVideoPlayCell cellWithTableView:tableView indexPath:indexPath];
  69. }
  70. - (void)tableView:(UITableView *)tableView willDisplayCell:(BogoVideoPlayCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
  71. cell.dataSource = _listArr[indexPath.row];
  72. cell.delegate = self;
  73. }
  74. - (BOOL)shouldAutorotate {
  75. return NO;
  76. }
  77. //- (void)viewDidAppear:(BOOL)animated {
  78. // [super viewDidAppear:animated];
  79. // [_player vc_viewDidAppear];
  80. //}
  81. //
  82. //- (void)viewWillDisappear:(BOOL)animated {
  83. // [super viewWillDisappear:animated];
  84. // [_player vc_viewWillDisappear];
  85. //}
  86. //
  87. //- (void)viewDidDisappear:(BOOL)animated {
  88. // [super viewDidDisappear:animated];
  89. // [_player vc_viewDidDisappear];
  90. //}
  91. - (void)coverItemWasTapped:(nonnull BogoVideoPlayCell *)cell {
  92. }
  93. - (void)encodeWithCoder:(nonnull NSCoder *)coder {
  94. }
  95. - (void)traitCollectionDidChange:(nullable UITraitCollection *)previousTraitCollection {
  96. }
  97. - (void)preferredContentSizeDidChangeForChildContentContainer:(nonnull id<UIContentContainer>)container {
  98. }
  99. @end