Sagar Thukral
Sagar Thukral

Reputation: 70

Airplay support iOS

I'am trying to add airplay for my audio app. Here is my code

let buttonView  = UIView(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
let routerPickerView =  AVRoutePickerView(frame: buttonView.bounds)
routerPickerView.tintColor = UIColor.white
routerPickerView.activeTintColor = UIColor.white
buttonView.addSubview(routerPickerView)
self.btnsStack.addArrangedSubview(buttonView)

This works well with my Mac, but when I try to play it with my Samsung Smart TV, there is a loader keeps on spinning. I tried connecting my TV with other apps like Spotify and it works.

Upvotes: 0

Views: 603

Answers (1)

Sagar Thukral
Sagar Thukral

Reputation: 70

Found my solution, so for casting airplay with smart tv one line of code is must

    player?.allowsExternalPlayback = false

player is your AVPlayer.

Upvotes: 1

Related Questions