Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix buffer rotation creation in Screencast example #1501

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Examples/iOS/Screencast/SampleHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ open class SampleHandler: RPBroadcastSampleHandler {
get { _rotator as? VideoRotator }
set { _rotator = newValue }
}

private var isVideoRotationEnabled = false {
didSet {
if isVideoRotationEnabled, #available(iOS 16.0, tvOS 16.0, macOS 13.0, *) {
_rotator = VideoRotator()
} else {
_rotator = nil
}
}
}
private lazy var rtmpConnection: RTMPConnection = {
let conneciton = RTMPConnection()
conneciton.addEventListener(.rtmpStatus, selector: #selector(rtmpStatusEvent), observer: self)
Expand Down Expand Up @@ -47,6 +55,8 @@ open class SampleHandler: RPBroadcastSampleHandler {
LBLogger.with(HaishinKitIdentifier).level = .info
// rtmpStream.audioMixerSettings = .init(sampleRate: 0, channels: 2)
rtmpStream.audioMixerSettings.tracks[1] = .default
rtmpStream.videoSettings.scalingMode = .letterbox
isVideoRotationEnabled = true
rtmpConnection.connect(Preference.default.uri!, arguments: nil)
// The volume of the audioApp can be obtained even when muted. A hack to synchronize with the volume.
DispatchQueue.main.async {
Expand Down
Loading