Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CCVideo
VOD_iOS_SDK
Commits
427e365f
Commit
427e365f
authored
Oct 20, 2021
by
zhaowl123
Browse files
4.15.2
parent
03a5ae91
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
766 additions
and
106 deletions
+766
-106
.DS_Store
.DS_Store
+0
-0
Demo/Demo.xcodeproj/project.pbxproj
Demo/Demo.xcodeproj/project.pbxproj
+18
-0
Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate
...xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
Demo/Demo/Classes/DWMainViewController.m
Demo/Demo/Classes/DWMainViewController.m
+1
-0
Demo/Demo/Classes/DWVodPlayViewController.h
Demo/Demo/Classes/DWVodPlayViewController.h
+1
-0
Demo/Demo/Classes/DWVodPlayViewController.m
Demo/Demo/Classes/DWVodPlayViewController.m
+19
-2
Demo/Demo/Classes/Model/DWKnowledgeModel.h
Demo/Demo/Classes/Model/DWKnowledgeModel.h
+28
-0
Demo/Demo/Classes/Model/DWKnowledgeModel.m
Demo/Demo/Classes/Model/DWKnowledgeModel.m
+21
-0
Demo/Demo/Classes/View/Player/DWKnowledgeTableViewCell.h
Demo/Demo/Classes/View/Player/DWKnowledgeTableViewCell.h
+23
-0
Demo/Demo/Classes/View/Player/DWKnowledgeTableViewCell.m
Demo/Demo/Classes/View/Player/DWKnowledgeTableViewCell.m
+137
-0
Demo/Demo/Classes/View/Player/DWPlayerKnowledgeView.h
Demo/Demo/Classes/View/Player/DWPlayerKnowledgeView.h
+20
-0
Demo/Demo/Classes/View/Player/DWPlayerKnowledgeView.m
Demo/Demo/Classes/View/Player/DWPlayerKnowledgeView.m
+255
-0
Demo/Demo/Classes/View/Player/DWVodPlayerView.h
Demo/Demo/Classes/View/Player/DWVodPlayerView.h
+2
-0
Demo/Demo/Classes/View/Player/DWVodPlayerView.m
Demo/Demo/Classes/View/Player/DWVodPlayerView.m
+239
-102
Demo/Demo/SDK/CCVodSDK.framework/CCVodSDK
Demo/Demo/SDK/CCVodSDK.framework/CCVodSDK
+0
-0
Demo/Demo/SDK/CCVodSDK.framework/Headers/CCVodSDK.h
Demo/Demo/SDK/CCVodSDK.framework/Headers/CCVodSDK.h
+1
-1
doc/iOS点播SDK开发指南/4.开发指南.html
doc/iOS点播SDK开发指南/4.开发指南.html
+0
-0
doc/iOS点播SDK开发指南/5.更新日志.html
doc/iOS点播SDK开发指南/5.更新日志.html
+0
-0
include/CCVodSDK.framework/CCVodSDK
include/CCVodSDK.framework/CCVodSDK
+0
-0
include/CCVodSDK.framework/Headers/CCVodSDK.h
include/CCVodSDK.framework/Headers/CCVodSDK.h
+1
-1
No files found.
.DS_Store
View file @
427e365f
No preview for this file type
Demo/Demo.xcodeproj/project.pbxproj
View file @
427e365f
...
...
@@ -284,6 +284,9 @@
04BDEECF2269C534006759A5
/* icon_arrow@3x.png in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04BDEECD2269C534006759A5
/* icon_arrow@3x.png */
;
};
04BDEED22269C5F0006759A5
/* icon_markplay@2x.png in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04BDEED02269C5EF006759A5
/* icon_markplay@2x.png */
;
};
04BDEED32269C5F0006759A5
/* icon_markplay@3x.png in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04BDEED12269C5F0006759A5
/* icon_markplay@3x.png */
;
};
04CA62FF271FBF63003F315D
/* DWKnowledgeTableViewCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04CA62FC271FBF63003F315D
/* DWKnowledgeTableViewCell.m */
;
};
04CA6300271FBF63003F315D
/* DWPlayerKnowledgeView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04CA62FE271FBF63003F315D
/* DWPlayerKnowledgeView.m */
;
};
04CA6303271FBF8E003F315D
/* DWKnowledgeModel.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04CA6302271FBF8E003F315D
/* DWKnowledgeModel.m */
;
};
04CB7E6B24AD7E8800EF6BCF
/* DWBarrageTextDescriptor.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04CB7E6024AD7E8800EF6BCF
/* DWBarrageTextDescriptor.m */
;
};
04CB7E6C24AD7E8800EF6BCF
/* DWBarrageSegmentView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04CB7E6124AD7E8800EF6BCF
/* DWBarrageSegmentView.m */
;
};
04CB7E6D24AD7E8800EF6BCF
/* DWBarrageInputView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
04CB7E6224AD7E8800EF6BCF
/* DWBarrageInputView.m */
;
};
...
...
@@ -836,6 +839,12 @@
04BDEECD2269C534006759A5
/* icon_arrow@3x.png */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
image.png
;
path
=
"icon_arrow@3x.png"
;
sourceTree
=
"<group>"
;
};
04BDEED02269C5EF006759A5
/* icon_markplay@2x.png */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
image.png
;
path
=
"icon_markplay@2x.png"
;
sourceTree
=
"<group>"
;
};
04BDEED12269C5F0006759A5
/* icon_markplay@3x.png */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
image.png
;
path
=
"icon_markplay@3x.png"
;
sourceTree
=
"<group>"
;
};
04CA62FB271FBF63003F315D
/* DWKnowledgeTableViewCell.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
DWKnowledgeTableViewCell.h
;
sourceTree
=
"<group>"
;
};
04CA62FC271FBF63003F315D
/* DWKnowledgeTableViewCell.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
DWKnowledgeTableViewCell.m
;
sourceTree
=
"<group>"
;
};
04CA62FD271FBF63003F315D
/* DWPlayerKnowledgeView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
DWPlayerKnowledgeView.h
;
sourceTree
=
"<group>"
;
};
04CA62FE271FBF63003F315D
/* DWPlayerKnowledgeView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
DWPlayerKnowledgeView.m
;
sourceTree
=
"<group>"
;
};
04CA6301271FBF8E003F315D
/* DWKnowledgeModel.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
DWKnowledgeModel.h
;
sourceTree
=
"<group>"
;
};
04CA6302271FBF8E003F315D
/* DWKnowledgeModel.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
DWKnowledgeModel.m
;
sourceTree
=
"<group>"
;
};
04CB7E5F24AD7E8800EF6BCF
/* DWBarrageBgView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
DWBarrageBgView.h
;
sourceTree
=
"<group>"
;
};
04CB7E6024AD7E8800EF6BCF
/* DWBarrageTextDescriptor.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
DWBarrageTextDescriptor.m
;
sourceTree
=
"<group>"
;
};
04CB7E6124AD7E8800EF6BCF
/* DWBarrageSegmentView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
DWBarrageSegmentView.m
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1103,6 +1112,8 @@
0434421A225F1139003F7EC1
/* Model */
=
{
isa
=
PBXGroup
;
children
=
(
04CA6301271FBF8E003F315D
/* DWKnowledgeModel.h */
,
04CA6302271FBF8E003F315D
/* DWKnowledgeModel.m */
,
04FFA9AC226426E0008C2713
/* DWVodModel.h */
,
04FFA9AD226426E0008C2713
/* DWVodModel.m */
,
0412FA8F2266D0D800D8E6C1
/* DWTableChooseModel.h */
,
...
...
@@ -1275,6 +1286,10 @@
04357C6422699371002081C0
/* Player */
=
{
isa
=
PBXGroup
;
children
=
(
04CA62FB271FBF63003F315D
/* DWKnowledgeTableViewCell.h */
,
04CA62FC271FBF63003F315D
/* DWKnowledgeTableViewCell.m */
,
04CA62FD271FBF63003F315D
/* DWPlayerKnowledgeView.h */
,
04CA62FE271FBF63003F315D
/* DWPlayerKnowledgeView.m */
,
04E789EA2696EDC500A1C6D4
/* DWVodPlayerView.h */
,
04E789E92696EDC400A1C6D4
/* DWVodPlayerView.m */
,
04FFA9AF22642E7D008C2713
/* DWVodPlayTableViewCell.h */
,
...
...
@@ -2271,7 +2286,9 @@
04344367225F1F07003F7EC1
/* UIImage+ForceDecode.m in Sources */
,
04D596112272AFE400EE618C
/* DWDownloadManagerViewController.m in Sources */
,
04EB65BF226D679F00FAB532
/* DWSettingFuncButton.m in Sources */
,
04CA6303271FBF8E003F315D
/* DWKnowledgeModel.m in Sources */
,
0434437A225F1F07003F7EC1
/* SDAnimatedImageRep.m in Sources */
,
04CA6300271FBF63003F315D
/* DWPlayerKnowledgeView.m in Sources */
,
049FF17C225EEEA700D944C5
/* DWToastView.m in Sources */
,
04CB7E8724AD81BC00EF6BCF
/* OCBarrageDescriptor.m in Sources */
,
04344385225F1F07003F7EC1
/* SDImageFrame.m in Sources */
,
...
...
@@ -2379,6 +2396,7 @@
04344386225F1F07003F7EC1
/* SDWebImageDownloaderOperation.m in Sources */
,
04344377225F1F07003F7EC1
/* MKAnnotationView+WebCache.m in Sources */
,
049FF09B225EEEA700D944C5
/* NSString+MJExtension.m in Sources */
,
04CA62FF271FBF63003F315D
/* DWKnowledgeTableViewCell.m in Sources */
,
049FF097225EEEA700D944C5
/* NSObject+MJCoding.m in Sources */
,
049FF17A225EEEA700D944C5
/* DWAdShouView.m in Sources */
,
04344380225F1F07003F7EC1
/* NSBezierPath+RoundedCorners.m in Sources */
,
...
...
Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate
View file @
427e365f
No preview for this file type
Demo/Demo/Classes/DWMainViewController.m
View file @
427e365f
...
...
@@ -206,6 +206,7 @@
DWVodPlayViewController
*
vodPlayVC
=
[[
DWVodPlayViewController
alloc
]
init
];
vodPlayVC
.
vodModel
=
vodModel
;
vodPlayVC
.
vidoeList
=
self
.
videoList
;
vodPlayVC
.
index
=
indexPath
.
row
;
[
self
.
navigationController
pushViewController
:
vodPlayVC
animated
:
YES
];
}
...
...
Demo/Demo/Classes/DWVodPlayViewController.h
View file @
427e365f
...
...
@@ -16,6 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
@property
(
nonatomic
,
strong
)
NSArray
*
vidoeList
;
//选集列表
@property
(
nonatomic
,
assign
)
BOOL
landScape
;
//是否横屏
@property
(
nonatomic
,
assign
)
NSInteger
index
;
//判断播放的事第几个视频 只有播放第一个视频的时候才会有知识点功能
@end
...
...
Demo/Demo/Classes/DWVodPlayViewController.m
View file @
427e365f
...
...
@@ -618,7 +618,7 @@ typedef enum : NSUInteger {
CGFloat
a
=
[[
UIApplication
sharedApplication
]
delegate
].
window
.
safeAreaInsets
.
bottom
;
if
(
a
>
0
)
{
viewSize
=
CGSizeMake
(
ScreenWidth
,
ScaleHeight
(
ScreenWidth
,
375
/
211
.
0
)
+
64
);
}
else
{
}
else
{
viewSize
=
CGSizeMake
(
ScreenWidth
,
ScaleHeight
(
ScreenWidth
,
375
/
211
.
0
));
}
}
else
{
...
...
@@ -632,7 +632,24 @@ typedef enum : NSUInteger {
self
.
playerView
.
selectionList
=
self
.
vidoeList
;
[
self
.
playerView
quitWindowsModel
];
}
else
{
self
.
playerView
=
[[
DWVodPlayerView
alloc
]
init
];
NSDictionary
*
dict
=
@{
@"title"
:
@"知识点"
,
@"pauseStatus"
:
@
(
1
),
@"category"
:
@[
@{
@"cateId"
:
@"1"
,
@"name"
:
@"获得发展史"
,
@"info"
:
@[@{
@"id"
:
@"1"
,
@"startTime"
:
@"17"
,
@"endTime"
:
@"35"
,
@"desc"
:
@"发展史"
}]},
@{
@"cateId"
:
@"2"
,
@"name"
:
@"品牌升级"
,
@"info"
:
@[@{
@"id"
:
@"1"
,
@"startTime"
:
@"35"
,
@"endTime"
:
@"50"
,
@"desc"
:
@"品牌升级"
}]},
@{
@"cateId"
:
@"3"
,
@"name"
:
@"产品介绍"
,
@"info"
:
@[@{
@"id"
:
@"1"
,
@"startTime"
:
@"50"
,
@"endTime"
:
@"63"
,
@"desc"
:
@"产品介绍"
},
@{
@"id"
:
@"2"
,
@"startTime"
:
@"64"
,
@"endTime"
:
@"68"
,
@"desc"
:
@"数说获得"
},@{
@"id"
:
@"3"
,
@"startTime"
:
@"68"
,
@"endTime"
:
@"83"
,
@"desc"
:
@"应用场景"
}]},
@{
@"cateId"
:
@"4"
,
@"name"
:
@"领导风采"
,
@"info"
:
@[@{
@"id"
:
@"1"
,
@"startTime"
:
@"84"
,
@"endTime"
:
@"96"
,
@"desc"
:
@"CEO"
},@{
@"id"
:
@"2"
,
@"startTime"
:
@"223"
,
@"endTime"
:
@"265"
,
@"desc"
:
@"CEO"
}]},
@{
@"cateId"
:
@"5"
,
@"name"
:
@"客户案例"
,
@"info"
:
@[@{
@"id"
:
@"1"
,
@"startTime"
:
@"100"
,
@"endTime"
:
@"108"
,
@"desc"
:
@"北京四中网校"
},@{
@"id"
:
@"2"
,
@"startTime"
:
@"108"
,
@"endTime"
:
@"112"
,
@"desc"
:
@"环球优学"
},
@{
@"id"
:
@"3"
,
@"startTime"
:
@"112"
,
@"endTime"
:
@"120"
,
@"desc"
:
@"结构思考力学院"
},@{
@"id"
:
@"4"
,
@"startTime"
:
@"121"
,
@"endTime"
:
@"130"
,
@"desc"
:
@"馒头商学院"
},@{
@"id"
:
@"5"
,
@"startTime"
:
@"130"
,
@"endTime"
:
@"138"
,
@"desc"
:
@"点掌财经"
},
@{
@"id"
:
@"6"
,
@"startTime"
:
@"139"
,
@"endTime"
:
@"146"
,
@"desc"
:
@"云朵课堂"
}]},
@{
@"cateId"
:
@"6"
,
@"name"
:
@"员工风采"
,
@"info"
:
@[@{
@"id"
:
@"1"
,
@"startTime"
:
@"148"
,
@"endTime"
:
@"208"
,
@"desc"
:
@"员工风采锦集"
}]}
]
};
// NSError *error;
// NSString *path = [[NSBundle mainBundle]pathForResource:@"knowledge" ofType:@"json"];
// NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfFile:path] options:NSJSONReadingMutableLeaves error:&error];
if
(
self
.
index
==
0
){
//传入知识点功能的数据
self
.
playerView
=
[[
DWVodPlayerView
alloc
]
initWithKnowledgeData
:
dict
];
}
else
{
self
.
playerView
=
[[
DWVodPlayerView
alloc
]
init
];
}
//选集
self
.
playerView
.
selectionList
=
self
.
vidoeList
;
}
...
...
Demo/Demo/Classes/Model/DWKnowledgeModel.h
0 → 100644
View file @
427e365f
//
// DWKnowledgeModel.h
// Demo
//
// Created by gw on 2021/10/12.
// Copyright © 2021 com.bokecc.www. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class
info
;
@interface
DWKnowledgeModel
:
NSObject
@property
(
nonatomic
,
copy
)
NSString
*
cateId
;
@property
(
nonatomic
,
copy
)
NSString
*
name
;
@property
(
nonatomic
,
copy
)
NSMutableArray
<
info
*>*
info
;
@property
(
nonatomic
,
assign
)
BOOL
isSelect
;
//默认为NO
@end
@interface
info
:
NSObject
@property
(
nonatomic
,
copy
)
NSString
*
id
;
@property
(
nonatomic
,
copy
)
NSString
*
startTime
;
@property
(
nonatomic
,
copy
)
NSString
*
endTime
;
@property
(
nonatomic
,
copy
)
NSString
*
desc
;
@end
NS_ASSUME_NONNULL_END
Demo/Demo/Classes/Model/DWKnowledgeModel.m
0 → 100644
View file @
427e365f
//
// DWKnowledgeModel.m
// Demo
//
// Created by gw on 2021/10/12.
// Copyright © 2021 com.bokecc.www. All rights reserved.
//
#import "DWKnowledgeModel.h"
@implementation
DWKnowledgeModel
+
(
NSDictionary
*
)
objectClassInArray
{
return
@{
@"info"
:
[
info
class
]};
}
@end
@implementation
info
@end
Demo/Demo/Classes/View/Player/DWKnowledgeTableViewCell.h
0 → 100644
View file @
427e365f
//
// DWKnowledgeTableViewCell.h
// Demo
//
// Created by gw on 2021/10/12.
// Copyright © 2021 com.bokecc.www. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DWKnowledgeModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface
DWKnowledgeTableViewCell
:
UITableViewCell
@property
(
nonatomic
,
strong
)
UILabel
*
titleLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
decLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
circleLabel
;
@property
(
nonatomic
,
strong
)
UIView
*
topView
;
@property
(
nonatomic
,
strong
)
UIView
*
bottomView
;
-
(
void
)
configViewWithModel
:(
info
*
)
model
;
@end
NS_ASSUME_NONNULL_END
Demo/Demo/Classes/View/Player/DWKnowledgeTableViewCell.m
0 → 100644
View file @
427e365f
//
// DWKnowledgeTableViewCell.m
// Demo
//
// Created by gw on 2021/10/12.
// Copyright © 2021 com.bokecc.www. All rights reserved.
//
#import "DWKnowledgeTableViewCell.h"
@implementation
DWKnowledgeTableViewCell
-
(
instancetype
)
initWithStyle
:(
UITableViewCellStyle
)
style
reuseIdentifier
:(
NSString
*
)
reuseIdentifier
{
if
(
self
=
[
super
initWithStyle
:
style
reuseIdentifier
:
reuseIdentifier
]){
self
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
self
.
backgroundColor
=
UIColor
.
clearColor
;
_circleLabel
=
[
UILabel
new
];
_circleLabel
.
layer
.
cornerRadius
=
13
;
_circleLabel
.
layer
.
masksToBounds
=
YES
;
_circleLabel
.
layer
.
borderWidth
=
1
;
_circleLabel
.
layer
.
borderColor
=
UIColor
.
whiteColor
.
CGColor
;
_circleLabel
.
textAlignment
=
1
;
_circleLabel
.
textColor
=
ColorFrom16A
(
0xffffff
,
0
.
7
);
[
self
addSubview
:
_circleLabel
];
[
_circleLabel
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerY
.
equalTo
(
self
.
mas_centerY
);
make
.
left
.
equalTo
(
self
).
offset
(
15
);
make
.
width
.
and
.
height
.
equalTo
(
@26
);
}];
_topView
=
[
UIView
new
];
_topView
.
backgroundColor
=
UIColor
.
whiteColor
;
[
self
addSubview
:
_topView
];
[
_topView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
);
make
.
bottom
.
equalTo
(
_circleLabel
.
mas_top
);
make
.
width
.
equalTo
(
@1
);
make
.
centerX
.
equalTo
(
_circleLabel
.
mas_centerX
);
}];
_bottomView
=
[
UIView
new
];
_bottomView
.
backgroundColor
=
UIColor
.
whiteColor
;
[
self
addSubview
:
_bottomView
];
[
_bottomView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
_circleLabel
.
mas_bottom
);
make
.
bottom
.
equalTo
(
self
);
make
.
width
.
equalTo
(
@1
);
make
.
centerX
.
equalTo
(
_circleLabel
.
mas_centerX
);
}];
_titleLabel
=
[
UILabel
new
];
_titleLabel
.
textColor
=
ColorFrom16A
(
0xffffff
,
0
.
8
);
_titleLabel
.
font
=
TitleFont
(
15
);
[
self
addSubview
:
_titleLabel
];
[
_titleLabel
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
).
offset
(
10
);
make
.
left
.
equalTo
(
_circleLabel
.
mas_right
).
offset
(
10
);
make
.
right
.
equalTo
(
self
).
offset
(
-
10
);
make
.
height
.
equalTo
(
@15
);
}];
_decLabel
=
[
UILabel
new
];
_decLabel
.
textColor
=
ColorFrom16A
(
0xffffff
,
0
.
8
);
_decLabel
.
font
=
TitleFont
(
14
);
[
self
addSubview
:
_decLabel
];
[
_decLabel
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
_titleLabel
.
mas_bottom
).
offset
(
11
);
make
.
left
.
equalTo
(
_titleLabel
);
make
.
right
.
equalTo
(
_titleLabel
);
make
.
height
.
equalTo
(
@14
);
}];
}
return
self
;
}
-
(
void
)
configViewWithModel
:(
info
*
)
model
{
_circleLabel
.
text
=
model
.
id
;
if
(
model
.
desc
.
length
==
0
){
_decLabel
.
hidden
=
YES
;
[
_titleLabel
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
centerY
.
equalTo
(
self
.
mas_centerY
);
make
.
left
.
equalTo
(
_circleLabel
.
mas_right
).
offset
(
10
);
make
.
right
.
equalTo
(
self
).
offset
(
-
10
);
make
.
height
.
equalTo
(
@15
);
}];
}
else
{
[
_titleLabel
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
).
offset
(
10
);
make
.
left
.
equalTo
(
_circleLabel
.
mas_right
).
offset
(
10
);
make
.
right
.
equalTo
(
self
).
offset
(
-
10
);
make
.
height
.
equalTo
(
@15
);
}];
}
if
(
model
.
endTime
.
length
==
0
){
_titleLabel
.
text
=
[
self
getMMSSFromSS
:
model
.
startTime
];
}
else
{
_titleLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@~%@"
,
[
self
getMMSSFromSS
:
model
.
startTime
],
[
self
getMMSSFromSS
:
model
.
endTime
]];
}
_decLabel
.
text
=
model
.
desc
;
}
//传入 秒 得到 xx分钟xx秒
-
(
NSString
*
)
getMMSSFromSS
:(
NSString
*
)
totalTime
{
NSInteger
seconds
=
[
totalTime
integerValue
];
//format of minute
NSString
*
str_minute
=
[
NSString
stringWithFormat
:
@"%ld"
,
seconds
/
60
];
//format of second
NSString
*
str_second
=
[
NSString
stringWithFormat
:
@"%ld"
,
seconds
%
60
];
//format of time
if
(
str_minute
.
length
<=
1
){
str_minute
=
[
NSString
stringWithFormat
:
@"0%@"
,
str_minute
];
}
if
(
str_second
.
length
<=
1
){
str_second
=
[
NSString
stringWithFormat
:
@"0%@"
,
str_second
];
}
NSString
*
format_time
=
[
NSString
stringWithFormat
:
@"%@:%@"
,
str_minute
,
str_second
];
NSLog
(
@"format_time : %@"
,
format_time
);
return
format_time
;
}
-
(
void
)
awakeFromNib
{
[
super
awakeFromNib
];
// Initialization code
}
-
(
void
)
setSelected
:(
BOOL
)
selected
animated
:(
BOOL
)
animated
{
[
super
setSelected
:
selected
animated
:
animated
];
// Configure the view for the selected state
}
@end
Demo/Demo/Classes/View/Player/DWPlayerKnowledgeView.h
0 → 100644
View file @
427e365f
//
// DWPlayerKnowledgeView.h
// Demo
//
// Created by gw on 2021/10/12.
// Copyright © 2021 com.bokecc.www. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "DWKnowledgeModel.h"
NS_ASSUME_NONNULL_BEGIN
typedef
void
(
^
DWKnowledgeDidselectBlcok
)(
info
*
model
,
BOOL
pauseStatus
,
NSIndexPath
*
indexPath
);
//pauseStatus 1需要暂停 0不需要
@interface
DWPlayerKnowledgeView
:
UIView
-
(
instancetype
)
initWithData
:(
NSDictionary
*
)
knowledgeData
totalTime
:(
CGFloat
)
totalTime
index
:(
NSIndexPath
*
)
indexPath
;
//totalTime当前视频的总时长
-
(
void
)
show
;
-
(
void
)
dismiss
;
@property
(
nonatomic
,
copy
)
DWKnowledgeDidselectBlcok
knowledgeBlock
;
@end
NS_ASSUME_NONNULL_END
Demo/Demo/Classes/View/Player/DWPlayerKnowledgeView.m
0 → 100644
View file @
427e365f
//
// DWPlayerKnowledgeView.m
// Demo
//
// Created by gw on 2021/10/12.
// Copyright © 2021 com.bokecc.www. All rights reserved.
//
#import "DWPlayerKnowledgeView.h"
#import "DWKnowledgeModel.h"
#import "MJExtension.h"
#import "DWKnowledgeTableViewCell.h"
@interface
DWPlayerKnowledgeView
()
<
UITableViewDelegate
,
UITableViewDataSource
,
UIGestureRecognizerDelegate
>
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
UIView
*
bgView
;
@property
(
nonatomic
,
strong
)
UILabel
*
titleLabel
;
@property
(
nonatomic
,
strong
)
NSMutableArray
*
datasource
;
@property
(
nonatomic
,
copy
)
NSString
*
titleString
;
@property
(
nonatomic
,
strong
)
NSIndexPath
*
indexPath
;
@property
(
nonatomic
,
assign
)
BOOL
pauseStatus
;
@property
(
nonatomic
,
assign
)
CGFloat
totalTime
;
@end
@implementation
DWPlayerKnowledgeView
-
(
instancetype
)
initWithData
:(
NSDictionary
*
)
knowledgeData
totalTime
:(
CGFloat
)
totalTime
index
:(
nonnull
NSIndexPath
*
)
indexPath
{
if
(
self
=
[
super
init
]){
_indexPath
=
indexPath
;
_totalTime
=
totalTime
;
self
.
frame
=
CGRectMake
(
0
,
0
,
ScreenWidth
,
ScreenHeight
);
self
.
backgroundColor
=
[
UIColor
clearColor
];
self
.
hidden
=
YES
;
UITapGestureRecognizer
*
tap
=
[[
UITapGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
dismiss
)];
tap
.
delegate
=
self
;
[
self
addGestureRecognizer
:
tap
];
[[
UIApplication
sharedApplication
].
keyWindow
addSubview
:
self
];
_titleString
=
knowledgeData
[
@"title"
];
_pauseStatus
=
[
knowledgeData
[
@"pauseStatus"
]
boolValue
];
[
self
setupUI
];
NSArray
*
arr
=
knowledgeData
[
@"category"
];
if
(
arr
.
count
>
0
){
for
(
NSDictionary
*
dict
in
arr
)
{
DWKnowledgeModel
*
model
=
[
DWKnowledgeModel
mj_objectWithKeyValues
:
dict
];
if
(
model
.
info
.
count
==
1
){
model
.
isSelect
=
1
;
}
else
{
model
.
isSelect
=
0
;
}
[
self
.
datasource
addObject
:
model
];
}
[
self
.
tableView
reloadData
];
}
}
return
self
;
}
-
(
void
)
setupUI
{
_bgView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
ScreenWidth
,
0
,
ScreenWidth
/
3
,
ScreenHeight
)];
_bgView
.
backgroundColor
=
ColorFrom16A
(
0x151515
,
0
.
8
);
[
self
addSubview
:
_bgView
];
_titleLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
15
,
14
,
100
,
14
)];
_titleLabel
.
text
=
_titleString
;
_titleLabel
.
textColor
=
UIColor
.
whiteColor
;
_titleLabel
.
font
=
TitleFont
(
14
);
[
_bgView
addSubview
:
_titleLabel
];
UIButton
*
closeBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
[
closeBtn
setImage
:[
UIImage
imageNamed
:
@"knowledge_close"
]
forState
:
0
];
[
closeBtn
addTarget
:
self
action
:
@selector
(
dismiss
)
forControlEvents
:
UIControlEventTouchUpInside
];
closeBtn
.
frame
=
CGRectMake
(
_bgView
.
frame
.
size
.
width
-
50
,
0
,
40
,
40
);
[
_bgView
addSubview
:
closeBtn
];
_tableView
=
[[
UITableView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
40
,
_bgView
.
frame
.
size
.
width
,
_bgView
.
frame
.
size
.
height
-
40
)
style
:
UITableViewStylePlain
];
_tableView
.
backgroundColor
=
UIColor
.
clearColor
;
_tableView
.
delegate
=
self
;
_tableView
.
dataSource
=
self
;
_tableView
.
sectionHeaderHeight
=
40
;
_tableView
.
separatorStyle
=
UITableViewCellSeparatorStyleNone
;
[
_tableView
registerClass
:[
DWKnowledgeTableViewCell
class
]
forCellReuseIdentifier
:
@"cell"
];
[
_bgView
addSubview
:
_tableView
];
}
-
(
void
)
show
{
self
.
hidden
=
NO
;
[
UIView
animateWithDuration
:
0
.
3
animations
:
^
{
_bgView
.
frame
=
CGRectMake
(
ScreenWidth
-
ScreenWidth
/
3
,
0
,
ScreenWidth
/
3
,
ScreenHeight
);
}];
}
-
(
void
)
dismiss
{
[
UIView
animateWithDuration
:
0
.
3
animations
:
^
{
_bgView
.
frame
=
CGRectMake
(
ScreenWidth
,
0
,
ScreenWidth
/
3
,
ScreenHeight
);
}
completion
:^
(
BOOL
finished
)
{
self
.
hidden
=
YES
;
}];
}
-
(
NSInteger
)
numberOfSectionsInTableView
:(
UITableView
*
)
tableView
{
return
self
.
datasource
.
count
;
}
-
(
UIView
*
)
tableView
:(
UITableView
*
)
tableView
viewForHeaderInSection
:(
NSInteger
)
section
{
DWKnowledgeModel
*
model
=
self
.
datasource
[
section
];
UIView
*
headerView
=
[[
UIView
alloc
]
init
];
headerView
.
backgroundColor
=
ColorFrom16A
(
0x151515
,
1
);
UILabel
*
titleLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
15
,
12
.
5
,
150
,
16
)];
titleLabel
.
font
=
TitleFont
(
15
);
titleLabel
.
textColor
=
UIColor
.
whiteColor
;
titleLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@(%ld)"
,
model
.
name
,
model
.
info
.
count
];
[
headerView
addSubview
:
titleLabel
];
headerView
.
tag
=
section
;
UITapGestureRecognizer
*
tap
=
[[
UITapGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
handleHeaderViewAction
:
)];
UIImageView
*
iv
=
[[
UIImageView
alloc
]
initWithFrame
:
CGRectMake
(
_bgView
.
frame
.
size
.
width
-
50
,
0
,
40
,
40
)];
if
(
model
.
isSelect
){
iv
.
image
=
[
UIImage
imageNamed
:
@"knowledge_up"
];
}
else
{
iv
.
image
=
[
UIImage
imageNamed
:
@"knowledge_down"
];
}
if
(
self
.
datasource
.
count
==
1
||
model
.
info
.
count
==
1
){
iv
.
hidden
=
YES
;
}
else
{
[
headerView
addGestureRecognizer
:
tap
];
iv
.
hidden
=
NO
;
}
[
headerView
addSubview
:
iv
];
return
headerView
;
}
-
(
void
)
handleHeaderViewAction
:(
UITapGestureRecognizer
*
)
tap
{
NSInteger
index
=
tap
.
view
.
tag
;
DWKnowledgeModel
*
model
=
self
.
datasource
[
index
];
if
(
model
.
isSelect
==
0
){
DWKnowledgeModel
*
replaceModel
=
self
.
datasource
[
index
];
replaceModel
.
isSelect
=
1
;
[
self
.
datasource
replaceObjectAtIndex
:
index
withObject
:
replaceModel
];
}
else
{
DWKnowledgeModel
*
replaceModel
=
self
.
datasource
[
index
];
replaceModel
.
isSelect
=
0
;
[
self
.
datasource
replaceObjectAtIndex
:
index
withObject
:
replaceModel
];
}
[
self
.
tableView
reloadData
];
}
-
(
NSInteger
)
tableView
:(
UITableView
*
)
tableView
numberOfRowsInSection
:(
NSInteger
)
section
{
DWKnowledgeModel
*
model
=
self
.
datasource
[
section
];
if
(
self
.
datasource
.
count
==
1
){
//当只有一个的时候要展开
return
model
.
info
.
count
;
}
if
(
model
.
isSelect
==
0
){
return
0
;
}
else
{
return
model
.
info
.
count
;
}
}
-
(
CGFloat
)
tableView
:(
UITableView
*
)
tableView
heightForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
DWKnowledgeModel
*
model
=
self
.
datasource
[
indexPath
.
section
];
info
*
infoModel
=
model
.
info
[
indexPath
.
row
];
if
(
infoModel
.
startTime
.
floatValue
>
_totalTime
||
infoModel
.
endTime
.
floatValue
>
_totalTime
){
return
0
;
}
else
{
return
60
;
}
return
60
;
}
-
(
UITableViewCell
*
)
tableView
:(
UITableView
*
)
tableView
cellForRowAtIndexPath
:(
NSIndexPath
*
)
indexPath
{
DWKnowledgeTableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
@"cell"
];
DWKnowledgeModel
*
model
=
self
.
datasource
[
indexPath
.
section
];
info
*
infoModel
=
model
.
info
[
indexPath
.
row
];
[
cell
configViewWithModel
:
infoModel
];
if
(
infoModel
.
startTime
.
floatValue
>
_totalTime
||
infoModel
.
endTime
.
floatValue
>
_totalTime
){
cell
.
hidden
=
YES
;
}
else
{
cell
.
hidden
=
NO
;
}
if
(
model
.
info
.
count
==
1
){
cell
.
topView
.
hidden
=
YES
;
cell
.
bottomView
.
hidden
=
YES
;
}
else
{
cell
.
topView
.
hidden
=
NO
;
cell
.
bottomView
.
hidden
=
NO
;
}
if
(
indexPath
.
row
==
0
){
cell
.
topView
.
hidden
=
YES
;
}
else
{
cell
.
topView
.
hidden
=
NO
;
}
if
(
indexPath
.
row
==
model
.
info
.
count
-
1
){
cell
.
bottomView
.
hidden
=
YES
;
}
else
{
cell
.
bottomView
.
hidden
=
NO
;
}
if
(
_indexPath
==
indexPath
){
cell
.
backgroundColor
=
ColorFrom16A
(
0xffffff
,
0
.
1
);
cell
.
circleLabel
.
backgroundColor
=
UIColor
.
whiteColor
;
cell
.
circleLabel
.
font
=
[
UIFont
boldSystemFontOfSize
:
14
];
cell
.
circleLabel
.
textColor
=
ColorFrom16A
(
0x333333
,
1
);
cell
.
titleLabel
.
textColor
=
UIColor
.
whiteColor
;
cell
.
titleLabel
.
font
=
[
UIFont
boldSystemFontOfSize
:
15
];
cell
.
decLabel
.
font
=
[
UIFont
boldSystemFontOfSize
:
14
];
cell
.
decLabel
.
textColor
=
UIColor
.
whiteColor
;