Commit 71d052cc authored by Han Ruisong's avatar Han Ruisong
Browse files

更新到 4.7.0

1.优化SDK解密模块,提升稳定性。
2.新增平台统计功能。
3.调整SDK架构,解决与其他产品线的冲突。
parent c2540542
No preview for this file type
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
uuid = "C71384DB-48D4-4A83-8E55-E58993DDD8D8"
uuid = "D493E4A5-FF32-4C5D-B61B-0D88D4BD1AD4"
type = "1"
version = "2.0">
</Bucket>
......@@ -12,6 +12,7 @@
#import "DWVodPlayViewController.h"
#import "DWDownloadManagerViewController.h"
#import "DWUploadViewController.h"
#import "DWVodPlayerSkinViewController.h"
#define VIDEOINFOURL @"https://p.bokecc.com/demo/videoinfo.json"
......@@ -93,7 +94,7 @@
-(void)reloadLoaclData
{
//请自行替换数据
NSArray * videos = @[];
NSArray * videos = @[];
for (int i = 0; i < videos.count; i++) {
DWVodModel * vodModel = [[DWVodModel alloc]init];
......
......@@ -8,7 +8,6 @@
#import "DWNetworkMonitorViewController.h"
#import "DWNetworkMonitor.h"
#import "Reachability.h"
#import "MBProgressHUD.h"
@interface DWNetworkMonitorViewController ()
......@@ -29,7 +28,7 @@
@property(nonatomic,strong) NSString * vid;
//开始网络测试 等等等 状态描述
@property(nonatomic,strong) NSString * networkDescription;
@property(nonatomic,strong) Reachability * reachability;
@property(nonatomic,strong) HDReachability * reachability;
@property(nonatomic,strong) NSString * networkStatus;
@property(nonatomic,strong) NSString * localIP;
//@property(nonatomic,strong) NSString * city;
......@@ -47,20 +46,20 @@
if (self == [super init]) {
//增加网络状态监听
self.reachability = [Reachability reachabilityForInternetConnection];
self.reachability = [HDReachability reachabilityForInternetConnection];
[self.reachability startNotifier];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkStateChange) name:kReachabilityChangedNotification object:nil];
NetworkStatus status = [_reachability currentReachabilityStatus];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkStateChange) name:kHDReachabilityChangedNotification object:nil];
HDNetworkStatus status = [_reachability currentReachabilityStatus];
switch (status) {
case NotReachable:{
case HDNotReachable:{
self.networkStatus = @"未知";
}
break;
case ReachableViaWiFi:{
case HDReachableViaWiFi:{
self.networkStatus = @"WIFI";
}
break;
case ReachableViaWWAN:{
case HDReachableViaWWAN:{
self.networkStatus = @"流量";
}
break;
......@@ -99,7 +98,7 @@
[self.reachability stopNotifier];
self.reachability = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self name:kReachabilityChangedNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kHDReachabilityChangedNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillResignActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
......@@ -297,17 +296,17 @@
-(void)networkStateChange
{
NSString * oldStatus = self.networkStatus;
NetworkStatus status = [_reachability currentReachabilityStatus];
HDNetworkStatus status = [_reachability currentReachabilityStatus];
switch (status) {
case NotReachable:{
case HDNotReachable:{
self.networkStatus = @"未知";
}
break;
case ReachableViaWiFi:{
case HDReachableViaWiFi:{
self.networkStatus = @"WIFI";
}
break;
case ReachableViaWWAN:{
case HDReachableViaWWAN:{
self.networkStatus = @"流量";
}
break;
......
......@@ -5,7 +5,6 @@
#import <MobileCoreServices/MobileCoreServices.h>
#include <AssetsLibrary/AssetsLibrary.h>
#import "DWUploadSessionManager.h"
#import "Reachability.h"
static NSString *const uploadsArray =@"uploadsArray";
......@@ -22,7 +21,7 @@ static NSString *const uploadsArray =@"uploadsArray";
@property(nonatomic,strong)NSArray * uploadList;
@property(nonatomic,strong)Reachability * reachability; //网络状态监听
@property(nonatomic,strong)HDReachability * reachability; //网络状态监听
@end
......@@ -45,9 +44,9 @@ static NSString *const uploadsArray =@"uploadsArray";
[self setUploadingList];
//增加网络状态监听
self.reachability = [Reachability reachabilityForInternetConnection];
self.reachability = [HDReachability reachabilityForInternetConnection];
[self.reachability startNotifier];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkStateChange) name:kReachabilityChangedNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkStateChange) name:kHDReachabilityChangedNotification object:nil];
}
-(void)setUploadingList
......@@ -114,7 +113,7 @@ static NSString *const uploadsArray =@"uploadsArray";
-(void)dealloc
{
[self.reachability stopNotifier];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kReachabilityChangedNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kHDReachabilityChangedNotification object:nil];
NSLog(@"DWUploadViewController dealloc");
}
......@@ -199,18 +198,18 @@ static NSString *const uploadsArray =@"uploadsArray";
-(void)networkStateChange
{
NetworkStatus status = [self.reachability currentReachabilityStatus];
HDNetworkStatus status = [self.reachability currentReachabilityStatus];
switch (status) {
case NotReachable:{
case HDNotReachable:{
//暂无网络
[self suspendOrResumeUploadWithNetwork:NO];
break;
}
case ReachableViaWiFi:{
case HDReachableViaWiFi:{
[self suspendOrResumeUploadWithNetwork:YES];
break;
}
case ReachableViaWWAN:{
case HDReachableViaWWAN:{
[self suspendOrResumeUploadWithNetwork:YES];
break;
}
......
......@@ -74,7 +74,10 @@ typedef enum : NSUInteger {
playInfo.timeoutSeconds = 30;
//音频 + 视频数据,这里仅做示范,可根据自己项目业务逻辑来调整
playInfo.mediatype = @"0";
//开启授权验证功能传入
playInfo.verificationCode = [DWConfigurationManager sharedInstance].verification;
//客户端用户id,选填
// playInfo.roleId = @"";
playInfo.finishBlock = ^(DWVodVideoModel *vodVideo) {
NSLog(@"%@",vodVideo);
//下载时,保存图片,名字等数据
......
......@@ -16,7 +16,6 @@
#import "DWFeedBackView.h"
#import "DWSubtitleView.h"
#import "DWMessageView.h"
#import "Reachability.h"
#import <MediaPlayer/MediaPlayer.h>
#import "DWGIFManager.h"
#import "DWToastView.h"
......@@ -123,7 +122,7 @@
@property(nonatomic,assign)CGFloat systemSound;//系统音量
@property(nonatomic,strong)UISlider * volumeViewSlider;
@property(nonatomic,strong)Reachability * reachability; //网络状态监听
@property(nonatomic,strong)HDReachability * reachability; //网络状态监听
@property(nonatomic,strong)DWVodPlayerPanGesture * pan;//亮度,音量,快进快退调节
......@@ -190,9 +189,7 @@
//@property(nonatomic,strong)NSTimer * testTimer;
//**************************** marquee ****************************
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
@property(nonatomic,strong)HDMarqueeView * marqueeView;
#endif
//**************************** 弹幕 ****************************
//弹幕数据
......@@ -258,9 +255,9 @@ static CGFloat barrageBgHeight = 40;
[self reLayoutWithScreenState:self.isFull];
//增加网络状态监听
self.reachability = [Reachability reachabilityForInternetConnection];
self.reachability = [HDReachability reachabilityForInternetConnection];
[self.reachability startNotifier];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkStateChange) name:kReachabilityChangedNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkStateChange) name:kHDReachabilityChangedNotification object:nil];
//开启远程控制
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
......@@ -307,7 +304,7 @@ static CGFloat barrageBgHeight = 40;
//移除网络监听
[self.reachability stopNotifier];
self.reachability = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self name:kReachabilityChangedNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kHDReachabilityChangedNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:MPVolumeViewWirelessRouteActiveDidChangeNotification object:nil];
......@@ -342,10 +339,8 @@ static CGFloat barrageBgHeight = 40;
//设置videoId,关联弹幕
self.barrageManager.videoId = self.videoModel.videoId;
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
//开启跑马灯功能
[self initMarqueeView];
#endif
}
-(void)playLocalVideo:(DWDownloadModel *)downloadModel
......@@ -374,10 +369,8 @@ static CGFloat barrageBgHeight = 40;
[self.playerView playLocalVideo:downloadModel];
[self play];
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
//开启跑马灯功能
[self initMarqueeView];
#endif
}
-(void)reLayoutWithScreenState:(BOOL)isFull
......@@ -388,11 +381,9 @@ static CGFloat barrageBgHeight = 40;
[self updateConstraintsAndHidden];
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
if (self.marqueeView) {
[self.marqueeView startMarquee];
}
#endif
[self.barrageBgView screenRotate:self.isFull];
}
......@@ -1574,11 +1565,8 @@ static CGFloat barrageBgHeight = 40;
//处理选集数据
[self dealChooseArray];
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
//开启跑马灯功能
[self initMarqueeView];
#endif
}
//处理拖拽事件
......@@ -2000,16 +1988,16 @@ static CGFloat barrageBgHeight = 40;
#pragma mark - 网络状态改变
-(void)networkStateChange
{
NetworkStatus status = [self.reachability currentReachabilityStatus];
HDNetworkStatus status = [self.reachability currentReachabilityStatus];
switch (status) {
case NotReachable:{
case HDNotReachable:{
if (self.videoModel) {
[@"暂无网络" showAlert];
}
break;
}
case ReachableViaWiFi:{
case HDReachableViaWiFi:{
[@"切换到wi-fi网络" showAlert];
if (self.videoModel) {
//切换到wifi 继续播放
......@@ -2024,7 +2012,7 @@ static CGFloat barrageBgHeight = 40;
break;
}
case ReachableViaWWAN:{
case HDReachableViaWWAN:{
[@"切换到4g网络,暂停播放" showAlert];
if (self.videoModel) {
......@@ -3646,7 +3634,6 @@ static CGFloat barrageBgHeight = 40;
self.pan.vodPanDelegate = self;
}
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
-(void)initMarqueeView
{
if (self.marqueeView) {
......@@ -3734,7 +3721,6 @@ static CGFloat barrageBgHeight = 40;
// [self.marqueeView startMarquee];
}
#endif
//设置弹幕视图
-(void)initBarrageView
......
......@@ -14,4 +14,5 @@
//视频列表。窗口播放时,跳转视频播放页面需要
@property(nonatomic,strong)NSArray * videoList;
@end
......@@ -20,6 +20,7 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[DWLog setIsDebugHttpLog:YES];
//设置AVAudioSession
NSError *categoryError = nil;
......@@ -37,7 +38,6 @@
}
//后台下载设置
[[DWDownloadSessionManager manager] configureBackroundSession];
//设置最大下载并发数,默认不设置
// [DWDownloadSessionManager manager].maxDownloadCount = 2;
// [DWDownloadSessionManager manager].isBatchDownload = NO;
......
......@@ -43,8 +43,6 @@
<string>使用期间允许定位</string>
<key>NSMicrophoneUsageDescription</key>
<string>请求访问麦克风</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>添加截图到您的相册</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>我们需要访问您的相册</string>
<key>UIBackgroundModes</key>
......
......@@ -56,6 +56,5 @@
#import "DWConfigurationManager.h"
#import "UIImageView+WebCache.h"
#if __has_include(<HDMarqueeTool/HDMarqueeTool.h>)
#import <HDMarqueeTool/HDMarqueeTool.h>
#endif
#import <HDBaseUtils/HDBaseUtils.h>
......@@ -2,7 +2,7 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.external-accessory.wireless-configuration</key>
<key>com.apple.developer.networking.wifi-info</key>
<true/>
</dict>
</plist>
//
// HDMarqueeTool.h
// HDMarqueeTool
//
// Created by zwl on 2020/3/9.
// Copyright © 2020 zwl. All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for HDMarqueeTool.
FOUNDATION_EXPORT double HDMarqueeToolVersionNumber;
//! Project version string for HDMarqueeTool.
FOUNDATION_EXPORT const unsigned char HDMarqueeToolVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <HDMarqueeTool/PublicHeader.h>
#import "HDMarqueeAction.h"
#import "HDMarqueeView.h"
//
// HDMarqueeTool.h
// HDMarqueeTool
//
// Created by zwl on 2020/3/9.
// Copyright © 2020 zwl. All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for HDMarqueeTool.
FOUNDATION_EXPORT double HDMarqueeToolVersionNumber;
//! Project version string for HDMarqueeTool.
FOUNDATION_EXPORT const unsigned char HDMarqueeToolVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <HDMarqueeTool/PublicHeader.h>
#import "HDMarqueeAction.h"
#import "HDMarqueeView.h"
/*
Copyright (C) 2016 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
*/
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <CoreFoundation/CoreFoundation.h>
#import "Reachability.h"
#pragma mark IPv6 Support
//Reachability fully support IPv6. For full details, see ReadMe.md.
NSString *kReachabilityChangedNotification = @"kNetworkReachabilityChangedNotification";
#pragma mark - Supporting functions
#define kShouldPrintReachabilityFlags 1
static void PrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char* comment)
{
#if kShouldPrintReachabilityFlags
NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n",
(flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
(flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
(flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
(flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
(flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
(flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-',
comment
);
#endif
}
static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
{
#pragma unused (target, flags)
NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
NSCAssert([(__bridge NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback");
Reachability* noteObject = (__bridge Reachability *)info;
// Post a notification to notify the client that the network reachability changed.
[[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject];
}
#pragma mark - Reachability implementation
@implementation Reachability
{
SCNetworkReachabilityRef _reachabilityRef;
}
+ (instancetype)reachabilityWithHostName:(NSString *)hostName
{
Reachability* returnValue = NULL;
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
if (reachability != NULL)
{
returnValue= [[self alloc] init];
if (returnValue != NULL)
{
returnValue->_reachabilityRef = reachability;
}
else {
CFRelease(reachability);
}
}
return returnValue;
}
+ (instancetype)reachabilityWithAddress:(const struct sockaddr *)hostAddress
{
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, hostAddress);
Reachability* returnValue = NULL;
if (reachability != NULL)
{
returnValue = [[self alloc] init];
if (returnValue != NULL)
{
returnValue->_reachabilityRef = reachability;
}
else {
CFRelease(reachability);
}
}
return returnValue;
}
+ (instancetype)reachabilityForInternetConnection
{
struct sockaddr_in zeroAddress;
bzero(&zeroAddress, sizeof(zeroAddress));
zeroAddress.sin_len = sizeof(zeroAddress);
zeroAddress.sin_family = AF_INET;
return [self reachabilityWithAddress: (const struct sockaddr *) &zeroAddress];
}
#pragma mark reachabilityForLocalWiFi
//reachabilityForLocalWiFi has been removed from the sample. See ReadMe.md for more information.
//+ (instancetype)reachabilityForLocalWiFi
#pragma mark - Start and stop notifier
- (BOOL)startNotifier
{
BOOL returnValue = NO;
SCNetworkReachabilityContext context = {0, (__bridge void *)(self), NULL, NULL, NULL};
if (SCNetworkReachabilitySetCallback(_reachabilityRef, ReachabilityCallback, &context))
{
if (SCNetworkReachabilityScheduleWithRunLoop(_reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode))
{
returnValue = YES;
}
}
return returnValue;
}
- (void)stopNotifier
{
if (_reachabilityRef != NULL)
{
SCNetworkReachabilityUnscheduleFromRunLoop(_reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
}
}
- (void)dealloc
{
[self stopNotifier];
if (_reachabilityRef != NULL)
{
CFRelease(_reachabilityRef);
}
}
#pragma mark - Network Flag Handling
- (NetworkStatus)networkStatusForFlags:(SCNetworkReachabilityFlags)flags
{
PrintReachabilityFlags(flags, "networkStatusForFlags");
if ((flags & kSCNetworkReachabilityFlagsReachable) == 0)
{
// The target host is not reachable.
return NotReachable;
}
NetworkStatus returnValue = NotReachable;
if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0)
{
/*
If the target host is reachable and no connection is required then we'll assume (for now) that you're on Wi-Fi...
*/
returnValue = ReachableViaWiFi;
}
if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) ||
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))
{
/*
... and the connection is on-demand (or on-traffic) if the calling application is using the CFSocketStream or higher APIs...
*/
if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0)
{
/*
... and no [user] intervention is needed...
*/