如何隐藏AVPictureInPictureController中的播放/暂停按钮?

5
我在我的应用程序中使用AVPictureInPictureController的画中画功能,想要隐藏AVPictureInPictureController中的播放/暂停按钮,但我尝试失败了。现在我需要帮助。

Apple旨在通过直接用户操作来启动AVPictureInPictureController,因此始终显示播放/暂停按钮是有意义的。我认为没有隐藏它们的方法,因为甚至不支持子类化。来源:https://developer.apple.com/documentation/avkit/avpictureinpicturecontroller - Spyros P.
3
https://i.stack.imgur.com/XbhlI.jpg - liunianhuaguoyanxi
但我发现有些应用程序默认情况下可以隐藏播放/暂停按钮,同时显示画中画功能。它是否使用了私有属性? - liunianhuaguoyanxi
@liunianhuaguoyanxi,你知道如何实现这个吗? - Aliaksandr Andrashuk
1个回答

1

试试这个:

    if #available(iOS 14.0, *) {
        //Hide the seekbar
        pipController?.requiresLinearPlayback = true
    } else {
        // Fallback on earlier versions
    }
    
    //Hide the play/pause controls
    pipController?.setValue(1, forKey: "controlsStyle")

2
嗯,这个在应用商店的审核中会被接受吗?感觉像是私有属性... - Pointblaster

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接