Skip to content

Commit 9b19ac4

Browse files
committed
update recent code
1 parent 1580cf2 commit 9b19ac4

File tree

21 files changed

+220
-122
lines changed

21 files changed

+220
-122
lines changed

Example/VPInterfaceControllerDemo/VPSinglePlayerViewController.m

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ - (void)initSettingButton {
309309
self.appInfoViewButton = appInfoViewButton;
310310

311311
[settingButton mas_makeConstraints:^(MASConstraintMaker *make) {
312-
make.right.equalTo(self.view.mas_right);
312+
make.centerX.equalTo(self.view.mas_centerX);
313313
make.bottom.equalTo(self.view.mas_bottom).with.offset(-40);
314314
}];
315315

@@ -470,6 +470,7 @@ - (void)settingViewApplyButtonDidClicked:(id)sender {
470470
}
471471
[PrivateConfig shareConfig].videoUrl = self.settingView.urlTextField.text;
472472
[PrivateConfig shareConfig].identifier = self.settingView.videoIdTextField.text;
473+
[PrivateConfig shareConfig].cate = self.settingView.categoryTextField.text;
473474
[PrivateConfig shareConfig].environment = self.settingView.environmentControl.selectedSegmentIndex;
474475
[[VPUPDebugSwitch sharedDebugSwitch] switchEnvironment:[PrivateConfig shareConfig].environment];
475476
// [[VPUPDebugSwitch sharedDebugSwitch] switchEnvironment:VPUPDebugStateTest];
@@ -493,6 +494,7 @@ - (void)reloadVideoInfo {
493494
_interfaceController.config.extendDict = @{@"creativeName":[PrivateConfig shareConfig].creativeName};
494495
}
495496
_interfaceController.config.identifier = [PrivateConfig shareConfig].identifier;
497+
_interfaceController.config.extendDict = VPUP_JsonToDictionary([PrivateConfig shareConfig].cate);
496498
_mediaControlView.hidden = NO;
497499
[_interfaceController start];
498500
if (_mediaControlView.videoSwitchButton.selected) {
@@ -611,13 +613,10 @@ - (void)initInterfaceController {
611613
config.title = @"测试";
612614
config.types = _type;
613615
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:0];
614-
if ([PrivateConfig shareConfig].cate) {
615-
[dict setObject:[PrivateConfig shareConfig].cate forKey:@"category"];
616-
}
617616
if ([PrivateConfig shareConfig].creativeName) {
618617
[dict setObject:[PrivateConfig shareConfig].creativeName forKey:@"creativeName"];
619618
}
620-
config.extendDict = dict;
619+
config.extendDict = VPUP_JsonToDictionary([PrivateConfig shareConfig].cate);
621620
CGSize screenSize = [UIScreen mainScreen].bounds.size;
622621
VPIVideoPlayerSize *videoPlayerSize = [[VPIVideoPlayerSize alloc] init];
623622
videoPlayerSize.portraitFullScreenWidth = screenSize.width < screenSize.height ? screenSize.width : screenSize.height;

Example/VPInterfaceControllerDemo/VPVideoSettingView.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
@property (nonatomic, weak) UIView *panel;
1515
@property (nonatomic, weak) VPTextField *urlTextField;
1616
@property (nonatomic, weak) VPTextField *videoIdTextField;
17+
@property (nonatomic, weak) VPTextField *categoryTextField;
1718
@property (nonatomic, weak) UITextField *platformIdTextField;
1819
@property (nonatomic, weak) UIButton *applyButton;
1920
@property (nonatomic, weak) UISegmentedControl *environmentControl;

Example/VPInterfaceControllerDemo/VPVideoSettingView.m

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ - (void)initUI {
9595
self.urlTextField = urlTextField;
9696
urlTextField.dataArray = [VPVideoListData shared].videoUrlArray;
9797

98+
UILabel *categoryTitle = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 100, 30)];
99+
[categoryTitle setText:@"分类"];
100+
[panel addSubview:categoryTitle];
101+
102+
VPTextField *categoryTextField = [[VPTextField alloc] initWithFrame:CGRectMake(90, 20, 240, 40)];
103+
categoryTextField.borderStyle = UITextBorderStyleRoundedRect;
104+
[panel addSubview:categoryTextField];
105+
self.categoryTextField = categoryTextField;
106+
categoryTextField.dataArray = nil;
98107

99108
NSArray *environmentArray = @[@"正式环境", @"预发布环境", @"测试环境", @"开发环境"];
100109
UISegmentedControl *environmentControl = [[UISegmentedControl alloc] initWithItems:environmentArray];
@@ -130,7 +139,7 @@ - (void)initUI {
130139
//platformId
131140
[platformIdTitle mas_makeConstraints:^(MASConstraintMaker *make) {
132141
make.left.equalTo(panel.mas_left).with.offset(widthSpace);
133-
make.top.equalTo(panel.mas_top).with.offset(30);
142+
make.top.equalTo(panel.mas_top).with.offset(20);
134143
make.width.mas_equalTo(90);
135144
make.height.mas_equalTo(30);
136145
}];
@@ -144,7 +153,7 @@ - (void)initUI {
144153
//roomId
145154
[urlTitle mas_makeConstraints:^(MASConstraintMaker *make) {
146155
make.left.equalTo(panel.mas_left).with.offset(widthSpace);
147-
make.top.equalTo(platformIdTitle.mas_bottom).with.offset(30);
156+
make.top.equalTo(platformIdTitle.mas_bottom).with.offset(20);
148157
make.width.mas_equalTo(90);
149158
make.height.mas_equalTo(30);
150159
}];
@@ -157,7 +166,7 @@ - (void)initUI {
157166

158167
[videoIdTitle mas_makeConstraints:^(MASConstraintMaker *make) {
159168
make.left.equalTo(panel.mas_left).with.offset(widthSpace);
160-
make.top.equalTo(urlTitle.mas_bottom).with.offset(30);
169+
make.top.equalTo(urlTitle.mas_bottom).with.offset(20);
161170
make.width.mas_equalTo(90);
162171
make.height.mas_equalTo(30);
163172
}];
@@ -169,11 +178,25 @@ - (void)initUI {
169178
make.centerY.equalTo(videoIdTitle.mas_centerY);
170179
}];
171180

181+
[categoryTitle mas_makeConstraints:^(MASConstraintMaker *make) {
182+
make.left.equalTo(panel.mas_left).with.offset(widthSpace);
183+
make.top.equalTo(videoIdTitle.mas_bottom).with.offset(20);
184+
make.width.mas_equalTo(90);
185+
make.height.mas_equalTo(30);
186+
}];
187+
188+
[categoryTextField mas_makeConstraints:^(MASConstraintMaker *make) {
189+
make.right.equalTo(panel.mas_right).with.offset(-widthSpace);
190+
make.left.equalTo(categoryTitle.mas_right).with.offset(10);
191+
make.height.mas_equalTo(40);
192+
make.centerY.equalTo(categoryTitle.mas_centerY);
193+
}];
194+
172195
//
173196
[environmentControl mas_makeConstraints:^(MASConstraintMaker *make) {
174197
make.left.equalTo(panel.mas_left).with.offset(widthSpace);
175198
make.right.equalTo(panel.mas_right).with.offset(-widthSpace);
176-
make.top.equalTo(videoIdTitle.mas_bottom).with.offset(30);
199+
make.top.equalTo(categoryTitle.mas_bottom).with.offset(30);
177200
make.height.mas_equalTo(40);
178201
}];
179202

Example/VPInterfaceControllerDemo/VideoOSDevApp/DevAppControllers/DevAppPlayerViewController.m

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -255,28 +255,11 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
255255
case Type_Service:
256256
return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
257257
break;
258-
259258
default:
260259
break;
261260
}
262261
}
263262

264-
//一开始的方向 很重要
265-
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation{
266-
switch (self.controllerType) {
267-
case Type_Interaction:
268-
return UIInterfaceOrientationPortrait;
269-
break;
270-
case Type_Service:
271-
return UIInterfaceOrientationLandscapeRight;
272-
break;
273-
274-
default:
275-
break;
276-
}
277-
278-
}
279-
280263
- (void)setNewOrientation:(BOOL)fullscreen{
281264

282265

Resources/VideoPlsResources.bundle/lua/main.lua

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ local function checkHotspotShow(data)
163163
commonParam = Native:commonParam()
164164
}
165165

166+
local videoInfo = Native:getVideoInfo()
167+
168+
if videoInfo["extendDict"] ~= nil then
169+
paramData["videoInfo"] = videoInfo["extendDict"]
170+
end
171+
166172
local paramDataString = Native:tableToJson(paramData)
167173
-- local OS_HTTP_POST_CHECK_HOTSPOT = OS_HTTP_HOST .. "/api/notice"
168174

@@ -365,6 +371,13 @@ local function getTaglist()
365371
title = Native:getVideoTitle(),
366372
commonParam = Native:commonParam()
367373
}
374+
375+
local videoInfo = Native:getVideoInfo()
376+
377+
if videoInfo["extendDict"] ~= nil then
378+
paramData["videoInfo"] = videoInfo["extendDict"]
379+
end
380+
368381
local paramDataString = Native:tableToJson(paramData)
369382
--print("[LuaView] "..paramDataString)
370383
--print("[LuaView] "..Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY))
@@ -378,7 +391,7 @@ local function getTaglist()
378391
return
379392
end
380393
responseData = Native:aesDecrypt(response.encryptData, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY)
381-
--print("luaview "..responseData)
394+
print("luaview "..responseData)
382395

