Tokbox Screen Sharing On/Off Toggle in iOS Objective C -


i want provide screen sharing on/off feature in ios using tokbox.

i able switch device screen share after sharing screen not able switch device camara.

i have tried following code.

-(void)tooglescreen{     if (issharingenable == yes) {         issharingenable = no;         nslog(@"%@",_publisher.description);          _publisher.videocapture = nil;         [_publisher setvideotype:otpublisherkitvideotypecamera];        _publisher.audiofallbackenabled = yes;     } else {         issharingenable = yes;           [_publisher setvideotype:otpublisherkitvideotypescreen];         _publisher.audiofallbackenabled = no;           tbscreencapture* videocapture =         [[tbscreencapture alloc] initwithview:self.view];         [_publisher setvideocapture:videocapture];     } } 

it looks might not setting video capturer when turning off screencapture. line:

        _publisher.videocapture = nil; 

is needlessly destructive. try keeping internal references camera , screen capturers, , initialize them outside of togglescreen function:

@implementation mypublisher {   id <otvideocapture> _cameracapture;   id <otvideocapture> _screencapture; } 

then, change toggle method like:

-(void)tooglescreen{     if (issharingenable == yes) {         issharingenable = no;         [_publisher setvideocapture:_cameracapture];         [_publisher setvideotype:otpublisherkitvideotypecamera];        _publisher.audiofallbackenabled = yes;     } else {         issharingenable = yes;         [_publisher setvideocapture:_screencapture];         [_publisher setvideotype:otpublisherkitvideotypescreen];         _publisher.audiofallbackenabled = no;         } } 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -