jgh- / VideoCore-Inactive

*No longer in development* Please see https://github.com/unpause-live/SwiftVideo
MIT License
1.48k stars 540 forks source link

Toggle camera slowing down ui #165

Open markmark1 opened 9 years ago

markmark1 commented 9 years ago

Ui gets slowed down a bit noticeably while the camera is toggled what is the solution to this as uiviews cant be manipulated in the background thread? thanks a lot for an amazing library

JALsnipe commented 9 years ago

Switch the camera asynchronously? I did something like this:

- (IBAction)changeBroadcasterCamera:(id)sender {

    switch (_session.cameraState) {
        case VCCameraStateFront:
        {
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
                _session.cameraState = VCCameraStateBack;
            });
            break;
        }

        case VCCameraStateBack:
        {
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
                _session.cameraState = VCCameraStateFront;
            });
            break;
        }

        default:
            break;
    }
}
markmark1 commented 9 years ago

Thanks a lot josh :) trying it

On Mon, Jul 6, 2015 at 11:59 AM, Josh Lieberman notifications@github.com wrote:

Switch the camera asynchronously? I did something like this:

- (IBAction)changeBroadcasterCamera:(id)sender {

    switch (_session.cameraState) {
        case VCCameraStateFront:
        {
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
                _session.cameraState = VCCameraStateBack;
            });
            break;
        }

        case VCCameraStateBack:
        {
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
                _session.cameraState = VCCameraStateFront;
            });
            break;
        }

        default:
            break;
    }
}

Reply to this email directly or view it on GitHub: https://github.com/jgh-/VideoCore/issues/165#issuecomment-118959225

markmark1 commented 9 years ago

Josh it becomes very responsive but the view flips to horizontal orientation for a second before going back to portrait looks bad

Is there any alternative to fix that thanks

On Mon, Jul 6, 2015 at 12:09 PM, null write2mark1@gmail.com wrote:

Thanks a lot josh :) trying it On Mon, Jul 6, 2015 at 11:59 AM, Josh Lieberman notifications@github.com wrote:

Switch the camera asynchronously? I did something like this:

- (IBAction)changeBroadcasterCamera:(id)sender {

    switch (_session.cameraState) {
        case VCCameraStateFront:
        {
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
                _session.cameraState = VCCameraStateBack;
            });
            break;
        }

        case VCCameraStateBack:
        {
            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
                _session.cameraState = VCCameraStateFront;
            });
            break;
        }

        default:
            break;
    }
}

Reply to this email directly or view it on GitHub: https://github.com/jgh-/VideoCore/issues/165#issuecomment-118959225

JALsnipe commented 9 years ago

I know of that issue, thought there was an open bug for it. Search around, otherwise feel free to open a new issue. Are you using the latest version of classes in the repo?