//
|
// 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
|