Skip to content

Commit

Permalink
Migration #1537 for 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo4405 committed Aug 21, 2024
1 parent 42d7176 commit eafff5f
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions Sources/Mixer/MediaMixer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import Combine
import UIKit
#endif

/// An object that mixies audio and video for streaming.
/// An actor that mixies audio and video for streaming.
public final actor MediaMixer {
static let defaultFrameRate: Float64 = 30

/// The MediaMixer error domain codes.
/// The error domain codes.
public enum Error: Swift.Error {
/// The mixer failed to failed to attach device.
case failedToAttach(_ error: any Swift.Error)
Expand Down Expand Up @@ -77,15 +77,20 @@ public final actor MediaMixer {
videoIO.frameRate
}

/// The capture session is in a running state or not.
@available(tvOS 17.0, *)
public var isCapturing: Bool {
session.isRunning
}

#if os(iOS) || os(macOS)
/// Specifies the video orientation for stream.
/// The video orientation for stream.
public var videoOrientation: AVCaptureVideoOrientation {
videoIO.videoOrientation
}
#endif

public private(set) var isRunning = false

private var outputs: [any MediaMixerOutput] = []
private lazy var audioIO = AudioCaptureUnit(session)
private lazy var videoIO = VideoCaptureUnit(session)
Expand Down Expand Up @@ -219,6 +224,20 @@ public final actor MediaMixer {
audioIO.isMonitoringEnabled = monitoringEnabled
}

/// Starts capturing from input devices.
///
/// Internally, it is called either when the view is attached or just before publishing. In other cases, please call this method if you want to manually start the capture.
@available(tvOS 17.0, *)
public func startCapturing() {
session.startRunning()
}

/// Stops capturing from input devices.
@available(tvOS 17.0, *)
public func stopCapturing() {
session.stopRunning()
}

#if os(iOS) || os(tvOS)
/// Specifies the AVCaptureMultiCamSession enabled.
/// - Attention: If there is a possibility of using multiple cameras, please set it to true initially.
Expand Down

0 comments on commit eafff5f

Please sign in to comment.