Skip to content

Commit

Permalink
iOS superPlayer 更新到 SDK 9.4
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiruiou committed Dec 7, 2021
1 parent 457b121 commit 2664f4b
Show file tree
Hide file tree
Showing 119 changed files with 4,096 additions and 409 deletions.
238 changes: 210 additions & 28 deletions Demo/TXLiteAVDemo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions Demo/TXLiteAVDemo/App/AppCommon/CommonUtils/TCUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@

#import "TCLog.h"

#ifndef weakify
#if __has_feature(objc_arc)
#define weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object;
#else
#define weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object;
#endif
#endif


#ifndef strongify
#if __has_feature(objc_arc)
#define strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object;
#else
#define strongify(object) try{} @finally{} __typeof__(object) object = block##_##object;
#endif
#endif

#define IPHONE_X \
({ \
BOOL isPhoneX = NO; \
Expand All @@ -21,6 +38,7 @@ typedef void (^videoIsReadyBlock)(void);
#define DEBUGSwitch [TCUtil getDEBUGSwitch]

static NSString *const kMainMenuDEBUGSwitch = @"kMainMenuDEBUGSwitch";
static NSString *const kIsFirstStart = @"kIsFirstStart";

@interface TCUtil : NSObject

Expand Down
13 changes: 13 additions & 0 deletions Demo/TXLiteAVDemo/App/AppCommon/SmallButton/SmallButton.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// SmallButton.h
//
// Created by stcui on 15/7/14.
// Copyright © 2015年 Tencent. All rights reserved.
//

#import <UIKit/UIKit.h>

// extend hitTest area when rect width is smaller than 44px
@interface SmallButton : UIButton

@end
28 changes: 28 additions & 0 deletions Demo/TXLiteAVDemo/App/AppCommon/SmallButton/SmallButton.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// SmallButton.m
//
// Created by stcui on 15/7/14.
// Copyright © 2015年 Tencent. All rights reserved.
//

#import "SmallButton.h"

@implementation SmallButton

- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
if (!self.enabled || self.hidden) return [super pointInside:point withEvent:event];
CGRect area = self.frame;
area.origin = CGPointZero;
if (CGRectGetWidth(area) < 44) {
area.origin.x = CGRectGetMidX(area) - 22;
area.size.width = 44;
}
if (CGRectGetHeight(area) < 44) {
area.origin.y = CGRectGetMidY(area) - 22;
area.size.height = 44;
}

return CGRectContainsPoint(area, point);
}

@end
32 changes: 32 additions & 0 deletions Demo/TXLiteAVDemo/App/AppCommon/TCHttpUtil/TCHttpUtil.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// TCHttpUtil.h
// TXLiteAVDemo
//
// Created by rushanting on 2017/11/10.
// Copyright © 2017年 Tencent. All rights reserved.
//

#define kHttpTimeout 30

#define kHttpServerAddr @"https://lvb.qcloud.com/weapp/utils"
#define kHttpUGCServerAddr @"http://demo.vod2.myqcloud.com/shortvideo" //@"http://119.29.189.135:8000"
#define UGCAppid @"1256468886"
#define UGCAppKey @"1973fcc2b70445af8b51053d4f9022bb"

//错误码
#define kError_InvalidParam -10001
#define kError_ConvertJsonFailed -10002
#define kError_HttpError -10003

#import <Foundation/Foundation.h>

@interface TCHttpUtil : NSObject

+ (NSData *)dictionary2JsonData:(NSDictionary *)dict;
+ (NSDictionary *)jsonData2Dictionary:(NSString *)jsonData;
+ (void)asyncSendHttpRequest:(NSString*)request
httpServerAddr:(NSString *)httpServerAddr
HTTPMethod:(NSString *)HTTPMethod
param:(NSDictionary *)param
handler:(void (^)(int result, NSDictionary* resultDict))handler;
@end
114 changes: 114 additions & 0 deletions Demo/TXLiteAVDemo/App/AppCommon/TCHttpUtil/TCHttpUtil.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
//
// TCHttpUtil.m
// TXLiteAVDemo
//
// Created by rushanting on 2017/11/10.
// Copyright © 2017年 Tencent. All rights reserved.
//

#import "TCHttpUtil.h"
#import "NSString+Common.h"

@implementation TCHttpUtil

+ (NSData *)dictionary2JsonData:(NSDictionary *)dict
{
// 转成Json数据
if ([NSJSONSerialization isValidJSONObject:dict])
{
NSError *error = nil;
NSData *data = [NSJSONSerialization dataWithJSONObject:dict options:0 error:&error];
if(error)
{
NSLog(@"[%@] Post Json Error", [self class]);
}
return data;
}
else
{
NSLog(@"[%@] Post Json is not valid", [self class]);
}
return nil;
}

+ (NSDictionary *)jsonData2Dictionary:(NSString *)jsonData
{
if (jsonData == nil) {
return nil;
}
NSData *data = [jsonData dataUsingEncoding:NSUTF8StringEncoding];
NSError *err = nil;
NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&err];
if (err) {
NSLog(@"Json parse failed: %@", jsonData);
return nil;
}
return dic;
}

