admin
2023-04-21 0b3a4aaf99ea251bc8e27b96115288f0988fcffe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//
//  DYDrawVideoController.m
//  BuWanVideo2.0
//
//  Created by aeline on 2022/1/14.
//  Copyright © 2022 com.yeshi.buwansheque.ios. All rights reserved.
//
 
#import "DYDrawVideoController.h"
#import <LCDSDK/LCDSDK.h>
 
@interface DYDrawVideoController ()<LCDDrawVideoViewControllerDelegate , LCDAdvertCallBackProtocol>
 
@property
LCDDrawVideoViewController *vc;
 
@end
 
@implementation DYDrawVideoController
- (instancetype)init {
    self = [super init];
    if (self) {
        self.title = @"刷视频";
    }
    return self;
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:animated];
    self.navigationController.navigationBar.translucent = NO;
}
 
- (void) viewDidLoad{
    [self buildCells];
}
 
- (void)viewDidAppear:(BOOL)animated{
    if(self.vc!=nil){
       [self.vc drawVideoViewControllerDidAppear];
    }
}
 
- (void)viewDidDisappear:(BOOL)animated{
    if(self.vc!=nil){
        [self.vc drawVideoViewControllerDidDisappear];
    }
}
 
 
 
- (void)buildCells {
    self.vc= [[LCDDrawVideoViewController alloc] initWithConfigBuilder:^(LCDDrawVideoVCConfig * _Nonnull config) {
        config.viewSize=CGSizeMake(KScreenW, KScreenH   - ALTabBar_H);
        config.showCloseButton = NO;
        config.out_bottomOffset = 5;
        config.delegate = self;
        config.adDelegate = self;
        config.configScrollViewsBlock = ^(LCDDrawVideoViewController *vc, UIScrollView * _Nonnull dataView, NSUInteger atIndex) {
            MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
                [vc refreshDataWithCompletion:^(NSError * _Nullable error) {
                    [dataView.mj_header endRefreshing];
                }];
            }];
            header.stateLabel.textColor = UIColor.whiteColor;
            header.lastUpdatedTimeLabel.hidden = YES;
            dataView.mj_header = header;
        };
    }];
    self.vc.modalPresentationStyle = UIModalPresentationFullScreen;
    
    //        [self presentViewController:vc animated:YES completion:^{
    //        }];
    
    [self.view addSubview:self.vc.view];
    [self addChildViewController:self.vc];
}
 
- (void)drawVideoPlayCompletion:(UIViewController *)viewController event:(LCDEvent *)event {
    NSLog(@"draw video play completion - group_id:%lld, params:%@", event.group_id, event.params);
}
 
- (void)drawVideoOverPlay:(UIViewController *)viewController event:(LCDEvent *)event {
    NSLog(@"draw video over play - group_id:%lld, params:%@", event.group_id, event.params);
    
    dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
    // 创建全局并行
    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_group_t group = dispatch_group_create();
    dispatch_group_async(group, queue, ^{
        
        [[YTHNetInterface startInterface] playDrawVideoEvent:@"dy" :@"home":^(BOOL isSuccessful, id result, NSString *error) {
            dispatch_semaphore_signal(semaphore);
        }];
        
    });
}
 
@end