菜鸟教程小白 发表于 2022-12-12 12:17:09

IOS8:录制到文件并使用 AVCaptureSession/commitConfiguration 时相机预览闪烁


                                            <p><p>自从IOS8以来,我在使用commitConfiguration时遇到了一个奇怪的问题
我们通过 AVCaptureMovieFileOutput 录制 5 秒的文件。更改文件时,相机预览会闪烁并变黑一秒钟。在接收服务器上缝合文件时也会出现卡顿。</p>

<pre><code>// method that switches the output file
- (void) switchOutputFile {
    NSURL *outputUrl = ;
    NSLog(@&#34;Switching to: %@&#34;, outputUrl);

    // begin configuration
    ;

    // remove the current writer
    ;

    // attach new writer
    self.fileOutput = ;

    // commit configuration
    ;

    // after this line the camera preview flickers.
    ;
}
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>解决方案非常简单——不要删除并添加编写器。感谢苹果的 bford 的解释!
这是更新的函数方法</p>

<pre><code>// method that switches the output file
- (void) switchOutputFile {
    NSURL *outputUrl = ;
    NSLog(@&#34;Switching to: %@&#34;, outputUrl);
    ;
}
</code></pre></p>
                                   
                                                <p style="font-size: 20px;">关于IOS8:录制到文件并使用 AVCaptureSession/commitConfiguration 时相机预览闪烁,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/26573580/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/26573580/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: IOS8:录制到文件并使用 AVCaptureSession/commitConfiguration 时相机预览闪烁