+ (void)asyncSendHttpRequest:(NSString*)request
httpServerAddr:(NSString *)httpServerAddr
HTTPMethod:(NSString *)HTTPMethod
param:(NSDictionary *)param
handler:(void (^)(int result, NSDictionary* resultDict))handler
{
dispatch_async(dispatch_get_global_queue(0, 0), ^{
NSString* strUrl = @"";
if ([httpServerAddr isEqualToString:kHttpUGCServerAddr]) {
NSDate* date = [NSDate dateWithTimeIntervalSinceNow:0];
UInt64 timestamp= (UInt64)[date timeIntervalSince1970];
UInt64 msTimestamp = (UInt64)([date timeIntervalSince1970] * 1000);
NSString *nonce = [[NSString stringWithFormat:@"%llu",msTimestamp] md5];
NSString *sig = [[NSString stringWithFormat:@"%@%llu%@%@",UGCAppid,timestamp,nonce,UGCAppKey] md5];
strUrl = [NSString stringWithFormat:@"%@/%@?timestamp=%llu&nonce=%@&sig=%@&appid=%@", httpServerAddr, request,timestamp,nonce,sig,UGCAppid];
}else{
strUrl = [NSString stringWithFormat:@"%@/%@", httpServerAddr, request];
}

if ([param allKeys].count > 0 && [HTTPMethod isEqual:@"GET"]) {
NSMutableString *getUrl = [[NSMutableString alloc] initWithString:strUrl];
if (![getUrl containsString:@"?"]) {
[getUrl appendString:@"?"];
}
for (NSString* key in param.allKeys) {
if (![[getUrl substringFromIndex:[getUrl length] - 1] isEqualToString:@"?"]) {
[getUrl appendString:@"&"];
}
[getUrl appendString:[NSString stringWithFormat:@"%@=%@",key,param[key]]];
}
strUrl = [NSString stringWithString:getUrl];
}

NSURL *URL = [NSURL URLWithString:strUrl];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL];

[request setHTTPMethod:HTTPMethod];
[request setValue:@"application/json; charset=UTF-8" forHTTPHeaderField:@"Content-Type"];
[request setTimeoutInterval:kHttpTimeout];
for (NSString *key in param.allKeys) {
[request setValue:param[key] forHTTPHeaderField:key];
}

NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error != nil)
{
NSLog(@"internalSendRequest failed,NSURLSessionDataTask return error code:%ld, des:%@", [error code], [error description]);
dispatch_async(dispatch_get_main_queue(), ^{
handler(kError_HttpError, nil);
});
}
else
{
NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSDictionary* resultDict = [TCHttpUtil jsonData2Dictionary:responseString];
dispatch_async(dispatch_get_main_queue(), ^{
handler(0, resultDict);
});
}
}];

[task resume];
});
}

@end
37 changes: 31 additions & 6 deletions Demo/TXLiteAVDemo/App/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#if !defined(UGC) && !defined(PLAYER)
#import <ImSDK/ImSDK.h>
#import "LoginViewController.h"
#import "LoginMockViewController.h"
#endif

#if defined(ENTERPRISE) || defined(PROFESSIONAL) || defined(SMART) || defined(TRTC)
Expand All @@ -53,6 +54,11 @@
#import "TXLaunchMoviePlayProtocol.h"
#endif

