Recorder Class¶
Description¶
Recorder 实现了对当前渲染环境的视频录制功能。
当前Recorder 只在 Android(4.3 或更新)和 iOS的OpenGL ES 2.0 环境下工作。
Constructor¶
- C: void easyar_Recorder__ctor(easyar_Recorder * * Return)¶
- C++11: Recorder()¶
- Traditional C++: Recorder()¶
- Java: public Recorder()¶
- Objective-C: + (easyar_Recorder *) create¶
- Swift (since EasyAR SDK 2.1.0): public convenience init()¶
setOutputFile¶
设置输出视频文件的绝对路径。必须在 start 调用之前设置。
- C: void easyar_Recorder_setOutputFile(easyar_Recorder * This, easyar_String * path)¶
- C++11: void setOutputFile(std::string path)¶
- Traditional C++: void setOutputFile(String * path)¶
- Java: public native void setOutputFile(java.lang.String path)¶
- Objective-C: - (void)setOutputFile:(NSString *)path¶
- Swift (since EasyAR SDK 2.1.0): public func setOutputFile(_ path: String) -> Void¶
setInputTexture¶
设置需要被录制的texture。必须在 start 调用之前设置。
在OpenGL中, texPtr 应该被设为 texture id, 通常在C++中可以使用reinterpret_cast 将其转换成void*。
texture可以在录制过程中修改。
- C: void easyar_Recorder_setInputTexture(easyar_Recorder * This, void * texPtr, int width, int height)¶
- C++11: void setInputTexture(void * texPtr, int width, int height)¶
- Traditional C++: void setInputTexture(void * texPtr, int width, int height)¶
- Java: public native void setInputTexture(long texPtr, int width, int height)¶
- Objective-C: - (void)setInputTexture:(void *)texPtr width:(int)width height:(int)height¶
- Swift (since EasyAR SDK 2.1.0): public func setInputTexture(_ texPtr: OpaquePointer, _ width: Int32, _ height: Int32) -> Void¶
requestPermissions¶
请求录屏所需的系统权限。你可以选择使用这个函数或自己申请权限。
- C: void easyar_Recorder_requestPermissions(easyar_Recorder * This, easyar_FunctorOfVoidFromPermissionStatusAndString permissionCallback)¶
- C++11: void requestPermissions(std::function<void(PermissionStatus, std::string)> permissionCallback)¶
- Traditional C++: void requestPermissions(FunctorOfVoidFromPermissionStatusAndString permissionCallback)¶
- Java: public native void requestPermissions(FunctorOfVoidFromPermissionStatusAndString permissionCallback)¶
- Objective-C: - (void)requestPermissions:(void (^)(easyar_PermissionStatus status, NSString * value))permissionCallback¶
- Swift (since EasyAR SDK 2.1.0): public func requestPermissions(_ permissionCallback: @escaping (PermissionStatus, String) -> Void) -> Void¶
open¶
初始化录屏功能。
- C: bool easyar_Recorder_open(easyar_Recorder * This, easyar_FunctorOfVoidFromRecordStatusAndString statusCallback)¶
- C++11: bool open(std::function<void(RecordStatus, std::string)> statusCallback)¶
- Traditional C++: bool open(FunctorOfVoidFromRecordStatusAndString statusCallback)¶
- Java: public native boolean open(FunctorOfVoidFromRecordStatusAndString statusCallback)¶
- Objective-C: - (bool)open:(void (^)(easyar_RecordStatus status, NSString * value))statusCallback¶
- Swift (since EasyAR SDK 2.1.0): public func `open`(_ statusCallback: @escaping (RecordStatus, String) -> Void) -> Bool¶
start¶
开始录屏。需要在渲染线程上调用。
- C: void easyar_Recorder_start(easyar_Recorder * This)¶
- C++11: void start()¶
- Traditional C++: void start()¶
- Java: public native void start()¶
- Objective-C: - (void)start¶
- Swift (since EasyAR SDK 2.1.0): public func start() -> Void¶
updateFrame¶
使用texture录制一帧数据。需要在渲染线程上调用。
- C: void easyar_Recorder_updateFrame(easyar_Recorder * This)¶
- C++11: void updateFrame()¶
- Traditional C++: void updateFrame()¶
- Java: public native void updateFrame()¶
- Objective-C: - (void)updateFrame¶
- Swift (since EasyAR SDK 2.1.0): public func updateFrame() -> Void¶
stop¶
停止录屏。在调用stop之后,录制不会立即停止,请确保查看callback以获取录屏结束的事件。
- C: void easyar_Recorder_stop(easyar_Recorder * This)¶
- C++11: void stop()¶
- Traditional C++: void stop()¶
- Java: public native void stop()¶
- Objective-C: - (void)stop¶
- Swift (since EasyAR SDK 2.1.0): public func stop() -> Void¶
close¶
关闭 recorder。在调用 close之后,所有资源将被释放。因此,如果在录屏没有完全结束的时候调用close,可能会阻塞一段时间直至录屏完成。
- C: void easyar_Recorder_close(easyar_Recorder * This)¶
- C++11: void close()¶
- Traditional C++: void close()¶
- Java: public native void close()¶
- Objective-C: - (void)close¶
- Swift (since EasyAR SDK 2.1.0): public func close() -> Void¶
setProfile¶
设置录屏配置。默认值是 Quality_720P_Middle。只有在 start 之前调用才会起作用。
这是个整体的配置,如果需要更为细节的配置可以调用其他API。
- C: bool easyar_Recorder_setProfile(easyar_Recorder * This, easyar_RecordProfile profile)¶
- C++11: bool setProfile(RecordProfile profile)¶
- Traditional C++: bool setProfile(RecordProfile profile)¶
- Java: public native boolean setProfile(/* RecordProfile */ int profile)¶
- Objective-C: - (bool)setProfile:(easyar_RecordProfile)profile¶
- Swift (since EasyAR SDK 2.1.0): public func setProfile(_ profile: RecordProfile) -> Bool¶
setVideoSize¶
设置录屏视频大小。默认值是 Vid720p。只有在 start 之前调用才会起作用。
- C: void easyar_Recorder_setVideoSize(easyar_Recorder * This, easyar_RecordVideoSize framesize)¶
- C++11: void setVideoSize(RecordVideoSize framesize)¶
- Traditional C++: void setVideoSize(RecordVideoSize framesize)¶
- Java: public native void setVideoSize(/* RecordVideoSize */ int framesize)¶
- Objective-C: - (void)setVideoSize:(easyar_RecordVideoSize)framesize¶
- Swift (since EasyAR SDK 2.1.0): public func setVideoSize(_ framesize: RecordVideoSize) -> Void¶
setVideoBitrate¶
设置录屏视频比特率。默认值是 2500000。只有在 start 之前调用才会起作用。
- C: void easyar_Recorder_setVideoBitrate(easyar_Recorder * This, int bitrate)¶
- C++11: void setVideoBitrate(int bitrate)¶
- Traditional C++: void setVideoBitrate(int bitrate)¶
- Java: public native void setVideoBitrate(int bitrate)¶
- Objective-C: - (void)setVideoBitrate:(int)bitrate¶
- Swift (since EasyAR SDK 2.1.0): public func setVideoBitrate(_ bitrate: Int32) -> Void¶
setChannelCount¶
设置录屏音频通道数。默认值是 1。只有在 start 之前调用才会起作用。
- C: void easyar_Recorder_setChannelCount(easyar_Recorder * This, int count)¶
- C++11: void setChannelCount(int count)¶
- Traditional C++: void setChannelCount(int count)¶
- Java: public native void setChannelCount(int count)¶
- Objective-C: - (void)setChannelCount:(int)count¶
- Swift (since EasyAR SDK 2.1.0): public func setChannelCount(_ count: Int32) -> Void¶
setAudioSampleRate¶
设置录屏音频采样率。默认值是 44100。只有在 start 之前调用才会起作用。
- C: void easyar_Recorder_setAudioSampleRate(easyar_Recorder * This, int samplerate)¶
- C++11: void setAudioSampleRate(int samplerate)¶
- Traditional C++: void setAudioSampleRate(int samplerate)¶
- Java: public native void setAudioSampleRate(int samplerate)¶
- Objective-C: - (void)setAudioSampleRate:(int)samplerate¶
- Swift (since EasyAR SDK 2.1.0): public func setAudioSampleRate(_ samplerate: Int32) -> Void¶
setAudioBitrate¶
设置录屏音频比特率。默认值是 96000。只有在 start 之前调用才会起作用。
- C: void easyar_Recorder_setAudioBitrate(easyar_Recorder * This, int bitrate)¶
- C++11: void setAudioBitrate(int bitrate)¶
- Traditional C++: void setAudioBitrate(int bitrate)¶
- Java: public native void setAudioBitrate(int bitrate)¶
- Objective-C: - (void)setAudioBitrate:(int)bitrate¶
- Swift (since EasyAR SDK 2.1.0): public func setAudioBitrate(_ bitrate: Int32) -> Void¶
setVideoOrientation¶
设置录屏视频朝向。默认值是 Landscape。只有在 start 之前调用才会起作用。
- C: void easyar_Recorder_setVideoOrientation(easyar_Recorder * This, easyar_RecordVideoOrientation mode)¶
- C++11: void setVideoOrientation(RecordVideoOrientation mode)¶
- Traditional C++: void setVideoOrientation(RecordVideoOrientation mode)¶
- Java: public native void setVideoOrientation(/* RecordVideoOrientation */ int mode)¶
- Objective-C: - (void)setVideoOrientation:(easyar_RecordVideoOrientation)mode¶
- Swift (since EasyAR SDK 2.1.0): public func setVideoOrientation(_ mode: RecordVideoOrientation) -> Void¶
setZoomMode¶
设置录屏缩放模式。默认值是 NoZoomAndClip。只有在 start 之前调用才会起作用。
- C: void easyar_Recorder_setZoomMode(easyar_Recorder * This, easyar_RecordZoomMode mode)¶
- C++11: void setZoomMode(RecordZoomMode mode)¶
- Traditional C++: void setZoomMode(RecordZoomMode mode)¶
- Java: public native void setZoomMode(/* RecordZoomMode */ int mode)¶
- Objective-C: - (void)setZoomMode:(easyar_RecordZoomMode)mode¶
- Swift (since EasyAR SDK 2.1.0): public func setZoomMode(_ mode: RecordZoomMode) -> Void¶