如何在屏幕录制swift时检查静音或取消静音

发布于 2025-02-08 18:22:34 字数 122 浏览 1 评论 0原文

我已经使用RPSystemBroadcastPickerview进行了录制屏幕。 (broadcastExtension) 屏幕录制时,我必须知道静音/取消静音状态。 因此,请让我知道如何检查。

任何帮助将不胜感激。

I've used RPSystemBroadcastPickerView to record screen. (BroadcastExtension)
I have to know mute/unmute status while screen recording.
So please let me know how to check it.

Any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

原来是傀儡 2025-02-15 18:22:34

在SampleBuffer中,您可以选择音频。

override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType)

rpsampleBuffertype的其中有音频选项。

@available(iOS 10.0, *)
public enum RPSampleBufferType : Int, @unchecked Sendable {

    
    case video = 1

    case audioApp = 2

    case audioMic = 3
}

您必须检查.audioApp& .audiomic

现在,将这些值打印在ProcessSmameBuffer方法中。据我所知,应该有级别的选项。尝试从元数据中提取音频水平。如果音频级别低于阈值值,则否则会静音。阈值值完全取决于您。

In sampleBuffer, you have options for audio.

override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType)

where RPSampleBufferType has audio options.

@available(iOS 10.0, *)
public enum RPSampleBufferType : Int, @unchecked Sendable {

    
    case video = 1

    case audioApp = 2

    case audioMic = 3
}

You have to check both .audioApp & .audioMic.

Now print those values in processSampleBuffer methods. There should have level options as far as I can remember. try to extract the audio level from the metadata. If the audio level is under a threshold value then it is mute otherwise on. The threshold value is completely up to you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文