Streamaxia Open SDK  3.2
List of all members
AXRecorder Class Reference

#import <AXRecorder.h>

Inheritance diagram for AXRecorder:

Instance Methods

Recording mode


(BOOL) - isRecordingModeSupported:
 
(void) - changeRecordingMode:withCompletion:
 
Camera


(BOOL) - isCameraPresent:
 
(void) - switchToCamera:withCompletion:
 
Torch Mode


(BOOL) - isTorchModeSupported:
 
(void) - changeTorchMode:withCompletion:
 
(void) - changeTorchLevel:withCompletion:
 
Resolution


(BOOL) - isFrameSizeSupported:
 
(BOOL) - isResolutionSupported:
 
(void) - changeVideoResolution:withCompletion:
 
(void) - changeResolutionInversion:withError:
 
Frame Rate


(BOOL) - isFrameRateSupported:
 
(void) - changeFrameRate:withCompletion:
 
Key Frame Interval


(void) - changeKeyFrameInterval:withCompletion:
 
Video Bitrate


(void) - changeVideoBitrate:withCompletion:
 
Audio Sample Rate


(void) - changeAudioSampleRate:withCompletion:
 
Video Orientation


(void) - changeVideoOrientation:
 

Class Methods

Lifecycle


(instancetype) + recorderWithStreamInfo:settings:
 

Properties

Properties


id< AXRecorderDelegate > recorderDelegate
 
AXRecorderSettingssettings
 
AXStreamInfoinfo
 
AXRecorderState state
 
BOOL isActive
 
BOOL isRecording
 
BOOL isStreaming
 
BOOL hasInternetConnection
 
BOOL hasMicrophoneAccess
 
BOOL hasCameraAccess
 
AVCaptureDevice * currentCamera
 

Public methods



NSArray< AXStreamSource * > * streamSources
 
(instancetype) - setupWithView:
 
(void) - prepareToRecord
 
(void) - startStreamingWithCompletion:
 
(void) - stopStreaming
 
(void) - activateFeatureAdaptiveBitRateWithError:
 
(void) - deactivateFeatureAdaptiveBitRate
 
(void) - activateFeatureSaveLocallyWithError:
 
(void) - deactivateFeatureSaveLocallyWithError:
 
(AXStreamSource *) - addStreamingSourceWithInfo:
 
(void) - removeStreamingSourceWithInfo:
 
(void) - changeRecorderSettings:withCompletion:
 
(void) - changeStreamInfo:withCompletion:
 

Detailed Description

The recorder class.

Method Documentation

◆ activateFeatureAdaptiveBitRateWithError:()

- (void) activateFeatureAdaptiveBitRateWithError: (AXError **)  error

Starts the adaptive bitrate service. If a constant bit rates were set they are ignored while adaptive bitrate is started.

Parameters
errorError object is set with an error code and a message if somethings goes wrong with the activation.

Provided by category AXRecorder(ExtraFeatures).

◆ activateFeatureSaveLocallyWithError:()

- (void) activateFeatureSaveLocallyWithError: (AXError **)  error

Activate the save locally feature. To be able to use this feature you must add photos privacy key in your Info.plist: <key>NSPhotoLibraryUsageDescription</key> <string>Some message.</string> The save locally feature can be activated only when the player is stopped, otherwise an error is returned. After calling this method when a stream is started it will autmatically be saved. When the stream is stopped it will be shared to the Photos app and camera roll.

Parameters
errorError object is set with an error code and a message if somethings goes wrong with the activation.

Provided by category AXRecorder(ExtraFeatures).

◆ changeAudioSampleRate:withCompletion:()

- (void) changeAudioSampleRate: (NSInteger)  audioSampleRate
withCompletion: (void(^)(BOOL success, AXError *error))  completionBlock 

Change the current audio sample rate setting. It is recommended however to use 44100 Hz. The audio sample rate is not allowed to be changed while streaming.

Parameters
audioSampleRateThe new audio sample rate.

Provided by category AXRecorder(RecorderSettings).

◆ changeFrameRate:withCompletion:()

- (void) changeFrameRate: (NSInteger)  frameRate
withCompletion: (void(^)(NSInteger validFrameRate))  completionBlock 

Change the frame rate (in fps). The frame rate is allowed to be changed while streaming.

If the new frame rate is not supported, the value is clamped into the supported ranges. The new frame rate is returned in the completion block.

Parameters
frameRateThe new frame rate.
completionBlockThe completion block.

Provided by category AXRecorder(RecorderSettings).

◆ changeKeyFrameInterval:withCompletion:()

- (void) changeKeyFrameInterval: (NSInteger)  keyFrameInterval
withCompletion: (void(^)(BOOL success, AXError *error))  completionBlock 

Change the key frame interval for the video codec. The key frame interval is not allowed to be changed while streaming.

Parameters
keyFrameIntervalThe new key frame interval (in frames).

Provided by category AXRecorder(RecorderSettings).

◆ changeRecorderSettings:withCompletion:()

