AirPlay allows users to wirelessly stream content from their iOS device or Mac to devices and accessories compatible with AirPlay.

Posts under AirPlay tag

105 Posts

Post

Replies

Boosts

Views

Activity

Calling replaceCurrentItem(with:) method not working after an error occurs on AirPlay
Hello, My problem is quite complex, so I am going to describe it in detail below. I am developing a playback app that makes use of HLS streaming. One of the requirements I have to meet is that my app should react to HTTP response headers. As there is no API to get these information, I applied the solution described in the latest comment right here: HTTP Response Header from AVPlayer – I am using a proxy server to extract the headers from the response. The problem happens when a user wants to stream video on an external device via AirPlay. Since the proxy server runs only on a mobile device, any HTTP request fails on the external device due to an incorrect URL (e.g http://127.0.0.1:58244/theRestOfUrl/playlist.m3u8). In this case, I detect when the AirPlay connection is initiated (via the Notification Center mechanism), and then change AVPlayerItem by calling the replaceCurrentItem(with:) method. The new item contains a correct URL, without the proxy server address added. Everything works fine on AirPlay 2, but unfortunately not on older AirPlay – the player on the external device displays an activity indicator for a moment and after a while the connection is being interrupted. As a workaround, I tried to set nil on AVPlayer and create a new instance of it, but this does not work either. I can attach the sample project if needed. Best regards, Tomasz
1
0
1.5k
Oct ’21
Big Sur Music app will not AirPlay if EQ is turned on
Since updating to Big Sur on my 2018 MBP I've had nothing but Music app issues, and the issues are far and wide (Missing Artwork, no Artwork Cache for my Apple TVs, and of course AirPlay from the Music app). However, after months of troubleshooting AirPlay issues with Music, I was finally able to determine that if I have EQ turned on, Music will not allow me to AirPlay to any of my Apple TVs. Interestingly, if I turn off EQ I can instantly AirPlay to any of my Apple TVs. Turning the EQ back on while AirPlaying to an Apple TV has no change to the sound, but once I stop AirPlaying, the EQ becomes effective on my MBP about 2 seconds after I stop AirPlaying (you can hear the tonal changes after the EQ enables itself again). Any suggestions??
0
0
509
Aug ’21
ios 15 and bluetooth always connected airpods
Hello; not if the topic has already been treated (I have searched but I have not found anything) in practice I have a problem with my iphone 12 pro max with the beta 6 version of ios 15 (19A5325f); the problem specifically concerns the bluetooth that I always remain connected with my second generation airpods (but the same happens with my airpods pro). In practice, making a phone call automatically, the call switches to the airpods even with the case closed and often going to the airplay menu I have to click on the small radar type icon to see that the iphone is always connected with the airpods even with the case closed I repeat. I also notice the automatic switch because the music menu appears in the lockscren. I ask you kindly, am I doing something wrong with the settings or is it an ios 15 bug? Tell me what details you need to better understand the problem. Thank you
0
0
841
Aug ’21
AVPlayer.timeControlStatus is not updated when switch playback from the device to AirPlay
Hello! I'm writing an app with a possibility to play HLS streams. I make a KVO subscription for AVPlayer.timeControlStatus to change the state of custom trickplay controls. When I switch the playback from the device to an AirPlay device (Apple TV 4K for instance), the KVO subscription is triggerred once with .paused state and then stops getting updates. However the playback is active on the AppleTV in the same time. Also I have a periodicTimeObserver with period of 1 sec and this observer continues getting triggered each second. But if I print out the timeControlState of the player inside this periodicObserver it stays .paused. It's more strange as periodicObserver should not be triggered when prayer is in .paused state. When I pause/play the playback using remote control of the Apple TV everything starts working as expected: AVPlayer.timeControlStatus updates begin trigger KVO observation, periodicObserver is being triggered only when playback is active and timeControlStatus is .paying. I tried to simulate it in the clean project and prepared the project that just presents an AVPlayerViewController that shows a video from the hardcoded URL. And all the issues are being reproduced in the same way in the clean project. Please, find the listing below. I've tested this behavior with iOS 12.3.1 and 14.3 iPhones and AplleTV 4K tvOS 14.4. Is something wrong with AVPlayer configuration or is it an expected behavior or an iOS bug? swift class ViewController: UIViewController {     private var player: AVPlayer?     private var obs: NSKeyValueObservation?     @IBAction func playVideo(_ sender: Any) {         guard let url = URL(string: "https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8") else {             return         }         player = AVPlayer(url: url)         player?.addPeriodicTimeObserver(             forInterval: CMTime(seconds: 1, preferredTimescale: 600),             queue: DispatchQueue.main         ) { [weak player] _ in             print("#$#$player timeControlStatus: \(player?.timeControlStatus.rawValue)")         }         obs = player?.observe(\AVPlayer.timeControlStatus) { player, _ in             print("#$#$timeControlStatus changed to: \(player.timeControlStatus.rawValue)")         }         let controller = AVPlayerViewController()         controller.player = player         present(controller, animated: true) {             self.player?.play()         }     } }
3
0
2.9k
Aug ’21
Airplay to LG Smart TV
My boyfriend and I both have MacBook Pros. He's still using Catalina and has no issues. I updated to Big Sur 11.2.2 (20D80) and I cannot use the airplay feature on our LG smart TV (UN7240PVG). One of a few things happen: I go to Display under System preferences and select the TV. It selects it for a moment and the selection reverts back to the "Off" option. Then a pop-up appears saying the connection fails. Sometimes it does connect through the above way, but it is skipping and the sound pauses every few seconds and is not a pleasant viewing experience. I open QuickTime player with a movie and use the AirPlay icon from there and select the TV. I still see the play/pause action menu, but the rest of the player goes black and the TV is stuck on the AirPlay settings menu. For option 3 I go between resetting the device in AirPlay to forget the 1 time passcode (which only sometimes will work to give me a new code), asking for a password for each connection, or a code each time a device is connected. Nothing works. Even when I do manage to be given a passcode the TV stays on the AirPlay setting screen and the video player on the computer stays black. Quite annoying! Please please please fix! I've tried the fire wall setting mentioned here a few times, but this didn't work for me. Anyone else found a fix for something similar happening?
1
0
2.6k
Aug ’21
Calling replaceCurrentItem(with:) method not working after an error occurs on AirPlay
Hello, My problem is quite complex, so I am going to describe it in detail below. I am developing a playback app that makes use of HLS streaming. One of the requirements I have to meet is that my app should react to HTTP response headers. As there is no API to get these information, I applied the solution described in the latest comment right here: HTTP Response Header from AVPlayer – I am using a proxy server to extract the headers from the response. The problem happens when a user wants to stream video on an external device via AirPlay. Since the proxy server runs only on a mobile device, any HTTP request fails on the external device due to an incorrect URL (e.g http://127.0.0.1:58244/theRestOfUrl/playlist.m3u8). In this case, I detect when the AirPlay connection is initiated (via the Notification Center mechanism), and then change AVPlayerItem by calling the replaceCurrentItem(with:) method. The new item contains a correct URL, without the proxy server address added. Everything works fine on AirPlay 2, but unfortunately not on older AirPlay – the player on the external device displays an activity indicator for a moment and after a while the connection is being interrupted. As a workaround, I tried to set nil on AVPlayer and create a new instance of it, but this does not work either. I can attach the sample project if needed. Best regards, Tomasz
Replies
1
Boosts
0
Views
1.5k
Activity
Oct ’21
Big Sur Music app will not AirPlay if EQ is turned on
Since updating to Big Sur on my 2018 MBP I've had nothing but Music app issues, and the issues are far and wide (Missing Artwork, no Artwork Cache for my Apple TVs, and of course AirPlay from the Music app). However, after months of troubleshooting AirPlay issues with Music, I was finally able to determine that if I have EQ turned on, Music will not allow me to AirPlay to any of my Apple TVs. Interestingly, if I turn off EQ I can instantly AirPlay to any of my Apple TVs. Turning the EQ back on while AirPlaying to an Apple TV has no change to the sound, but once I stop AirPlaying, the EQ becomes effective on my MBP about 2 seconds after I stop AirPlaying (you can hear the tonal changes after the EQ enables itself again). Any suggestions??
Replies
0
Boosts
0
Views
509
Activity
Aug ’21
ios 15 and bluetooth always connected airpods
Hello; not if the topic has already been treated (I have searched but I have not found anything) in practice I have a problem with my iphone 12 pro max with the beta 6 version of ios 15 (19A5325f); the problem specifically concerns the bluetooth that I always remain connected with my second generation airpods (but the same happens with my airpods pro). In practice, making a phone call automatically, the call switches to the airpods even with the case closed and often going to the airplay menu I have to click on the small radar type icon to see that the iphone is always connected with the airpods even with the case closed I repeat. I also notice the automatic switch because the music menu appears in the lockscren. I ask you kindly, am I doing something wrong with the settings or is it an ios 15 bug? Tell me what details you need to better understand the problem. Thank you
Replies
0
Boosts
0
Views
841
Activity
Aug ’21
AVPlayer.timeControlStatus is not updated when switch playback from the device to AirPlay
Hello! I'm writing an app with a possibility to play HLS streams. I make a KVO subscription for AVPlayer.timeControlStatus to change the state of custom trickplay controls. When I switch the playback from the device to an AirPlay device (Apple TV 4K for instance), the KVO subscription is triggerred once with .paused state and then stops getting updates. However the playback is active on the AppleTV in the same time. Also I have a periodicTimeObserver with period of 1 sec and this observer continues getting triggered each second. But if I print out the timeControlState of the player inside this periodicObserver it stays .paused. It's more strange as periodicObserver should not be triggered when prayer is in .paused state. When I pause/play the playback using remote control of the Apple TV everything starts working as expected: AVPlayer.timeControlStatus updates begin trigger KVO observation, periodicObserver is being triggered only when playback is active and timeControlStatus is .paying. I tried to simulate it in the clean project and prepared the project that just presents an AVPlayerViewController that shows a video from the hardcoded URL. And all the issues are being reproduced in the same way in the clean project. Please, find the listing below. I've tested this behavior with iOS 12.3.1 and 14.3 iPhones and AplleTV 4K tvOS 14.4. Is something wrong with AVPlayer configuration or is it an expected behavior or an iOS bug? swift class ViewController: UIViewController {     private var player: AVPlayer?     private var obs: NSKeyValueObservation?     @IBAction func playVideo(_ sender: Any) {         guard let url = URL(string: "https://bitdash-a.akamaihd.net/content/MI201109210084_1/m3u8s/f08e80da-bf1d-4e3d-8899-f0f6155f6efa.m3u8") else {             return         }         player = AVPlayer(url: url)         player?.addPeriodicTimeObserver(             forInterval: CMTime(seconds: 1, preferredTimescale: 600),             queue: DispatchQueue.main         ) { [weak player] _ in             print("#$#$player timeControlStatus: \(player?.timeControlStatus.rawValue)")         }         obs = player?.observe(\AVPlayer.timeControlStatus) { player, _ in             print("#$#$timeControlStatus changed to: \(player.timeControlStatus.rawValue)")         }         let controller = AVPlayerViewController()         controller.player = player         present(controller, animated: true) {             self.player?.play()         }     } }
Replies
3
Boosts
0
Views
2.9k
Activity
Aug ’21
Airplay to LG Smart TV
My boyfriend and I both have MacBook Pros. He's still using Catalina and has no issues. I updated to Big Sur 11.2.2 (20D80) and I cannot use the airplay feature on our LG smart TV (UN7240PVG). One of a few things happen: I go to Display under System preferences and select the TV. It selects it for a moment and the selection reverts back to the "Off" option. Then a pop-up appears saying the connection fails. Sometimes it does connect through the above way, but it is skipping and the sound pauses every few seconds and is not a pleasant viewing experience. I open QuickTime player with a movie and use the AirPlay icon from there and select the TV. I still see the play/pause action menu, but the rest of the player goes black and the TV is stuck on the AirPlay settings menu. For option 3 I go between resetting the device in AirPlay to forget the 1 time passcode (which only sometimes will work to give me a new code), asking for a password for each connection, or a code each time a device is connected. Nothing works. Even when I do manage to be given a passcode the TV stays on the AirPlay setting screen and the video player on the computer stays black. Quite annoying! Please please please fix! I've tried the fire wall setting mentioned here a few times, but this didn't work for me. Anyone else found a fix for something similar happening?
Replies
1
Boosts
0
Views
2.6k
Activity
Aug ’21