lemon97213
(Shing Fung Lo)
November 3, 2021, 8:04am
1
Continuing the discussion from Can't use the appShareWithView :
Since the post had been locked. I create a new one.
I double-check the SDK reference (https://marketplace.zoom.us/docs/sdk/native-sdks/iOS/mastering-zoom-sdk/in-meeting-function/screen-share )
I found that there are to type of sharing.
Screen Broadcast with ReplayKit.
share Single UIView
What I want to do should be the second one. As a result, I didn’t add the screenShare framework to my Xcode project. Is it the reason why I called the method but have nothing happened?
And I found that if need to use the appShareWithView, it needs the enable the Custom Meeting UI, is that need if we are using [ms meetingView], this function will not be able to use?
For your information, actually, I want to do the function is like the Zoom app, just share a picture with the participants.
photos
and
share the photo
Thank you so much.
Hey @lemon97213 ,
Thanks for using the dev forum!
Yes you can use this in default UI actually. Try this code before calling appShareWithView:
MobileRTCMeetingService *ms = [[MobileRTC sharedRTC] getMeetingService];
if (ms) {
if (ms.isStartingShare) {
[ms stopAppShare];
} else {
[ms startAppShare];
}
}
Thanks!
Michael
lemon97213
(Shing Fung Lo)
November 5, 2021, 2:10am
3
So I don’t need the “Replaykit” ?
Hey @lemon97213 ,
Does this happen with other UIViews besides the meetingView?
Thanks!
Michael
lemon97213
(Shing Fung Lo)
November 10, 2021, 3:31am
6
@Michael_Condon
Sorry, I am not very understanding. i tried to add this in different function, it is still don’t work. And The app now only have one view which is the meetingview while the meeting started.
Hey @lemon97213 ,
Can you try this code:
//
// ViewController.m
// AppShareWithViewExample
//
// Created by Michael Condon on 9/22/21.
//
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic) UIView* localView;
@property (nonatomic) UIView* remoteView;
@property (nonatomic) UIView* shareView;
@property (nonatomic) UILabel* waitingRoomLabel;
@property (nonatomic) UIButton* joinMeetingButton;
@property (nonatomic) UIButton* startAppShareButton;
@end
@implementation ViewController
NSString* appGroupId = @"";
NSString* JWT = @"";
NSString* meetingNumber = @"";
NSString* meetingPassword = @"";
- (void)loadView {
[super loadView];
[self initializeSDK];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self setupViews];
}
- (void)initializeSDK {
MobileRTCSDKInitContext *initContext = [[MobileRTCSDKInitContext alloc] init];
initContext.appGroupId = appGroupId;
initContext.domain = @"https://zoom.us";
if ([[MobileRTC sharedRTC] initialize:initContext] == YES) {
MobileRTCAuthService* authService = [[MobileRTC sharedRTC] getAuthService];
if (!authService) {
return;
}
authService.jwtToken = JWT;
authService.delegate = self;
[authService sdkAuth];
}
}
- (void)setupViews {
CGFloat screenCenterX = self.view.center.x - 50;
UIView *localView = [[UIView alloc] initWithFrame:CGRectMake(screenCenterX, 0, 100, 100)];
localView.backgroundColor = [UIColor redColor];
[[self view] addSubview:localView];
self.localView = localView;
UIView *remoteView = [[UIView alloc] initWithFrame:CGRectMake(screenCenterX, 100, 100, 100)];
remoteView.backgroundColor = [UIColor blueColor];
[[self view] addSubview:remoteView];
self.remoteView = remoteView;
UIView *shareView = [[UIView alloc] initWithFrame:CGRectMake(screenCenterX, 200, 100, 100)];
shareView.backgroundColor = [UIColor greenColor];
[[self view] addSubview:shareView];
self.shareView = shareView;
UIButton *joinMeetingButton = [UIButton buttonWithType:UIButtonTypeSystem];
[joinMeetingButton addTarget:self
action:@selector(joinMeeting:)
forControlEvents:UIControlEventTouchUpInside];
[joinMeetingButton setTitle:@"Join Meeting" forState:UIControlStateNormal];
joinMeetingButton.frame = CGRectMake(screenCenterX, 300, 100, 50);
[[self view] addSubview:joinMeetingButton];
self.joinMeetingButton = joinMeetingButton;
UILabel *waitingRoomLabel = [[UILabel alloc] initWithFrame:CGRectMake(screenCenterX, 350, 300, 100)];
waitingRoomLabel.text = @"Not yet in meeting.";
[[self view] addSubview:waitingRoomLabel];
self.waitingRoomLabel = waitingRoomLabel;
UIButton *startAppShareButton = [UIButton buttonWithType:UIButtonTypeSystem];
[startAppShareButton addTarget:self
action:@selector(startAppShare:)
forControlEvents:UIControlEventTouchUpInside];
[startAppShareButton setTitle:@"Start app share" forState:UIControlStateNormal];
startAppShareButton.frame = CGRectMake(screenCenterX, 400, 100, 50);
[[self view] addSubview:startAppShareButton];
self.startAppShareButton = startAppShareButton;
}
- (void)joinMeeting:(UIButton*)sender {
MobileRTCMeetingService *meetService = [[MobileRTC sharedRTC] getMeetingService];
MobileRTCMeetingSettings *meetSettings = [[MobileRTC sharedRTC] getMeetingSettings];
if (!meetService) {
return;
}
if (!meetSettings) {
return;
}
meetService.delegate = self;
meetService.customizedUImeetingDelegate = self;
MobileRTCMeetingJoinParam *joinParams = [[MobileRTCMeetingJoinParam alloc] init];
joinParams.meetingNumber = meetingNumber;
joinParams.password = meetingPassword;
joinParams.userName = @"ios sdk";
meetSettings.enableCustomMeeting = YES;
MobileRTCMeetError joinMeetingReturnValue = [meetService joinMeetingWithJoinParam:joinParams];
if (joinMeetingReturnValue == MobileRTCMeetError_Success) {
NSLog(@"Joining meeting");
} else {
NSLog(@"Failed to join meeting");
}
}
- (void)showAttendeeVideos {
MobileRTCVideoView *localVideoView = [[MobileRTCVideoView alloc] initWithFrame:self.localView.bounds];
[localVideoView setVideoAspect:MobileRTCVideoAspect_PanAndScan];
[self.localView addSubview:localVideoView];
NSUInteger myUserID = [[[MobileRTC sharedRTC] getMeetingService] myselfUserID];
[localVideoView showAttendeeVideoWithUserID:myUserID];
NSArray *inMeetingParticipants = [[[MobileRTC sharedRTC] getMeetingService] getInMeetingUserList];
NSUInteger otherUserID = 0;
for (NSNumber *currentUserID in inMeetingParticipants) {
if ([currentUserID unsignedIntegerValue] != myUserID) {
otherUserID = [currentUserID unsignedIntegerValue];
break;
}
}
if (otherUserID == 0) {
return;
}
MobileRTCVideoView *remoteVideoView = [[MobileRTCVideoView alloc] initWithFrame:self.remoteView.bounds];
[remoteVideoView setVideoAspect:MobileRTCVideoAspect_PanAndScan];
[self.remoteView addSubview:remoteVideoView];
[remoteVideoView showAttendeeVideoWithUserID:otherUserID];
}
- (void)startAppShare:(UIButton*)sender {
MobileRTCMeetingService *meetService = [[MobileRTC sharedRTC] getMeetingService];
if (!meetService) {
return;
}
if (meetService.isStartingShare) {
[meetService stopAppShare];
} else {
[meetService startAppShare];
ViewController* __weak weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
ViewController* strongSelf = weakSelf;
if (strongSelf) {
[meetService appShareWithView:strongSelf.shareView];
}
});
}
}
// #pragma mark - MobileRTCAuthDelegate
- (void)onMobileRTCAuthReturn:(MobileRTCAuthError)returnValue {
switch (returnValue) {
case MobileRTCAuthError_Success:
NSLog(@"SDK Authed");
break;
default:
NSLog(@"Could not auth SDK.");
break;
}
}
// #pragma mark - MobileRTCMeetingServiceDelegate
- (void)onMeetingError:(MobileRTCMeetError)error message:(NSString *)message {
switch (error) {
case MobileRTCMeetError_Success:
break;
default:
NSLog(@"MobileMeetError: %lu", (unsigned long)error);
}
}
- (void)onWaitingRoomStatusChange:(BOOL)needWaiting {
if (needWaiting == YES) {
NSLog(@"In waiting room...");
if (!_waitingRoomLabel) {
return;
}
_waitingRoomLabel.text = @"in waiting room";
} else {
NSLog(@"Left waiting room.");
if (!_waitingRoomLabel) {
return;
}
_waitingRoomLabel.text = @"Left waiting room";
[self showAttendeeVideos];
}
}
- (void)onJoinMeetingConfirmed {
NSLog(@"Joined meeting.");
}
- (void)onJoinMeetingInfo:(MobileRTCJoinMeetingInfo)info completion:(void (^)(NSString * _Nonnull, NSString * _Nonnull, BOOL))completion {
NSLog(@"Invalid meeting credentials");
}
- (void)onJBHWaitingWithCmd:(JBHCmd)cmd {
switch (cmd) {
case JBHCmd_Show:
NSLog(@"Joined before host.");
break;
default:
break;
}
}
- (void)onDestroyMeetingView {
return;
}
- (void)onInitMeetingView {
return;
}
@end
Thanks!
Michael
system
(system)
Closed
December 12, 2021, 9:49am
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.