2016-06-11 12 views
1

화면 공유를 제공하고 싶습니다. 켜기/끄기 iOS의 기능 을 사용하는 경우 Tokbox.iOS에서 토글 화면 공유 켜기/끄기 Objective C

장치 화면 공유로 전환 할 수 있지만 화면을 공유 한 후 장치를 다시 Camara로 전환 할 수 없습니다.

다음 코드를 사용해 보았습니다.

+0

해. https://github.com/opentok/screensharing-annotation-acc-pack –

답변

1

화면 캡처를 사용 중지 할 때 비디오 캡처기를 설정하지 않았을 수 있습니다. 이 줄은

 _publisher.videoCapture = nil; 

불필요하게 파괴적입니다. 카메라와 화면 포착하는에 내부 참조를 유지하는 시도하고 초기화 그들을 toggleScreen 기능의 외부 :

@implementation MyPublisher { 
    id <OTVideoCapture> _cameraCapture; 
    id <OTVideoCapture> _screenCapture; 
} 

을 그런 식으로 뭔가로 전환 방법을 변경 : 그들은 가속기 팩을

-(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;  
    } 
}