#if defined(ENTERPRISE)
#import "DevOpsCheckManager.h"
#import "ProfileManager.h"
#endif

NSString *helpUrlDb[] = {
[Help_MLVBLiveRoom] = @"https://cloud.tencent.com/document/product/454/14606",
[Help_录屏直播] = @"https://cloud.tencent.com/document/product/454/7883",
Expand Down Expand Up @@ -117,6 +123,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[[TXConfigManager shareInstance] loadConfig];
[[TXConfigManager shareInstance] setLicence];
[[TXConfigManager shareInstance] setLogConfig];
[[TXConfigManager shareInstance] initDebug];
[[TXConfigManager shareInstance] setupBugly];
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
Expand Down Expand Up @@ -314,19 +321,38 @@ - (void)registNotificaiton {
#pragma mark - 登录跳转方法
- (void)showPortalConroller {
UINavigationController *nav = nil;
NSString * appStoreID = @"1152295397";
nav = [[UINavigationController alloc] initWithRootViewController:self.mainViewController];
self.window.rootViewController = nav;
[self playVideoFromLaunchInfo:self.launchInfo];

// 检测是否需要更新
[self checkAppUpdateVersion];
}

#if !defined(ENABLE_INTERNATIONAL)
[self checkStoreVersion:appStoreID];
/// @brief 检测版本更新
/// @note 检查蓝盾版本更新 - 需在对应的config.plist文件配置needCheckDevOpsVersion 默认为NO 不触发
- (void)checkAppUpdateVersion {
#if defined(ENTERPRISE)
if ([[TXConfigManager shareInstance] isRelease]) {
// 检查商店版本更新
NSString *appStoreID = @"1152295397";
[self checkStoreVersion:appStoreID];
} else if ([[TXConfigManager shareInstance] needCheckDevOpsVersion]) {
// 工具包 - 开启检查蓝盾构建新版本
NSString *userId = [[ProfileManager shared] curUserID];
[DevOpsCheckManager checkUpdateWithUserId:userId];
}
#endif
}

- (void)showLoginController {
#ifndef NOT_LOGIN
LoginViewController *vc = [[LoginViewController alloc] init];
LoginViewController *vc;
if ([TXConfigManager shareInstance].isRelease) {
vc = [[LoginViewController alloc] init];
} else {
vc = [[LoginMockViewController alloc] init];
}
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:vc];
#endif
}
Expand Down Expand Up @@ -372,8 +398,7 @@ - (void)checkStoreVersion:(NSString *)appID {
}

- (BOOL)compareVersion:(NSString *)appStoreVersion {
NSDictionary *infoDic = [[NSBundle mainBundle] infoDictionary];
NSString * currentVersion = [infoDic objectForKey:@"CFBundleShortVersionString"];
NSString * currentVersion = [TXAppInfo appVersion];
NSLog(@"====== current version is %@ ======", currentVersion);
return [appStoreVersion compare:currentVersion options:NSNumericSearch] == NSOrderedDescending;
}
Expand Down
8 changes: 6 additions & 2 deletions Demo/TXLiteAVDemo/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>9.3.1409</string>
<string>9.4.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -36,9 +36,13 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1409</string>
<string>1376</string>
<key>IMSDKCrashReporterEnable</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>bkdevopsapp</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand Down
2 changes: 1 addition & 1 deletion Demo/TXLiteAVDemo/App/Main/MainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ - (void)initUI {

//副标题
UILabel * lbSubHead = [[UILabel alloc] initWithFrame:CGRectMake(originX, lbHeadLine.frame.origin.y + lbHeadLine.frame.size.height + 15, width, 30)];
NSString *version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
NSString *version = [TXAppInfo appVersionWithBuild];
#ifdef LIVE
NSString *sdkVersion = [V2TXLivePremier getSDKVersionStr];
#else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@
"images" : [
{
"idiom" : "universal",
"filename" : "bgm_pause.png",
"scale" : "1x"
},
{
"filename" : "bgm_pause.png",
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Binary file not shown.
Loading

0 comments on commit 2664f4b

Please sign in to comment.