rFlex / SCRecorder

iOS camera engine with Vine-like tap to record, animatable filters, slow motion, segments editing
Apache License 2.0
3.06k stars 582 forks source link

No video capturing at all - only Audio - Gives blank screen #229

Open hbmtw opened 9 years ago

hbmtw commented 9 years ago

For some reason, SCRecorder is not capturing any video at all. Only audio. I am using Xcode 7.1 with iOS 9.1 on an iPhone 6. When I open the session in SCVideoPlayerViewController, I get a white blank screen with captured audio only. I am using default configuration, and ending the recording with the following:

recorder.pause { () -> Void in     
 let videoPlayer = SCVideoPlayerViewController()
    videoPlayer.recordSession = recorder.session
    self.presentViewController(videoPlayer, animated: true) { () -> Void in
    }
}

Anybody experience this?

Thanks for the module! Great work :)

rFlex commented 9 years ago

Is the example working on your device?

LiweiDong commented 8 years ago

try to set _recorder.fastRecordMethodEnabled = false

f2m2rd commented 8 years ago

This seems to happen when a filter property is set on the SCVideoConfiguration of the SCRecorder instance.

Here is some example code in Swift:


func recordTest(){
    let recorder = SCRecorder.sharedRecorder()

    // Add Filter
    let filter = SCFilter(CIFilterName: "CIPhotoEffectInstant")
    recorder.videoConfiguration.filter = filter // Addding a filter renders the video black

    // Start
    recorder.startRunning()

    // Record Session
    let recordSession = SCRecordSession()
    recordSession.fileType = AVFileTypeQuickTimeMovie
    recorder.session = recordSession

    recorder.record()

    // record for 5 seconds
    delay(5){
        recorder.pause { () -> Void in
            recordSession.mergeSegmentsUsingPreset(AVAssetExportPresetHighestQuality, completionHandler: { (url, error) -> Void in
                if url != nil {
                    // Save
                    url!.saveToCameraRollWithCompletion({ (saved, error) -> Void in
                        print(saved)
                    })
                }
            })
        }
    }   
}

// delay
func delay(delay: Double, closure: Void -> Void) {
    dispatch_after(
        dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC))),
        dispatch_get_main_queue(),
        closure
    )
}