Commit 01bb3d2d authored by Han Ruisong's avatar Han Ruisong
Browse files

升级到4.5.0

1.新增小窗播放功能。
2.支持加密,非加密视频截图。
3.修复了网络检测页面在iOS13上的兼容性问题。
parent 66461d17
No preview for this file type
This diff is collapsed.
......@@ -24,12 +24,24 @@
[super viewDidLoad];
// Do any additional setup after loading the view.
self.playerView = [[DWVodPlayerView alloc]init];
if (DWAPPDELEGATE.vodPlayerView) {
self.playerView = DWAPPDELEGATE.vodPlayerView;
[self.playerView quitWindowsModel];
}else{
self.playerView = [[DWVodPlayerView alloc]init];
}
self.playerView.delegate = self;
[self.view addSubview:self.playerView];
[_playerView mas_makeConstraints:^(MASConstraintMaker *make) {
[_playerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.view);
}];
if (DWAPPDELEGATE.vodPlayerView) {
if ([DWAPPDELEGATE.vodPlayerView.downloadModel.videoId isEqualToString:self.downloadModel.videoId]) {
return;
}
}
[self.playerView playLocalVideo:self.downloadModel];
[self.playerView reLayoutWithScreenState:YES];
......@@ -87,6 +99,15 @@
[self.navigationController popViewControllerAnimated:YES];
}
//窗口模式播放
-(void)vodPlayerViewDidEnterWindowsModel:(DWVodPlayerView *)playerView
{
// DWAPPDELEGATE.vodPlayerView.delegate = nil;
[DWAPPDELEGATE.vodPlayerView enterWindowsModel];
[self.navigationController popViewControllerAnimated:YES];
}
/*
-(void)videoPlayerSkin:(DWPlayerSkinView *)playerSkinView ReturnBackAction:(BOOL)backPortrait
{
......
......@@ -77,8 +77,10 @@
vodModel.imageUrl = [vodDict objectForKey:@"videoCover"];
[self.videoList addObject:vodModel];
}
dispatch_async(dispatch_get_main_queue(), ^{
DWAPPDELEGATE.videoList = self.videoList;
DWVodModel * vodModel = self.videoList.firstObject;
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:vodModel.imageUrl] placeholderImage:[UIImage imageNamed:@"icon_placeholder.png"]];
[self.collectionView reloadData];
......@@ -91,9 +93,8 @@
-(void)reloadLoaclData
{
//请自行替换数据
NSArray * videos = @[];
for (int i = 0; i < videos.count; i++) {
DWVodModel * vodModel = [[DWVodModel alloc]init];
vodModel.videoId = [videos objectAtIndex:i];
......@@ -102,6 +103,7 @@
vodModel.imageUrl = @"icon_placeholder.png";
[self.videoList addObject:vodModel];
}
DWAPPDELEGATE.videoList = self.videoList;
[self.collectionView reloadData];
}
......
......@@ -159,11 +159,9 @@
dispatch_async(t, ^{
[self startMainPing];
CFRunLoopRun();
});
dispatch_barrier_async(t, ^{
[self startNodePing];
});
}
//检测bokecc.com
......@@ -197,16 +195,18 @@
[self appendString:[NSString stringWithFormat:@"%ld packets transmitted,%ld received,%ld%% packet loss,time %.2lfms\n",packetNum,receiveNum,(NSInteger)(((packetNum - receiveNum) / (double)packetNum) * 100),time]];
if (receiveNum != 0) {
//如果ping不通,后面的也不需要执行了
self.isPingNode = YES;
}
[self startNodePing];
// [strongSelf startNodePing];
};
[networkMonitor startPing];
self.networkMonitor = networkMonitor;
CFRunLoopRun();
}
//检测当前节点
......@@ -218,6 +218,8 @@
dispatch_async(dispatch_get_main_queue(), ^{
_repeatTestButton.selected = NO;
});
CFRunLoopStop(CFRunLoopGetCurrent());
return;
}
......@@ -259,10 +261,11 @@
dispatch_async(dispatch_get_main_queue(), ^{
self.repeatTestButton.selected = NO;
});
CFRunLoopStop(CFRunLoopGetCurrent());
};
[networkMonitor startPing];
self.networkMonitor = networkMonitor;
CFRunLoopRun();
}
//增加数据显示
......
......@@ -15,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic,strong)DWVodModel * vodModel;//当前播放
@property(nonatomic,strong)NSArray * vidoeList;//选集列表
@property(nonatomic,assign)BOOL landScape;//是否横屏
@end
NS_ASSUME_NONNULL_END
......@@ -46,7 +46,15 @@ typedef enum : NSUInteger {
[self initUI];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationChangeNotification) name:UIDeviceOrientationDidChangeNotification object:nil];
//判断是否小窗播放
if (DWAPPDELEGATE.vodPlayerView) {
if ([DWAPPDELEGATE.vodPlayerView.videoModel.videoId isEqualToString:self.vodModel.videoId]) {
//当前正在窗口播放的视频
return;
}
}
DWConfigurationManager * manager = [DWConfigurationManager sharedInstance];
if (manager.isOpenAd) {
//广告模式
......@@ -226,7 +234,7 @@ typedef enum : NSUInteger {
-(void)adShowPlay:(DWAdShouView*)adShowView DidScreenRotate:(BOOL)isFull
{
}
#pragma mark - DWVodPlayerViewDelegate
......@@ -307,6 +315,14 @@ typedef enum : NSUInteger {
});
}
//窗口模式播放
-(void)vodPlayerViewDidEnterWindowsModel:(DWVodPlayerView *)playerView
{
//如果开启了小窗,开小窗,没开启正常
[DWAPPDELEGATE.vodPlayerView enterWindowsModel];
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - 投屏相关
-(void)screeningReturnButtonAction
{
......@@ -510,12 +526,20 @@ typedef enum : NSUInteger {
}
self.playerViewSize = viewSize;
self.playerView = [[DWVodPlayerView alloc]init];
if (DWAPPDELEGATE.vodPlayerView) {
self.playerView = DWAPPDELEGATE.vodPlayerView;
//选集,要在退出小窗之前设置,否则选集列表会有显示问题
self.playerView.selectionList = self.vidoeList;
[self.playerView quitWindowsModel];
}else{
self.playerView = [[DWVodPlayerView alloc]init];
//选集
self.playerView.selectionList = self.vidoeList;
}
self.playerView.delegate = self;
//选集
self.playerView.selectionList = self.vidoeList;
[self.view addSubview:self.playerView];
[_playerView mas_makeConstraints:^(MASConstraintMaker *make) {
[_playerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.top.and.left.equalTo(@0);
make.width.equalTo(@(self.playerViewSize.width));
make.height.equalTo(@(self.playerViewSize.height));
......@@ -559,7 +583,6 @@ typedef enum : NSUInteger {
make.height.equalTo(@14);
}];
self.bottomView = [[DWVodPlayBottomView alloc]init];
self.bottomView.delegate = self;
[self.view addSubview:self.bottomView];
......@@ -568,6 +591,10 @@ typedef enum : NSUInteger {
make.bottom.equalTo(@0);
make.left.and.right.equalTo(@0);
}];
if (self.landScape) {
[self screenOrientationDidChange:YES];
}
}
-(BOOL)shouldAutorotate
......
......@@ -39,6 +39,8 @@ typedef NS_ENUM(NSInteger, DWVodSettingStyle) {
-(void)playerSettingViewScreenLightChange:(CGFloat)changeValue;
//系统音量改变回调
-(void)playerSettingViewSoundChange:(CGFloat)changeValue;
//窗口播放
-(void)playerSettingWindowsPlay;
@end
......
......@@ -202,6 +202,12 @@ static NSInteger setSectionListTableHeight = 60;
[_delegate playerSettingViewNetworkMonitorAction];
}
}
if (button.tag == 104) {
//窗口播放
if ([_delegate respondsToSelector:@selector(playerSettingWindowsPlay)]) {
[_delegate playerSettingWindowsPlay];
}
}
}
-(void)sizeButtonAction:(UIButton *)button
......@@ -356,14 +362,21 @@ static NSInteger setSectionListTableHeight = 60;
}else{
self.bgScrollView.frame = CGRectMake(0, 0, self.bgView.frame.size.width, self.bgView.frame.size.height);
[self.bgView addSubview:self.bgScrollView];
NSArray * titles = @[@"下载",@"投屏",@"视频播放",@"网络检测"];
NSArray * images = @[@"icon_setting_dwonload.png",@"icon_screen_horizontal.png",@"icon_setting_video.png",@"icon_setting_network.png"];
NSArray * titles = @[@"下载",@"投屏",@"视频播放",@"网络检测",@"小窗播放"];
NSArray * images = @[@"icon_setting_dwonload.png",@"icon_screen_horizontal.png",@"icon_setting_video.png",@"icon_setting_network.png",@"icon_windows_full.png"];
CGFloat buttonWidth = 48.0;
CGFloat space = (self.bgView.frame.size.width - buttonWidth * titles.count - 10 * 2) / 2.0;
CGFloat space = 18;
UIScrollView * scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.bgView.frame.size.width, 46)];
scrollView.contentSize = CGSizeMake(buttonWidth * titles.count + space * (titles.count - 1) + 20, CGRectGetHeight(scrollView.frame));
[self.bgScrollView addSubview:scrollView];
for (int i = 0; i < titles.count; i++) {
DWSettingFuncButton * button = [DWSettingFuncButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(10 + (buttonWidth + space) * i, 20, buttonWidth, 46);
button.frame = CGRectMake(10 + (buttonWidth + space) * i, 0, buttonWidth, CGRectGetHeight(scrollView.frame));
[button setTitle:[titles objectAtIndex:i] forState:UIControlStateNormal];
[button setImage:[UIImage imageNamed:[images objectAtIndex:i]] forState:UIControlStateNormal];
if (i == 2) {
......@@ -375,7 +388,8 @@ static NSInteger setSectionListTableHeight = 60;
[button setTitleColor:[UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:0.7] forState:UIControlStateNormal];
button.tag = 100 + i;
[button addTarget:self action:@selector(funcButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[self.bgScrollView addSubview:button];
// [self.bgScrollView addSubview:button];
[scrollView addSubview:button];
}
self.sizeLabel.frame = CGRectMake(10, 103, self.sizeLabel.frame.size.width, self.sizeLabel.frame.size.height);
......
......@@ -29,6 +29,8 @@ NS_ASSUME_NONNULL_BEGIN
-(void)vodPlayerView:(DWVodPlayerView *)playerView DidNetworkMonitor:(NSString *)vid AndPlayUrl:(NSString *)playUrl;
//访客信息收集器,退出填写
-(void)vodPlayerViewVisitorReturnBack:(DWVodPlayerView *)playerView;
//窗口模式播放
-(void)vodPlayerViewDidEnterWindowsModel:(DWVodPlayerView *)playerView;
@end
......@@ -40,6 +42,10 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic,weak) id <DWVodPlayerViewDelegate> delegate;
@property(nonatomic,strong,readonly)DWVodVideoModel * videoModel;
@property(nonatomic,strong,readonly)DWDownloadModel * downloadModel;
//选集列表
@property(nonatomic,strong)NSArray * selectionList;
......@@ -70,6 +76,12 @@ NS_ASSUME_NONNULL_BEGIN
//清理player
-(void)closePlayer;
//进入窗口模式
-(void)enterWindowsModel;
//退出窗口模式
-(void)quitWindowsModel;
@end
NS_ASSUME_NONNULL_END
......@@ -2,8 +2,16 @@
#import "DWSDK.h"
//#import "DWVodPlayerView.h"
@class DWVodPlayerView;
@interface DWAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic)UIWindow *window;
//窗口播放视图
@property(nonatomic,weak)DWVodPlayerView * vodPlayerView;
//视频列表。窗口播放时,跳转视频播放页面需要
@property(nonatomic,strong)NSArray * videoList;
@end
......@@ -5,6 +5,9 @@
#import "DWOfflineModel.h"
#import "MJExtension.h"
#import <Photos/Photos.h>
#import "DWVodPlayViewController.h"
#import "DWLocalPlayViewController.h"
#import "DWVodPlayerView.h"
#define DWUploadItemPlistFilename @"uploadItems.plist"
......@@ -51,6 +54,8 @@
//根据自己项目原业务逻辑,自行斟酌调用即可。
[self migrateOldDownloadTaskToNewVersion];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(resumePlayVCAction:) name:DWVODPLAYERRESUMEEVENTNOTIFICATION object:nil];
[self.window makeKeyAndVisible];
......@@ -120,6 +125,24 @@
[[NSUserDefaults standardUserDefaults] synchronize];
}
-(void)resumePlayVCAction:(NSNotification *)noti
{
UINavigationController * na = (UINavigationController *)self.window.rootViewController;
UIViewController * preVC = na.viewControllers.lastObject;
if (self.vodPlayerView.videoModel) {
//在线视频
DWVodPlayViewController * vodPlayVC = [[DWVodPlayViewController alloc]init];
vodPlayVC.vodModel = self.vodPlayerView.vodModel;
vodPlayVC.vidoeList = self.videoList;
vodPlayVC.landScape = [noti.object boolValue];
[preVC.navigationController pushViewController:vodPlayVC animated:YES];
}else{
//离线视频
DWLocalPlayViewController * localPlayVC = [[DWLocalPlayViewController alloc]init];
localPlayVC.downloadModel = self.vodPlayerView.downloadModel;
[preVC.navigationController pushViewController:localPlayVC animated:YES];
}
}
- (void)applicationWillResignActive:(UIApplication *)application
{
......
......@@ -45,6 +45,8 @@
<string>请求访问麦克风</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>我们需要访问您的相册</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>添加截图到您的相册</string>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
......
......@@ -44,6 +44,8 @@
#import "DWAppDelegate.h"
#define DWAPPDELEGATE ((DWAppDelegate*)([[UIApplication sharedApplication] delegate]))
#define DWVODPLAYERRESUMEEVENTNOTIFICATION @"DWVodPlayerResumeventNotification"
#import "Masonry.h"
#import "DWTools.h"
#import "DWSDK.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment