func player()

in CustomUI/CustomUI/Controllers/MainViewController.swift [266:297]


    func player(_ player: IVSPlayer, didChangeState state: IVSPlayer.State) {
        switch state {
        case .buffering:
            bufferIndicator.startAnimating()
            playerStateLabel.text = "Buffering..."
            playerStateLabel.textColor = UIColor.white
            break
        case .playing:
            if player.duration.isIndefinite {
                playerStateLabel.text = "● LIVE"
                playerStateLabel.textColor = UIColor.red
            } else {
                playerStateLabel.text = "◼︎ RECORDED VIDEO"
                playerStateLabel.textColor = UIColor.white
            }
            bufferIndicator.stopAnimating()
            break
        case .ended:
            playerStateLabel.text = "Ended"
            playerStateLabel.textColor = UIColor.white
            bufferIndicator.stopAnimating()
            pauseButton.isHidden = true
            playButton.isHidden = false
        case .idle, .ready:
            playerStateLabel.text = "Paused"
            playerStateLabel.textColor = UIColor.white
            bufferIndicator.stopAnimating()
            break
        @unknown default:
            print("Unknown player state '\(state)'")
        }
    }