Bokii
Bokii

Reputation: 49

Transport bar live label in AVPlayerViewController (tvOS only)

It seems impossible to disable or change the red backgrounded LIVE label in the AVPlayerViewController's transport bar on tvOS 15.2. Also, it is enabled by default ever since 15.2 came out. Here is a picture of the label shown here:

enter image description here

I have tried to play around with some of the available options like this one:

guard let pvc = playerRenderController as? AVPlayerViewController else { return }

pvc.transportBarIncludesTitleView = false

It does hide the LIVE label but it also hides the title (Straight Rhythm) from the image. Furthermore, the label text seems to be specific to the locale, so in Danish it would be DIREKTE instead of LIVE.

Here is a video that showcases this feature (time 03:08):

Any suggestions on how to hide/change this label?

Upvotes: 1

Views: 531

Answers (1)

Vasilis D.
Vasilis D.

Reputation: 1456

Hello I found a workaround to do it.

After you play the stream call this function with parameters the playerViewController.view

private func removeLiveLabel(view: UIView) {
    let list = ["_AVPlayerViewControllerContainerView", "_AVFocusContainerView", "UIView"]
    for subview in view.subviews where list.contains(String(describing: type(of: view))) {
        for subSubview in subview.subviews {
            if subSubview.value(forKey: "class").debugDescription.contains("_AVxOverlayPlaybackAuxiliaryMetadataView") {
                subSubview.removeFromSuperview()
                return
            }
        }
        removeLiveLabel(view: subview)
    }
}

This function will search the subviews of the AVPlayerViewController object controls and will remove the badge from the view without removing the Title.

Upvotes: 1

Related Questions