{"id":19590346,"url":"https://github.com/shaojiankui/jkscreenrecorder","last_synced_at":"2025-07-08T06:04:54.025Z","repository":{"id":73305577,"uuid":"77579290","full_name":"shaojiankui/JKScreenRecorder","owner":"shaojiankui","description":"JKScreenRecorder(屏幕录制),use RPScreenRecorder of ReplayKit.framework  supports iOS9  and later, use AVAssetWriter of AVFoundation.framework supports iOS8","archived":false,"fork":false,"pushed_at":"2017-02-05T06:17:19.000Z","size":161,"stargazers_count":32,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T00:37:02.971Z","etag":null,"topics":["apprecorder","avfoundation","jkscreenrecorder","replaykit","screenrecord"],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shaojiankui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-29T03:23:04.000Z","updated_at":"2023-05-31T07:50:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"db752234-99b8-4276-a1b8-c96daff92b6f","html_url":"https://github.com/shaojiankui/JKScreenRecorder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaojiankui%2FJKScreenRecorder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaojiankui%2FJKScreenRecorder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaojiankui%2FJKScreenRecorder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaojiankui%2FJKScreenRecorder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shaojiankui","download_url":"https://codeload.github.com/shaojiankui/JKScreenRecorder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251139034,"owners_count":21541978,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apprecorder","avfoundation","jkscreenrecorder","replaykit","screenrecord"],"created_at":"2024-11-11T08:24:28.137Z","updated_at":"2025-04-27T12:33:30.972Z","avatar_url":"https://github.com/shaojiankui.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JKScreenRecorder\nJKScreenRecorder(屏幕录制),use RPScreenRecorder of ReplayKit.framework  supports iOS9  and later, use AVAssetWriter of AVFoundation.framework supports iOS8\n\n应用内屏幕录制功能,iOS9之后使用原生ReplayKit进行录制,iOS8及以后使用截图方式保存视频.\n\n## 使用方法\n\n\n开始录制\n```\n- (IBAction)startTouched:(id)sender {\n    _sreenRecorder = [[JKScreenRecorder alloc]init];\n    //不区分系统版本 直接使用截图合成视频\n    //[_sreenRecorder startRecordingWithCapture];\n    //根据不同版本的系统SDK 使用不同的API 两种开始方法调用一种即可\n    [_sreenRecorder startRecordingWithHandler:^(NSError *error) {\n        \n    }];\n    [_sreenRecorder screenRecording:^(NSTimeInterval duration) {\n        self.timeLabel.text  = [@(duration) stringValue];\n    }];\n}\n\n```\n结束录制\n\n```\n- (IBAction)stopTouched:(id)sender {\n    [_sreenRecorder stopRecordingWithHandler:^(UIViewController *previewViewController, NSString *videoPath, NSError *error) {\n        \n        //videoPath非空为使用低版本截图方式保存视频 previewViewController为MPMoviePlayerViewController的实例\n        if (videoPath) {\n            MPMoviePlayerViewController *p = (MPMoviePlayerViewController*)previewViewController;\n            [p.moviePlayer prepareToPlay];\n            [p.moviePlayer play];\n            [self presentMoviePlayerViewControllerAnimated:p];\n//            存入相册 注意要在info.plist中增加 Privacy - Photo Library Usage Description\n//            ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];\n//            [library writeVideoAtPathToSavedPhotosAlbum:[NSURL fileURLWithPath:videoPath]\n//                                        completionBlock:^(NSURL *assetURL, NSError *error) {\n//                                            if (error) {\n//                                                NSLog(@\"Save video fail:%@\",error);\n//                                            } else {\n//                                                NSLog(@\"Save video succeed.\");\n//                                            }\n//                                        }];\n        }else{\n             //videoPath空为使用ReplayKit.framework方式录制视频 previewViewController为RPPreviewViewController的实例\n            [self presentViewController:previewViewController animated:YES completion:^{\n                \n            }];\n        }\n            \n    }];\n}\n```\n\n## 效果\n![](https://raw.githubusercontent.com/shaojiankui/JKScreenRecorder/master/demo.gif)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaojiankui%2Fjkscreenrecorder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaojiankui%2Fjkscreenrecorder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaojiankui%2Fjkscreenrecorder/lists"}