Skip to content

Commit

Permalink
iOS superPlayer 更新到 SDK 9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
xcoderliu committed Nov 4, 2021
1 parent 3d2dee0 commit 457b121
Show file tree
Hide file tree
Showing 92 changed files with 4,634 additions and 80 deletions.
352 changes: 289 additions & 63 deletions Demo/TXLiteAVDemo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions Demo/TXLiteAVDemo/App/AppCommon/Catetory/HUDHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#import "HUDHelper.h"

#import "NSString+Common.h"
#import "TXLiteAVDemo-Swift.h"

@implementation HUDHelper

static HUDHelper *_instance = nil;
Expand Down Expand Up @@ -46,7 +44,7 @@ - (MBProgressHUD *)loading:(NSString *)msg {
}

- (MBProgressHUD *)loading:(NSString *)msg inView:(UIView *)view {
UIView * inView = view ? view : (AppDelegate *)[UIApplication sharedApplication].delegate.window;
UIView * inView = view ? view : [UIApplication sharedApplication].delegate.window;
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:inView];

dispatch_async(dispatch_get_main_queue(), ^{
Expand All @@ -64,7 +62,7 @@ - (MBProgressHUD *)loading:(NSString *)msg inView:(UIView *)view {

- (void)loading:(NSString *)msg delay:(CGFloat)seconds execute:(void (^)())exec completion:(void (^)())completion {
dispatch_async(dispatch_get_main_queue(), ^{
UIView * inView = (AppDelegate *)[UIApplication sharedApplication].delegate.window;
UIView * inView = [UIApplication sharedApplication].delegate.window;
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:inView];
if (![NSString isEmpty:msg]) {
hud.mode = MBProgressHUDModeText;
Expand Down Expand Up @@ -133,7 +131,7 @@ - (void)tipMessage:(NSString *)msg delay:(CGFloat)seconds completion:(void (^)()
}

dispatch_async(dispatch_get_main_queue(), ^{
UIWindow *window = (AppDelegate *)[UIApplication sharedApplication].delegate.window;
UIWindow *window = [UIApplication sharedApplication].delegate.window;
// MBProgressHUD *hud = [[MBProgressHUD alloc] initWithWindow:window];
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:window.rootViewController.view];
[window addSubview:hud];
Expand Down
13 changes: 13 additions & 0 deletions Demo/TXLiteAVDemo/App/AppCommon/CommonUtils/TCUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ static NSString *const kMainMenuDEBUGSwitch = @"kMainMenuDEBUGSwitch";

@end

#pragma mark - UIActivityViewController图片处理
@interface UIImage (TCUtilUIActivity)
/**
* 通过UIActivityViewController分享图片,微信、QQ对系统图像分享都要尺寸要求,需要压缩处理。
* @brief 宽高均 <= 1280,图片尺寸大小保持不变
* 宽或高 > 1280,取较大值等于1280,较小值等比例压缩
* 大小限制: 微信最大10M, QQ最大5M,
* @return 处理后的图片
*/
- (UIImage *)shareActivityImage;

@end

// 频率控制类,如果频率没有超过 nCounts次/nSeconds秒,canTrigger将返回true
@interface TCFrequeControl : NSObject

Expand Down
74 changes: 71 additions & 3 deletions Demo/TXLiteAVDemo/App/AppCommon/CommonUtils/TCUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
* Function: 实用函数
*/

#if !defined(UGC) && !defined(PLAYER)
#import "TXLiteAVDemo-Swift.h"
#endif

#import <Accelerate/Accelerate.h>
#import <mach/mach.h>
Expand Down Expand Up @@ -528,3 +525,74 @@ - (BOOL)canTrigger {
}

@end


#pragma mark - UIActivityViewController图片处理

@implementation UIImage (TCUtilUIActivity)


- (UIImage *)shareActivityImage{
// 原始尺寸
CGSize oldSize = self.size;
CGFloat oldImageWidth = oldSize.width;
CGFloat oldImageHeight = oldSize.height;

UIImage *resultImage = self;
// 1. 图片尺寸处理
// 最大尺寸临界值 1280
CGFloat maxImageValue = 1280;
if (oldImageWidth > maxImageValue || oldImageHeight > maxImageValue) {
if (oldImageWidth > oldImageHeight) {
oldImageHeight = (maxImageValue * oldImageHeight)/oldImageWidth;
oldImageWidth = maxImageValue;
}else{
oldImageWidth = (maxImageValue * oldImageWidth)/oldImageHeight;
oldImageHeight = maxImageValue;
}
resultImage = [TCUtil scaleImage:self scaleToSize:CGSizeMake(oldImageWidth, oldImageHeight)];
}
// 2. 图片大小处理
// QQ: 5M 微信:10M
NSUInteger maxLength = 5 * 1024 * 1024;
resultImage = [self compressImageSize:resultImage toByte:maxLength];
// 3. 返回处理后的结果
return resultImage;
}

/*!
* @brief 使图片压缩后刚好小于指定大小
*
* @param image 当前要压缩的图
* @param maxLength 压缩后的最大尺寸限制
*
* @return 图片对象
*/
- (UIImage *)compressImageSize:(UIImage *)image toByte:(NSUInteger)maxLength{
CGFloat compression = 1;
NSData *data = UIImageJPEGRepresentation(image, compression);
if (!data || ![data isKindOfClass:[NSData class]]) {
return image;
}
if (data.length < maxLength) {
return image;
}
//原图大小超过范围,压缩比采用二分法进行处理
CGFloat max = 1;
CGFloat min = 0;
for (int i = 0; i < 6; ++i) {
compression = (max + min) / 2;
data = UIImageJPEGRepresentation(image, compression);
if (data.length < maxLength * 0.9) {
min = compression;
} else if (data.length > maxLength) {
max = compression;
} else {
break;
}
}
UIImage *resultImage = [UIImage imageWithData:data];
return resultImage;
}

@end
3 changes: 1 addition & 2 deletions Demo/TXLiteAVDemo/App/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@

#if !defined(UGC) && !defined(PLAYER)
#import <ImSDK/ImSDK.h>

#import "TXLiteAVDemo-Swift.h"
#import "LoginViewController.h"
#endif

#if defined(ENTERPRISE) || defined(PROFESSIONAL) || defined(SMART) || defined(TRTC)
Expand Down
4 changes: 2 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.2.1306</string>
<string>9.3.1409</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -36,7 +36,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1306</string>
<string>1409</string>
<key>IMSDKCrashReporterEnable</key>
<false/>
<key>LSRequiresIPhoneOS</key>
Expand Down
34 changes: 30 additions & 4 deletions Demo/TXLiteAVDemo/App/Main/MainViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#ifdef ENABLE_TRTC
#import "TRTCLiveEnterViewController.h"
#import "TRTCSpeedTestViewController.h"
#import "TXLiteAVDemo-Swift.h"
#import "TXLiteAVSDK.h"
#endif

Expand All @@ -56,9 +55,8 @@

#if !defined(UGC) && !defined(PLAYER)
#import <ImSDK/ImSDK.h>

#import "MineViewController.h"
#import "GenerateTestUserSig.h"
#import "TXLiteAVDemo-Swift.h"
#endif

#import "AppLocalized.h"
Expand All @@ -69,7 +67,16 @@
static NSString *const XiaoShiPinAppStoreURLString = @"http://itunes.apple.com/cn/app/id1374099214?mt=8";
static NSString *const trtcAppStoreURLString = @"http://itunes.apple.com/cn/app/id1400663224?mt=8";

@interface MainViewController () <UITableViewDelegate, UITableViewDataSource, UIPickerViewDataSource, UIPickerViewDelegate, UIAlertViewDelegate>
@interface MainViewController () <
UITableViewDelegate,
UITableViewDataSource,
UIPickerViewDataSource,
UIPickerViewDelegate,
#ifdef ENABLE_TRTC
// TRTC 合唱场景使用
TXLiveBaseDelegate,
#endif
UIAlertViewDelegate>
#ifdef ENABLE_UGC
@property(strong, nonatomic) UGCRecordWrapper * ugcRecordWrapper;
@property(strong, nonatomic) UGCVideoUploadWrapper *ugcUploadWrapper;
Expand Down Expand Up @@ -110,6 +117,11 @@ - (void)viewDidLoad {
#endif
[self loadCellInfos];
[self initUI];
#ifdef ENABLE_TRTC
// TRTC 合唱场景使用
[TXLiveBase sharedInstance].delegate = self;
[TXLiveBase updateNetworkTime];
#endif
}

- (void)viewDidAppear:(BOOL)animated {
Expand Down Expand Up @@ -479,4 +491,18 @@ - (void)showTrtcAppStore {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:trtcAppStoreURLString]];
}

#ifdef ENABLE_TRTC
#pragma mark - TXLiveBaseDelegate
// TRTC 合唱场景使用
- (void)onLog:(NSString*)log LogLevel:(int)level WhichModule:(NSString*)module {
NSLog(@"level:%d|module:%@| %@\n", level, module, log);
}

- (void)onUpdateNetworkTime:(int)errCode message:(NSString *)errMsg {
if (errCode != 0) {
[TXLiveBase updateNetworkTime];
}
}
#endif

@end
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,15 @@
"LivePusherDemo.CameraPush.loadingxx" = "Loading xxx %";
"LivePusherDemo.CameraPush.assetsloadsuccess" = "Loaded";
"LivePusherDemo.CameraPush.assetsloadfailed" = "Failed to load resources";
"LivePusherDemo.CameraPush.seimessagesendsuccess" = "Send successfully!";
"LivePusherDemo.CameraPush.seimessagesendfailed" = "Send failed!";
"LivePusherDemo.CameraPush.send" = "Send";
"LivePusherDemo.CameraPush.seipayloadtypeinvalid" = "Invalid SEI payload type! Only 5 or 242 allowed.";
"LivePusherDemo.CameraPush.seidatainvalid" = "SEI data cannot be empty!";

"LivePusherDemo.MoreSetting.screenshots" = "Take";
"LivePusherDemo.MoreSetting.thisoptionisonly" = "This option is only allowed when using the rear camera";
"LivePusherDemo.MoreSetting.captureframe" = "Frame Rate";
"LivePusherDemo.MoreSetting.enableprivacymode" = "Private";
"LivePusherDemo.MoreSetting.turnonmutemode" = "Mute";
"LivePusherDemo.MoreSetting.turnonviewmirror" = "Playback Mirror";
Expand Down Expand Up @@ -203,6 +210,8 @@
"LivePusherDemo.PushSetting.openbandwidthadaptation" = "Bandwidth Adaptation";
"LivePusherDemo.PushSetting.enablehardwareacceleration" = "Hardware Acceleration";
"LivePusherDemo.PushSetting.opentheearsback" = "In-ear Monitor";
"LivePusherDemo.PushSetting.seipayloadtype" = "SEI payloadType: ";
"LivePusherDemo.PushSetting.seidata" = "data: ";
"LivePusherDemo.PushSetting.qualitypreference" = "Video Quality";
"LivePusherDemo.PushSetting.thesoundqualitychoice" = "Sound Quality";
"LivePusherDemo.PushSetting.reverb" = "Reverberation";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,16 @@
"LivePusherDemo.CameraPush.loadingxx" = "正在加载资源xxx %";
"LivePusherDemo.CameraPush.assetsloadsuccess" = "资源加载成功";
"LivePusherDemo.CameraPush.assetsloadfailed" = "资源加载失败";
"LivePusherDemo.CameraPush.seimessagesendsuccess" = "发送成功!";
"LivePusherDemo.CameraPush.seimessagesendfailed" = "发送失败!";
"LivePusherDemo.CameraPush.send" = "发送";
"LivePusherDemo.CameraPush.seipayloadtypeinvalid" = "SEI payloadType 非法!只能是5或者242.";
"LivePusherDemo.CameraPush.seidatainvalid" = "SEI data 不能为空!";

"LivePusherDemo.MoreSetting.screenshots" = "截图";

"LivePusherDemo.MoreSetting.thisoptionisonly" = "该选项只允许在后置摄像头下设置";
"LivePusherDemo.MoreSetting.captureframe" = "采集帧率";
"LivePusherDemo.MoreSetting.enableprivacymode" = "开启隐私模式";
"LivePusherDemo.MoreSetting.turnonmutemode" = "开启静音模式";
"LivePusherDemo.MoreSetting.turnonviewmirror" = "开启观看端镜像";
Expand Down Expand Up @@ -202,6 +210,8 @@
"LivePusherDemo.PushSetting.openbandwidthadaptation" = "开启带宽适应";
"LivePusherDemo.PushSetting.enablehardwareacceleration" = "开启硬件加速";
"LivePusherDemo.PushSetting.opentheearsback" = "开启耳返";
"LivePusherDemo.PushSetting.seipayloadtype" = "SEI payloadType: ";
"LivePusherDemo.PushSetting.seidata" = "data: ";
"LivePusherDemo.PushSetting.qualitypreference" = "画质偏好";
"LivePusherDemo.PushSetting.thesoundqualitychoice" = "音质选择";
"LivePusherDemo.PushSetting.reverb" = "混响";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,17 @@
"Demo.TRTC.Live.picRotation" = "Rotation";
"Demo.TRTC.Live.volumeNum" = "Volume";
"Demo.TRTC.Live.encoderType" = "Encoder Type";
"Demo.TRTC.Live.codecType" = "Choose Encoder";
"Demo.TRTC.Live.codecTypeHard" = "Hardware Encoder";
"Demo.TRTC.Live.codecTypeSoft" = "Software Encoder";

"Demo.TRTC.Live.close" = "Close";
"Demo.TRTC.Live.open" = "Open";
"Demo.TRTC.Live.normal" = "Normal";
"Demo.TRTC.Live.audioScene" = "Audio Scene";
"Demo.TRTC.Live.chorus" = "Chorus";
"Demo.TRTC.Live.inputUrl" = "Please enter the push-pull Stream Address";
"Demo.TRTC.Live.copyUrl" = "Please copy the push-pull Stream Address";
"Demo.TRTC.Live.auto" = "Auto";
"Demo.TRTC.Live.texture" = "Texture";

Expand All @@ -508,6 +514,8 @@
"Demo.TRTC.Live.brightness" = "Brightness";
"Demo.TRTC.Live.voiceCapture" = "Capture Audio";
"Demo.TRTC.Live.earVolume" = "In-ear Monitor Volume";
"Demo.TRTC.Live.voicePitch" = "Voice Pitch";

"Demo.TRTC.Live.handsFree" = "Hands-free";
"Demo.TRTC.Live.audioRecordingType" = "Audio to Record";
"Demo.TRTC.Live.default" = "default";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,11 @@
"Demo.TRTC.Live.volumeNum" = "音量大小";

"Demo.TRTC.Live.encoderType" = "编码类型";
"Demo.TRTC.Live.codecType" = "软硬编码设置";
"Demo.TRTC.Live.codecTypeHard" = "硬件编码";
"Demo.TRTC.Live.codecTypeSoft" = "软件编码";


"Demo.TRTC.Live.close" = "关闭";
"Demo.TRTC.Live.open" = "开启";
"Demo.TRTC.Live.normal" = "正常";
Expand All @@ -534,6 +539,8 @@
"Demo.TRTC.Live.audioReceive" = "音频接收";
"Demo.TRTC.Live.videoReceive" = "视频接收";
"Demo.TRTC.Live.notChoose" = "不选";
"Demo.TRTC.Live.inputUrl" = "请输入推拉流地址";
"Demo.TRTC.Live.copyUrl" = "请拷贝推拉流地址";
//

"Demo.TRTC.Live.collectSolution" = "采集分辨率";
Expand All @@ -550,6 +557,8 @@
"Demo.TRTC.Live.brightness" = "画面亮度";
"Demo.TRTC.Live.voiceCapture" = "声音采集";
"Demo.TRTC.Live.earVolume" = "耳返音量";
"Demo.TRTC.Live.voicePitch" = "音调设置";

"Demo.TRTC.Live.handsFree" = "免提模式";
"Demo.TRTC.Live.audioRecordingType" = "音频录制类型";
"Demo.TRTC.Live.default" = "默认";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
"V2.Live.LinkMicNew.setpayloadtype" = "PayloadType";
"V2.Live.LinkMicNew.setting" = "Set";
"V2.Live.LinkMicNew.enableSEI" = "Enable SEI Message";
"V2.Live.LinkMicNew.seipayloadtype" = "SEI payloadType: ";
"V2.Live.LinkMicNew.seipayloadtypeinvalid" = "Invalid SEI payload type! Only 5 or 242 allowed.";

"V2.Live.LinkMicNew.startvirtualcamera" = "Enable Push Image";
"V2.Live.LinkMicNew.openwatermark" = "Enable Watermarking";
Expand Down Expand Up @@ -108,6 +110,8 @@
"V2.Live.LinkMicNew.verificationcodesent" = "Sent";
"V2.Live.LinkMicNew.getverificationcode" = "Get";
"V2.Live.LinkMicNew.loginsuccess" = "Logged in";
"V2.Live.LinkMicNew.loginfail" = "Login fail";

"V2.Live.LinkMicNew.termsandconditions" = "Terms and Conditions";
"V2.Live.LinkMicNew.agree" = "Agree";
"V2.Live.LinkMicNew.disagree" = "Disagree";
Expand All @@ -118,6 +122,9 @@
"V2.Live.LoginMock.regist" = "Register";
"V2.Live.LoginMock.adduserinformationforfirstlogin" = "This is your first login. Please complete your profile.";
"V2.Live.LoginMock.enterusername" = "Enter a username";
"V2.Live.LoginMock.username" = "Username";
"V2.Live.LoginMock.warnTip" = "Limited to Chinese, numbers, letters or underscores, 2-20 characters";

"V2.Live.LoginMock.registsuccess" = "Registration successful";
"V2.Live.LoginMock.mobilenumber" = "Mobile Number";
"V2.Live.LoginMock.verificationcode" = "Verification Code";
Expand Down Expand Up @@ -203,6 +210,7 @@
"MLVB.MainMenu.Player" = "Player";
"MLVB.MainMenu.SuperPlayer" = "Super Player";
"MLVB.MainMenu.VodPlayer" = "On-demand player";
"MLVB.MainMenu.shortVideoPlay" = "short Video Play";

"MLVB.MainMenu.Scene" = "Scene";
"MLVB.MainMenu.LVBLite" = "LVB Lite";
Expand Down
Loading

0 comments on commit 457b121

Please sign in to comment.