383396
response = toTable(responseData)
384397
if (response.resCode ~= "00") then
@@ -429,8 +442,15 @@ local function getSimulationTag()
429442
videoId = Native:nativeVideoID(),
430443
commonParam = Native:commonParam()
431444
}
432-
local extendJson = Native:getConfigExtendJSONString()
433-
local extendTable = toTable(extendJson)
445+
446+
local extendTable = nil
447+
448+
local videoInfo = Native:getVideoInfo()
449+
450+
if videoInfo["extendDict"] ~= nil then
451+
paramData["videoInfo"] = videoInfo["extendDict"]
452+
extendTable = videoInfo["extendDict"]
453+
end
434454

435455
if extendTable["creativeName"] ~= nil then
436456
paramData["creativeName"] = extendTable["creativeName"]
@@ -487,6 +507,13 @@ local function getResourcelist()
487507
videoId = Native:nativeVideoID(),
488508
commonParam = Native:commonParam()
489509
}
510+
511+
local videoInfo = Native:getVideoInfo()
512+
513+
if videoInfo["extendDict"] ~= nil then
514+
paramData["videoInfo"] = videoInfo["extendDict"]
515+
end
516+
490517
local paramDataString = Native:tableToJson(paramData)
491518
-- print("[LuaView] getResourcelist")
492519
--print("[LuaView] "..Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY))
@@ -562,6 +589,13 @@ function show(args)
562589
videoId = Native:nativeVideoID(),
563590
commonParam = Native:commonParam()
564591
}
592+
593+
local videoInfo = Native:getVideoInfo()
594+
595+
if videoInfo["extendDict"] ~= nil then
596+
paramData["videoInfo"] = videoInfo["extendDict"]
597+
end
598+
565599
local paramDataString = Native:tableToJson(paramData)
566600
--print("luaview "..Native:aesEncrypt(paramDataString, OS_HTTP_PUBLIC_KEY, OS_HTTP_PUBLIC_KEY))
567601
mainNode.request:post(OS_HTTP_GET_CONFIG, {

Resources/VideoPlsResources.bundle/lua/os_string.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ OS_HTTP_HOST = Native:videoOShost()
55
-- OS_HTTP_HOST = "http://dev-videopublicapi.videojj.com/videoos-api/"
66

77
OS_HTTP_GET_CONFIG = OS_HTTP_HOST .. "/api/config"
8-
OS_HTTP_GET_TAG_LIST = OS_HTTP_HOST .. "/api/v2/queryLaunchInfo"
8+
OS_HTTP_GET_TAG_LIST = OS_HTTP_HOST .. "/api/v3/queryLaunchInfo"
99
OS_HTTP_GET_RESOURCE_LIST = OS_HTTP_HOST .. "/api/preloadLaunchInfo"
1010
OS_HTTP_GET_MOBILE_QUERY = OS_HTTP_HOST .. "/api/mobileQuery"
1111
OS_HTTP_POST_MOBILE_QUERY = OS_HTTP_HOST .. "/api/mobileModify"
1212
OS_HTTP_GET_COMMON_QUERY = OS_HTTP_HOST .. "/api/commonQuery"
1313
OS_HTTP_GET_SIMULATION_TAG = OS_HTTP_HOST .. "/simulation/queryInfo"
14-
OS_HTTP_POST_CHECK_HOTSPOT = OS_HTTP_HOST .. "/api/notice"
14+
OS_HTTP_POST_CHECK_HOTSPOT = OS_HTTP_HOST .. "/api/v3/notice"
1515
OS_HTTP_POST_CHECK_HOTSPOT_TRACK = OS_HTTP_HOST .. "/statisticConfirmLaunch"
1616

1717
--数据统计网络相关

VideoPlsInterfaceControllerSDK/VideoPlsInterfaceControllerSDK/VideoPlsInterfaceControllerSDK/VPInterfaceController.m

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,7 @@ - (VPLVideoInfo *)interfaceControllerConfigToVideoInfo:(VPInterfaceControllerCon
236236
videoInfo.platformID = config.platformID;
237237
videoInfo.episode = config.episode;
238238
videoInfo.title = config.title;
239-
videoInfo.category = config.category;
240-
videoInfo.extendJSONString = VPUP_DictionaryToJson(config.extendDict);
239+
videoInfo.extendDict = config.extendDict;
241240
return videoInfo;
242241
}
243242

@@ -477,7 +476,10 @@ - (void)unregisterStatusNotification {
477476

478477

479478
- (NSDictionary *)getUserInfoDictionary {
480-
VPIUserInfo * userInfo = [self.userDelegate vp_getUserInfo];
479+
VPIUserInfo * userInfo = nil;
480+
if (self.userDelegate && [self.userDelegate respondsToSelector:@selector(vp_getUserInfo)]) {
481+
userInfo = [self.userDelegate vp_getUserInfo];
482+
}
481483
if (!userInfo) {
482484
return nil;
483485
}
@@ -486,7 +488,7 @@ - (NSDictionary *)getUserInfoDictionary {
486488
}
487489

488490
- (void)notifyScreenChange:(NSNotification *)sender {
489-
if (self.delegate) {
491+
if (self.delegate && [self.delegate respondsToSelector:@selector(vp_interfaceScreenChangedNotify:)]) {
490492
NSDictionary *dic = sender.userInfo;
491493
if (dic && [dic objectForKey:@"orientation"]) {
492494
[self.delegate vp_interfaceScreenChangedNotify:dic];
@@ -495,7 +497,7 @@ - (void)notifyScreenChange:(NSNotification *)sender {
495497
}
496498

497499
- (void)notifyUserLogined:(NSNotification *)sender {
498-
if (self.userDelegate) {
500+
if (self.userDelegate && [self.userDelegate respondsToSelector:@selector(vp_userLogined:)]) {
499501
NSDictionary *dic = sender.userInfo;
500502
if (dic) {
501503
VPIUserInfo *userInfo = [[VPIUserInfo alloc] init];
@@ -717,21 +719,21 @@ - (NSDictionary*)getUserInfo {
717719
}
718720

719721
- (NSTimeInterval)videoPlayerCurrentItemAssetDuration {
720-
if (self.videoPlayerDelegate) {
722+
if (self.videoPlayerDelegate && [self.videoPlayerDelegate respondsToSelector:@selector(videoPlayerCurrentItemAssetDuration)]) {
721723
return [self.videoPlayerDelegate videoPlayerCurrentItemAssetDuration];
722724
}
723725
return 0;
724726
}
725727

726728
- (NSTimeInterval)videoPlayerCurrentTime {
727-
if (self.videoPlayerDelegate) {
729+
if (self.videoPlayerDelegate && [self.videoPlayerDelegate respondsToSelector:@selector(videoPlayerCurrentTime)]) {
728730
return [self.videoPlayerDelegate videoPlayerCurrentTime];
729731
}
730732
return 0;
731733
}
732734

733735
- (VPUPVideoPlayerSize *)videoPlayerSize {
734-
if (self.videoPlayerDelegate) {
736+
if (self.videoPlayerDelegate && [self.videoPlayerDelegate respondsToSelector:@selector(videoPlayerSize)]) {
735737
VPIVideoPlayerSize *vpiSize = [self.videoPlayerDelegate videoPlayerSize];
736738
VPUPVideoPlayerSize *vpupSize = [[VPUPVideoPlayerSize alloc] init];
737739
vpupSize.portraitFullScreenWidth = vpiSize.portraitFullScreenWidth;
@@ -752,7 +754,7 @@ - (VPUPVideoPlayerSize *)videoPlayerSize {
752754
}
753755

754756
- (CGRect)videoFrame {
755-
if (self.videoPlayerDelegate) {
757+
if (self.videoPlayerDelegate && [self.videoPlayerDelegate respondsToSelector:@selector(videoFrame)]) {
756758
return [self.videoPlayerDelegate videoFrame];
757759
}
758760
return self.view.frame;

VideoPlsInterfaceControllerSDK/VideoPlsInterfaceControllerSDK/VideoPlsInterfaceControllerSDK/VPInterfaceControllerConfig.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,25 @@ typedef NS_ENUM(NSInteger, VPInterfaceControllerType) {
3939
//注意identifier,episode,title不能为空
4040
@property (nonatomic, copy) NSString *identifier; //视频或房间ID
4141

42-
@property (nonatomic, copy) NSString *episode; //剧集名称
42+
@property (nonatomic, copy) NSString *episode; //剧集名称,例如:邪恶力量第九季
4343

44-
@property (nonatomic, copy) NSString *title; //视频标题
44+
@property (nonatomic, copy) NSString *title; //视频标题,例如:邪恶力量 第九季 第五集
4545

4646
@property (nonatomic, copy) NSString *platformID; //平台ID
4747
//默认为VPInterfaceControllerTypeDefault, 不需要传入
4848
@property (nonatomic, assign) VPInterfaceControllerType types;
4949

50-
@property (nonatomic, copy) NSString *category; //分区
51-
52-
/** 现有参数不能满足需求时,使用拓展字段
53-
* 点播有title字段(初次播放时生成的标题文字), value为NSString
54-
* 直播有category字段(分区投放), value为NSString
55-
* 直播或互娱有userType(是否为主播), value为NSNumber(VPIUserType)
50+
/** 分层投放的参数通过extendDict字段传递
51+
* 所有参数采用key:array方式传递,key为分层的层级关键字,array里面为层级对应的具体值
52+
* 一些常见的参数,推荐使用下面的命名方式
53+
* 标题title,例如 邪恶力量 第九季 第五集,[dict setObject:@[@"邪恶力量 第九季 第五集"] forKey:@"title"];
54+
* 剧集,例如 邪恶力量第九季,[dict setObject:@[@"邪恶力量第九季"] forKey:@"episode"];
55+
* 剧集Id,例如 628916289,[dict setObject:@[@"628916289"] forKey:@"episodeId"];
56+
* 地区/区域,例如 美剧,[dict setObject:@[@"美剧"] forKey:@"area"];
57+
* 年份,例如 2019,[dict setObject:@[@"2019"] forKey:@"years"];
58+
* 类型,例如 科幻,武侠,[dict setObject:@[@"科幻", @"武侠"] forKey:@"episodeId"];
59+
* 剧集Id,例如 628916289,[dict setObject:@[@"628916289"] forKey:@"episodeId"];
60+
* 其他扩展字段也可以通过extendDict字段传递
5661
*/
5762
@property (nonatomic, copy) NSDictionary *extendDict;
5863

VideoPlsLuaViewManagerSDK/VideoPlsLuaViewManagerSDK/VideoPlsLuaViewManagerSDK/VPLua/Applets/VPLMPView.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,8 @@ - (instancetype)initWithFrame:(CGRect)frame platformId:(NSString *)platformId vi
5555
VPLVideoInfo *videoInfo = [[VPLVideoInfo alloc] init];
5656
videoInfo.platformID = platformId;
5757
videoInfo.nativeID = videoId;
58-
if ([extendInfo objectForKey:@"category"]) {
59-
videoInfo.category = [extendInfo objectForKey:@"category"];
60-
}
6158
if (extendInfo) {
62-
videoInfo.extendJSONString = VPUP_DictionaryToJson(extendInfo);
59+
videoInfo.extendDict = extendInfo;
6360
}
6461
return [self initWithFrame:frame videoInfo:videoInfo];
6562
}

0 commit comments

Comments
 (0)