NetStream
open class NetStream : NSObject
extension NetStream: IOScreenCaptureUnitDelegate
extension NetStream: SCStreamOutput
The NetStream
class is the foundation of a RTMPStream.
-
The enumeration defines the state a ReadyState NetStream is in.
See moreDeclaration
Swift
public enum ReadyState : Equatable
-
The lockQueue.
Declaration
Swift
public let lockQueue: DispatchQueue
-
Specifies the adaptibe bitrate strategy.
Declaration
Swift
public var bitrateStrategy: any NetBitRateStrategyConvertible { get set }
-
Specifies the audio monitoring enabled or not.
Declaration
Swift
public var isMonitoringEnabled: Bool { get set }
-
Specifies the context object.
Declaration
Swift
public var context: CIContext { get set }
-
Specifiet the device torch indicating wheter the turn on(TRUE) or not(FALSE).
Declaration
Swift
public var torch: Bool { get set }
-
Specifies the frame rate of a device capture.
Declaration
Swift
public var frameRate: Float64 { get set }
-
Specifies the sessionPreset for the AVCaptureSession.
Declaration
Swift
@available(tvOS 17.0, *) public var sessionPreset: AVCaptureSession.Preset { get set }
-
Specifies the video orientation for stream.
Declaration
Swift
public var videoOrientation: AVCaptureVideoOrientation { get set }
-
Specifies the multi camera capture properties.
Declaration
Swift
public var multiCamCaptureSettings: MultiCamCaptureSettings { get set }
-
Specifies the hasAudio indicies whether no signal audio or not.
Declaration
Swift
public var hasAudio: Bool { get set }
-
Specifies the hasVideo indicies whether freeze video signal or not.
Declaration
Swift
public var hasVideo: Bool { get set }
-
Specifies the audio compression properties.
Declaration
Swift
public var audioSettings: AudioCodecSettings { get set }
-
Specifies the video compression properties.
Declaration
Swift
public var videoSettings: VideoCodecSettings { get set }
-
The video input format.
Declaration
Swift
public var videoInputFormat: CMVideoFormatDescription? { get }
-
The audio input format.
Declaration
Swift
public var audioInputFormat: AVAudioFormat? { get }
-
Specifies the controls sound.
Declaration
Swift
public var soundTransform: SoundTransform { get set }
-
The number of frames per second being displayed.
Declaration
Swift
@objc public internal(set) dynamic var currentFPS: UInt16 { get }
-
Specifies the delegate..
Declaration
Swift
public weak var delegate: (any NetStreamDelegate)?
-
The current state of the stream.
Declaration
Swift
public var readyState: ReadyState { get set }
-
Creates a NetStream object.
Declaration
Swift
override public init()
-
Attaches the primary camera object.
Warning
This method can’t use appendSampleBuffer at the same time.Declaration
Swift
@available(tvOS 17.0, *) public func attachCamera(_ device: AVCaptureDevice?, onError: ((_ error: any Error) -> Void)? = nil)
-
Attaches the 2ndary camera object for picture in picture.
Warning
This method can’t use appendSampleBuffer at the same time.Declaration
Swift
@available(iOS 13.0, tvOS 17.0, *) public func attachMultiCamera(_ device: AVCaptureDevice?, onError: ((_ error: any Error) -> Void)? = nil)
-
Attaches the audio capture object.
Warning
This method can’t use appendSampleBuffer at the same time.Declaration
Swift
@available(tvOS 17.0, *) public func attachAudio(_ device: AVCaptureDevice?, automaticallyConfiguresApplicationAudioSession: Bool = false, onError: ((_ error: any Error) -> Void)? = nil)
-
Returns the IOVideoCaptureUnit by index.
Declaration
Swift
@available(tvOS 17.0, *) public func videoCapture(for index: Int) -> IOVideoCaptureUnit?
-
Attaches the screen input object.
Declaration
Swift
public func attachScreen(_ input: AVCaptureScreenInput?)
-
Append a CMSampleBuffer.
Warning
This method can’t use attachCamera or attachAudio method at the same time.Declaration
Swift
public func append(_ sampleBuffer: CMSampleBuffer)
-
Append an AVAudioBuffer.
Warning
This method can’t use attachAudio method at the same time.Declaration
Swift
public func append(_ audioBuffer: AVAudioBuffer, when: AVAudioTime)
-
Register a video effect.
Declaration
Swift
public func registerVideoEffect(_ effect: VideoEffect) -> Bool
-
Unregister a video effect.
Declaration
Swift
public func unregisterVideoEffect(_ effect: VideoEffect) -> Bool
-
Starts recording.
Declaration
Swift
public func startRecording(_ delegate: any IORecorderDelegate, settings: [AVMediaType : [String : Any]] = IORecorder.defaultOutputSettings)
-
Stop recording.
Declaration
Swift
public func stopRecording()
-
A handler that receives stream readyState will update.
Warning
Please do not call this method yourself.Declaration
Swift
open func readyStateWillChange(to readyState: ReadyState)
-
A handler that receives stream readyState updated.
Warning
Please do not call this method yourself.Declaration
Swift
open func readyStateDidChange(to readyState: ReadyState)
-
Declaration
Swift
public func session(_ session: any IOScreenCaptureUnit, didOutput pixelBuffer: CVPixelBuffer, presentationTime: CMTime)
-
Undocumented
Declaration
Swift
public func stream(_ stream: SCStream, didOutputSampleBuffer sampleBuffer: CMSampleBuffer, of type: SCStreamOutputType)