- (void) changeRecorderSettings: (AXRecorderSettings *)  settings
withCompletion: (void(^)(BOOL success, AXError *error))  completionBlock 

Change and apply the recorder settings. This is not allowed while streaming.

Parameters
settingsThe recorder settings.
completionBlockThe completion block.

Provided by category AXRecorder(RecorderSettings).

◆ changeRecordingMode:withCompletion:()

- (void) changeRecordingMode: (AXRecordingMode)  recordingMode
withCompletion: (void(^)(BOOL success, AXError *error))  completionBlock 

Changes the recording mode. Use this method to mute/unmute audio or to enable/disable video. Recording mode is allowed to be changed while streaming.

The completion block returns the operation result. If change was not succesfull, the error contains the reason of the failure.

Parameters
recordingModeThe recording mode.

Provided by category AXRecorder(RecorderSettings).

◆ changeResolutionInversion:withError:()

- (void) changeResolutionInversion: (BOOL)  inverted
withError: (AXError **)  error 

Change resolution inversion. Set YES for portrait mode streaming, or NO for landscape.

Parameters
invertedThe new flag indicating whether the resolution should be inverted.

Provided by category AXRecorder(RecorderSettings).

◆ changeStreamInfo:withCompletion:()

- (void) changeStreamInfo: (AXStreamInfo *)  streamInfo
withCompletion: (void(^)(BOOL success, AXError *error))  completionBlock 

Change and apply the stream info. This is not allowed while streaming.

Parameters
streamInfoThe stream info.
completionBlockThe completion block.

Provided by category AXRecorder(StreamInfo).

◆ changeTorchLevel:withCompletion:()

- (void) changeTorchLevel: (float)  torchLevel
withCompletion: (void(^)(BOOL success, AXError *error))  completionBlock 

Changes the torch level. Valid values are between 0.0 (off) and 1.0 (full brightness). The given value is clamped in the valid interval.

If an error occured and torch level can't be set, the error info is returned in the completion block.

Parameters
torchLevelThe torch level.
completionBlockThe completion block.

Provided by category AXRecorder(RecorderSettings).

◆ changeTorchMode:withCompletion:()

- (void) changeTorchMode: (AXTorchMode)  torchMode
withCompletion: (void(^)(BOOL success, AXError *error))  completionBlock 

Enable or disable the torch (flash light).

Parameters
torchModeThe new value.

Provided by category AXRecorder(RecorderSettings).

◆ changeVideoBitrate:withCompletion:()

- (void) changeVideoBitrate: (NSInteger)  videoBitRate
withCompletion: (void(^)(BOOL success, AXError *error))  completionBlock 

Changes the video bit rate. The value should be in bits per second (bps). The video bitrate is allowed to be changed while streaming.

Parameters
videoBitRateThe new vide bit rate.

Provided by category AXRecorder(RecorderSettings).

◆ changeVideoOrientation:()

- (void) changeVideoOrientation: (AXVideoOrientation)  videoOrientation

Change the current video orientation.

Parameters
videoOrientationThe new video orientation.

Provided by category AXRecorder(RecorderSettings).

◆ changeVideoResolution:withCompletion:()

- (void) changeVideoResolution: (AXVideoFrameResolution)  resolution
withCompletion: (void(^)(BOOL success, AXError *error))  completionBlock 

Change the resolution of the currently active camera. The resolution is not allowed to be changed while streaming.

If an error occured while changing the resolution, check the error for more info.

It is recommended to change only to supported resolutions. An unsupported custom resolution can be set, but the stream video quality may be degraded due to resolution conversion during the encoding and streaming.

Note* When changing the video resolution, if not using the adaptive video bit rate, it is recommended to adjust the video bit rate to the recommended settings for best quality and performance. If the video bitrate is not appropriate for the selected resolution, the video streaming quality may suffer significantly.

Parameters
resolutionThe resolution.
completionBlockThe completion block.

Provided by category AXRecorder(RecorderSettings).

◆ deactivateFeatureAdaptiveBitRate()

- (void) deactivateFeatureAdaptiveBitRate

Stops the adaptive bitrate service.

Provided by category AXRecorder(ExtraFeatures).

◆ deactivateFeatureSaveLocallyWithError:()

- (void) deactivateFeatureSaveLocallyWithError: (AXError **)  error

Deactivate the local save feature. The save locally feature can be deactivated only when the player is stopped, otherwise an error is returned.

Parameters
errorError object is set with an error code and a message if somethings goes wrong with the activation.

Provided by category AXRecorder(ExtraFeatures).

◆ isCameraPresent:()

- (BOOL) isCameraPresent: (AXCamera)  camera

Checks if the given camera is present on the device.

Parameters
cameraThe camera.
Returns
YES if camera is present, NO otherwise.

Provided by category AXRecorder(RecorderSettings).

◆ isFrameRateSupported:()

- (BOOL) isFrameRateSupported: (NSInteger)  frameRate

Checks if the given frame rate is supported by the current device.

Parameters
frameRateThe frame rate.
Returns
YES if the frame rate is supported, NO otherwise.

