How do I use screen mirroring in iOS app programatically

100 Views Asked by At

I need to use screen mirroring when I click on Airplay button. When I click on Airplay button, it presents airplay popup with list of compatible devices. After connecting to a display (MacBook) only videos are streamed to it. How can I use screen mirroring here for all screens? I'm using the following code to show Airplay button:

func setAirplayButton() {
    let buttonView  = UIView(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
    let routerPickerView =  AVRoutePickerView(frame: buttonView.bounds)
    routerPickerView.tintColor = UIColor.black
    routerPickerView.activeTintColor = .green
    buttonView.addSubview(routerPickerView)
    self.airPlayView.addSubview(buttonView)
}
0

There are 0 best solutions below