Skip to content

Commit cbd317b

Browse files
committed
添加openCamera提前预览接口
Change-Id: I67771017a153628b8b9b99aa8191cf948e66ce95
1 parent db99df2 commit cbd317b

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

Source/LinkSDKDemo/Video/P2P/Controller/TIoTDemoPreviewDeviceVC.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,16 @@ - (void)viewDidLoad {
130130

131131
NSString *productId = [TIoTCoreAppEnvironment shareEnvironment].cloudProductId?:@"";
132132
NSString *deviceName= self.deviceName?:@"";
133-
[self callDevice:productId devicename:deviceName];
133+
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
134+
[self callDevice:productId devicename:deviceName];
135+
// });
134136

135137
UIBarButtonItem *right = [[UIBarButtonItem alloc] initWithTitle:@"静音" style:UIBarButtonItemStylePlain target:self action:@selector(showHudView:)];
136138
self.navigationItem.rightBarButtonItem = right;
137139

138140
//设置代理,接受设备消息
139141
[TIoTCoreXP2PBridge sharedInstance].delegate = self;
142+
// [[TIoTCoreXP2PBridge sharedInstance] openCamera:AVCaptureDevicePositionFront view:self.imageView];
140143
}
141144

142145
- (void)requestDiffDeviceDataWithXp2pInfo:(TRTCParams *)xp2pInfo {

Source/SDK/LinkVideo/TIoTCoreXP2PBridge.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ extern NSNotificationName const TIoTCoreXP2PBridgeNotificationStreamEnd;
160160
*/
161161
+ (int)getStreamLinkMode:(NSString *)dev_name;
162162

163+
/*
164+
* 打开本地预览
165+
*/
166+
- (void)openCamera:(AVCaptureDevicePosition)videoPosition view:(UIView *)previewView;
163167
@end
164168

165169
NS_ASSUME_NONNULL_END

Source/SDK/LinkVideo/TIoTCoreXP2PBridge.mm

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ - (XP2PErrCode)startAppWith:(NSString *)pro_id dev_name:(NSString *)dev_name {
237237

238238
[TRTCCloud sharedInstance].delegate = self;
239239
[[TRTCCloud sharedInstance] enterRoom:self.params appScene:TRTCAppSceneVideoCall];
240+
241+
[[TRTCCloud sharedInstance] muteLocalVideo:TRTCVideoStreamTypeBig mute:YES];
240242
return XP2P_ERR_NONE;
241243

242244

@@ -371,7 +373,10 @@ - (void)sendVoiceToServer:(NSString *)dev_name channel:(NSString *)channel_numbe
371373
// fileHandle = [NSFileHandle fileHandleForWritingAtPath:audioFile];
372374
self.audioConfig = audio_config;
373375
self.videoConfig = video_config;
376+
[[TRTCCloud sharedInstance] muteLocalVideo:TRTCVideoStreamTypeBig mute:NO];
377+
[[TRTCCloud sharedInstance] stopLocalPreview];
374378
[[TRTCCloud sharedInstance] startLocalPreview:(video_config.videoPosition == AVCaptureDevicePositionFront)?YES:NO view:video_config.localView];
379+
375380
[[TRTCCloud sharedInstance] startLocalAudio:TRTCAudioQualitySpeech];
376381
return;
377382

@@ -529,8 +534,9 @@ + (int)getStreamLinkMode:(NSString *)dev_name {
529534
}
530535

531536

532-
533-
537+
- (void)openCamera:(AVCaptureDevicePosition)videoPosition view:(UIView *)previewView {
538+
[[TRTCCloud sharedInstance] startLocalPreview:(videoPosition == AVCaptureDevicePositionFront)?YES:NO view:previewView];
539+
}
534540

535541
#pragma mark -TRTCCloudDelegate
536542
- (void)onEnterRoom:(NSInteger)result {

0 commit comments

Comments
 (0)