-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dokieyang
committed
Dec 26, 2022
1 parent
23bde03
commit 5c04ca2
Showing
212 changed files
with
8,347 additions
and
0 deletions.
There are no files selected for viewing
1,169 changes: 1,169 additions & 0 deletions
1,169
Player-API-Example-iOS/PlayerApiDemo/PlayerApiDemo.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...le-iOS/PlayerApiDemo/PlayerApiDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...ApiDemo/PlayerApiDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
15 changes: 15 additions & 0 deletions
15
Player-API-Example-iOS/PlayerApiDemo/PlayerApiDemo/AppModule/AppDelegate.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// | ||
// AppDelegate.h | ||
// PlayerApiDemo | ||
// | ||
// Copyright (c) 2022 Tencent. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface AppDelegate : UIResponder <UIApplicationDelegate> | ||
|
||
@property(nonatomic, strong) UIWindow *window; | ||
|
||
@end | ||
|
52 changes: 52 additions & 0 deletions
52
Player-API-Example-iOS/PlayerApiDemo/PlayerApiDemo/AppModule/AppDelegate.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// AppDelegate.m | ||
// PlayerApiDemo | ||
// | ||
// Copyright (c) 2022 Tencent. All rights reserved. | ||
// | ||
|
||
#import "AppDelegate.h" | ||
#import "MainViewController.h" | ||
#import "TXApiConfigManager.h" | ||
#import <TXLiteAVSDK_Player/TXLiveBase.h> | ||
|
||
@interface AppDelegate () | ||
|
||
@property (nonatomic, strong) MainViewController *mainViewController; | ||
|
||
@end | ||
|
||
@implementation AppDelegate | ||
|
||
|
||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
// Override point for customization after application launch. | ||
|
||
[[TXApiConfigManager shareInstance] loadConfig]; | ||
|
||
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | ||
self.window.backgroundColor = [UIColor whiteColor]; | ||
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-1000, 0) forBarMetrics:UIBarMetricsDefault]; | ||
if (@available(iOS 13.0, *)) { | ||
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent; | ||
} | ||
|
||
UINavigationController *navc = [[UINavigationController alloc] initWithRootViewController:self.mainViewController]; | ||
self.window.rootViewController = navc; | ||
|
||
[self.window makeKeyAndVisible]; | ||
|
||
// 设置licence | ||
[TXLiveBase setLicenceURL:@"https://license-test.vod2.myqcloud.com/test/license/testV2/1253968938_1/v_cube.license" key:@"79aa077679db4b0d68643e7af3516719"]; | ||
|
||
return YES; | ||
} | ||
|
||
- (MainViewController *)mainViewController { | ||
if (!_mainViewController) { | ||
_mainViewController = [[MainViewController alloc] init]; | ||
} | ||
return _mainViewController; | ||
} | ||
|
||
@end |
25 changes: 25 additions & 0 deletions
25
Player-API-Example-iOS/PlayerApiDemo/PlayerApiDemo/AppModule/Config/TXApiConfigManager.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// TXApiConfigManager.h | ||
// PlayerApiDemo | ||
// | ||
// Copyright (c) 2022 Tencent. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "TXAppHomeModel.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface TXApiConfigManager : NSObject | ||
|
||
+ (instancetype)shareInstance; | ||
|
||
// 加载配置文件 | ||
- (void)loadConfig; | ||
|
||
//获取菜单配置 | ||
- (NSMutableArray<TXAppHomeModel *> *)getMenuConfig; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
66 changes: 66 additions & 0 deletions
66
Player-API-Example-iOS/PlayerApiDemo/PlayerApiDemo/AppModule/Config/TXApiConfigManager.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// | ||
// TXApiConfigManager.m | ||
// PlayerApiDemo | ||
// | ||
// Copyright (c) 2022 Tencent. All rights reserved. | ||
// | ||
|
||
#import "TXApiConfigManager.h" | ||
#import "TXHomeCellModel.h" | ||
|
||
static TXApiConfigManager *_shareInstance = nil; | ||
|
||
@interface TXApiConfigManager() | ||
|
||
@property (nonatomic, strong) NSDictionary *configDic; | ||
@property(nonatomic, weak) id actionTarget; | ||
|
||
@end | ||
|
||
@implementation TXApiConfigManager | ||
|
||
+ (instancetype)shareInstance { | ||
static dispatch_once_t predicate; | ||
dispatch_once(&predicate, ^{ | ||
_shareInstance = [[TXApiConfigManager alloc] init]; | ||
}); | ||
return _shareInstance; | ||
} | ||
|
||
- (void)loadConfig { | ||
NSString *plistName = @"Player"; | ||
NSString *filePath = [[NSBundle mainBundle] pathForResource:plistName ofType:@"plist"]; | ||
_configDic = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath]; | ||
} | ||
|
||
- (NSMutableArray<TXAppHomeModel *> *)getMenuConfig { | ||
NSMutableArray<TXAppHomeModel *> *cellInfos = [NSMutableArray array]; | ||
NSArray *menusConfig = [self menusConfig]; | ||
for (NSDictionary *menu in menusConfig) { | ||
|
||
TXAppHomeModel *homeModel = [[TXAppHomeModel alloc] init]; | ||
homeModel.type = [menu objectForKey:@"type"]; | ||
|
||
NSArray *subMenus = [menu objectForKey:@"module"]; | ||
NSMutableArray *subCells = [NSMutableArray array]; | ||
for (NSDictionary *subMenu in subMenus) { | ||
TXHomeCellModel *cellModel = [[TXHomeCellModel alloc] init]; | ||
cellModel.title = [subMenu objectForKey:@"title"]; | ||
cellModel.desc = [subMenu objectForKey:@"desc"]; | ||
cellModel.classStr = [subMenu objectForKey:@"class"]; | ||
|
||
[subCells addObject:cellModel]; | ||
} | ||
|
||
homeModel.homeModels = subCells; | ||
[cellInfos addObject:homeModel]; | ||
} | ||
|
||
return cellInfos; | ||
} | ||
|
||
- (NSArray *)menusConfig { | ||
return [_configDic objectForKey:@"menuConfig"]; | ||
} | ||
|
||
@end |
16 changes: 16 additions & 0 deletions
16
Player-API-Example-iOS/PlayerApiDemo/PlayerApiDemo/AppModule/Controller/MainViewController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// MainViewController.h | ||
// PlayerApiDemo | ||
// | ||
// Copyright (c) 2022 Tencent. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface MainViewController : UIViewController | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
127 changes: 127 additions & 0 deletions
127
Player-API-Example-iOS/PlayerApiDemo/PlayerApiDemo/AppModule/Controller/MainViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
// | ||
// MainViewController.m | ||
// PlayerApiDemo | ||
// | ||
// Copyright (c) 2022 Tencent. All rights reserved. | ||
// | ||
|
||
#import "MainViewController.h" | ||
#import "TXHomeTableViewCell.h" | ||
#import "TXHomeCellModel.h" | ||
#import "TXApiConfigManager.h" | ||
#import "TXAppModuleMacro.h" | ||
#import "TXAppLocalized.h" | ||
|
||
@interface MainViewController ()<UITableViewDelegate, UITableViewDataSource> | ||
|
||
@property (nonatomic, strong) UITableView *tableView; | ||
@property (nonatomic, strong) NSMutableArray *homeData; | ||
|
||
@end | ||
|
||
@implementation MainViewController | ||
|
||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
// Do any additional setup after loading the view. | ||
self.view.backgroundColor = TX_RGBA(28,28,30,1); | ||
self.navigationController.interactivePopGestureRecognizer.delegate = (id) self; | ||
|
||
[self loadHomeData]; | ||
|
||
[self setupNaviBarStatus]; | ||
|
||
[self.view addSubview:self.tableView]; | ||
} | ||
|
||
- (void)loadHomeData { | ||
self.homeData = [[TXApiConfigManager shareInstance] getMenuConfig]; | ||
} | ||
|
||
- (void)setupNaviBarStatus { | ||
self.navigationItem.title = Localize(@"PLAYER-API-EXAMPLE.Home.Title"); | ||
[self.navigationController setNavigationBarHidden:false animated:false]; | ||
[self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault]; | ||
[self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]]; | ||
self.navigationController.navigationBar.translucent = YES; | ||
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}]; | ||
} | ||
|
||
#pragma mark - 懒加载 | ||
|
||
- (UITableView *)tableView { | ||
if (!_tableView) { | ||
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, TX_NavBarAndStatusBarHeight, TX_SCREEN_WIDTH, TX_SCREEN_HEIGHT - TX_NavBarAndStatusBarHeight)]; | ||
_tableView.scrollsToTop = NO; | ||
_tableView.backgroundColor = TX_ClearColor; | ||
_tableView.delegate = self; | ||
_tableView.dataSource = self; | ||
_tableView.estimatedRowHeight = 0; | ||
_tableView.showsVerticalScrollIndicator = NO; | ||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | ||
[_tableView registerClass:[TXHomeTableViewCell class] forCellReuseIdentifier:TXHomeTableViewCellReuseIdentify]; | ||
if (@available(iOS 11.0, *)) { | ||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; | ||
} | ||
} | ||
return _tableView; | ||
} | ||
|
||
#pragma mark - UITableViewDataSource | ||
|
||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { | ||
return self.homeData.count; | ||
} | ||
|
||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | ||
TXAppHomeModel *homeModel = self.homeData[section]; | ||
NSArray *homeArray = homeModel.homeModels; | ||
return homeArray.count; | ||
} | ||
|
||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { | ||
UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width, 40)]; | ||
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, headerView.bounds.size.width, 40)]; | ||
titleLabel.textColor = UIColor.whiteColor; | ||
titleLabel.font = [UIFont systemFontOfSize:16]; | ||
TXAppHomeModel *homeModel = self.homeData[section]; | ||
titleLabel.text = Localize(homeModel.type); | ||
[headerView addSubview:titleLabel]; | ||
return headerView; | ||
} | ||
|
||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { | ||
return 40; | ||
} | ||
|
||
#pragma mark - UITableViewDelegate | ||
|
||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | ||
|
||
TXHomeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:TXHomeTableViewCellReuseIdentify forIndexPath:indexPath]; | ||
TXAppHomeModel *homeModel = self.homeData[indexPath.section]; | ||
NSArray *homeArray = homeModel.homeModels; | ||
|
||
[cell setHomeModel:homeArray[indexPath.row]]; | ||
return cell; | ||
} | ||
|
||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | ||
TXAppHomeModel *homeModel = self.homeData[indexPath.section]; | ||
NSArray *homeArray = homeModel.homeModels; | ||
|
||
TXHomeCellModel *homeCellModel = homeArray[indexPath.row]; | ||
[self pushFeaturesViewController:homeCellModel.classStr]; | ||
} | ||
|
||
- (void)pushFeaturesViewController:(NSString *)className { | ||
Class class = NSClassFromString(className); | ||
if (class) { | ||
id controller = [[NSClassFromString(className) alloc] init]; | ||
if (controller) { | ||
[self.navigationController pushViewController:controller animated:true]; | ||
} | ||
} | ||
} | ||
|
||
@end |
16 changes: 16 additions & 0 deletions
16
Player-API-Example-iOS/PlayerApiDemo/PlayerApiDemo/AppModule/Localized/TXAppLocalized.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// TXAppLocalized.h | ||
// PlayerApiDemo | ||
// | ||
// Copyright (c) 2022 Tencent. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
extern NSString *LocalizeFromTable(NSString *key, NSString *table); | ||
extern NSString *const Localize_TableName; | ||
extern NSString *Localize(NSString *key); | ||
|
||
NS_ASSUME_NONNULL_END |
17 changes: 17 additions & 0 deletions
17
Player-API-Example-iOS/PlayerApiDemo/PlayerApiDemo/AppModule/Localized/TXAppLocalized.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// TXAppLocalized.m | ||
// PlayerApiDemo | ||
// | ||
// Copyright (c) 2022 Tencent. All rights reserved. | ||
// | ||
|
||
#import "TXAppLocalized.h" | ||
|
||
NSString *LocalizeFromTable(NSString *key, NSString *table) { | ||
return [NSBundle.mainBundle localizedStringForKey:key value:@"" table:table]; | ||
} | ||
|
||
NSString *const Localize_TableName = @"TXHomeModuleLocalize"; | ||
NSString *Localize(NSString *key) { | ||
return LocalizeFromTable(key, Localize_TableName); | ||
} |
21 changes: 21 additions & 0 deletions
21
...iOS/PlayerApiDemo/PlayerApiDemo/AppModule/Localized/en.lproj/TXHomeModuleLocalize.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
TXHomeModuleLocalize.strings | ||
PlayerApiDemo | ||
|
||
Copyright (c) 2022 Tencent. All rights reserved. | ||
|
||
*/ | ||
|
||
"PLAYER-API-EXAMPLE.Home.Title" = "Player API Example"; | ||
|
||
"PLAYER-API-Example.Home.FunctionsZone" = "Functions Zone"; | ||
"PLAYER-API-Example.Home.BasicPlayer" = "Basic Player"; | ||
"PLAYER-API-Example.Home.PreDownloadAndPreloading" = "PreDownload And Preloading"; | ||
"PLAYER-API-Example.Home.SetSpeciResolution" = "Set specific Resolution"; | ||
"PLAYER-API-Example.Home.SetStartTime" = "Set Start Time"; | ||
"PLAYER-API-Example.Home.VideoDownload" = "Video Download"; | ||
"PLAYER-API-Example.Home.ControlPanel" = "Control Panel"; | ||
|
||
|
||
"PLAYER-API-Example.Home.ScenesZone" = "Scenes Zone"; | ||
"PLAYER-API-Example.Home.ShortVideoPlay" = "Short Video Play"; |
Oops, something went wrong.