Provided by category AXRecorder(RecorderSettings).

◆ isFrameSizeSupported:()

- (BOOL) isFrameSizeSupported: (AXVideoFrameResolution)  frameSize

Determines if the current active camera supports the given frame size.

Parameters
frameSizeThe frame size.
Returns
YES if the frame size is supported, NO otherwise.

Provided by category AXRecorder(RecorderSettings).

◆ isRecordingModeSupported:()

- (BOOL) isRecordingModeSupported: (AXRecordingMode)  recordingMode

Check if the current recording mode is fully supported. This methods returns NO if at least one of the audio and video is required but the appropriate device has not been authorized to be used by the user.

Parameters
recordingModeThe recording mode.
Returns
YES if recording mode is fully supported, NO otherwise.

Provided by category AXRecorder(RecorderSettings).

◆ isResolutionSupported:()

- (BOOL) isResolutionSupported: (AXVideoFrameResolution)  resolution

Determines if the current active camera supports the given resolution.

Parameters
resolutionThe resolution.
Returns
YES if the resolution is supported, NO otherwise.

Provided by category AXRecorder(RecorderSettings).

◆ isTorchModeSupported:()

- (BOOL) isTorchModeSupported: (AXTorchMode)  torchMode

Checks if the given torch mode is supported.

Parameters
torchModeThe torch mode.
Returns
YES if the given torch mode is supported, NO otherwise.

Provided by category AXRecorder(RecorderSettings).

◆ prepareToRecord()

- (void) prepareToRecord

Prepare to record. This must be called before startStreaming.

The capture is also started, and if the recorder has an output view, the capture output will be visible in the view.

◆ recorderWithStreamInfo:settings:()

+ (instancetype) recorderWithStreamInfo: (AXStreamInfo *)  info
settings: (AXRecorderSettings *)  settings 

Factory method for creating a recorder object, with a stream info and recorder settings.

Parameters
infoThe stream info.
settingsThe recorder settings.
Returns
The initialized object.

◆ setupWithView:()

- (instancetype) setupWithView: (UIView *)  view

Setup the recorder with a custom view, in which the capture output will be displayed. This should be called before prepareToRecord. However, it is not mandatory to have an output view.

Parameters
viewThe view.
Returns
The initialized object.

◆ startStreamingWithCompletion:()

- (void) startStreamingWithCompletion: (void(^)(BOOL success, AXError *error))  completionBlock

Starts the streaming. The completion block is returning the info about the success of this operation. If streaming couldn't be started, then the error contains info about the reason of failure.

Parameters
completionBlockThe completion block.

◆ stopStreaming()

- (void) stopStreaming

Stops the streaming.

◆ switchToCamera:withCompletion:()

- (void) switchToCamera: (AXCamera)  camera
withCompletion: (void(^)(BOOL success, AXError *error))  completionBlock 

Switch the active camera to the desired camera. Active camera is allowed to be changed while streaming.

The operation may be succesfull or not. It may fail if the current resolution is not supported on the desired camera. Also the camera may not be available for other reasons. The success flag in the completion block indicates if the switch was done succesfully. If the switch operation fails, check the error to see the reason of the failure.

Parameters
cameraThe new camera.
completionBlockThe completion block.

Provided by category AXRecorder(RecorderSettings).

Property Documentation

◆ currentCamera

- (AVCaptureDevice*) currentCamera
readnonatomicstrong

Get the currently active camera. This can be used to determine the current camera capabilities - like frame rate, resolutions and other.

Also it can be used to set several other configuration settings. However, this should be used with care, since the streaming may be broken if some settings are changed while the streaming is running.

Provided by category AXRecorder(AdvancedSetup).

◆ hasCameraAccess

- (BOOL) hasCameraAccess
readnonatomicassign

Returns YES if the recorder has access to the camera, NO otherwise.

◆ hasInternetConnection

- (BOOL) hasInternetConnection
readnonatomicassign

Returns YES if the recorder has internet access, NO otherwise.

◆ hasMicrophoneAccess

- (BOOL) hasMicrophoneAccess
readnonatomicassign

Returns YES if the recorder has access to the microphone, NO otherwise.

◆ info

- (AXStreamInfo*) info
readnonatomicstrong

The stream info.

◆ isActive

- (BOOL) isActive
readnonatomicassign

Returns YES if the recorder is active and is currently recording and/or streaming.

◆ isRecording

- (BOOL) isRecording
readnonatomicassign

Returns YES if the recorder has started capture, NO otherwise.

◆ isStreaming

- (BOOL) isStreaming
readnonatomicassign

Returns YES if the recorder is streaming, NO otherwise.

◆ recorderDelegate

- (id<AXRecorderDelegate>) recorderDelegate
readwritenonatomicweak

The recorder delegate.

◆ settings

- (AXRecorderSettings*) settings
readnonatomicstrong

The recorder settings.

◆ state

- (AXRecorderState) state
readnonatomicassign

The current recorder state.


The documentation for this class was generated from the following file: