Hi,
Brief background on what I'm trying to achieve:
I have an IoT device that produces a HLS stream of saved videos when they are accessed through the device's broadcast hotspot. To access the hotspot, I use an NEHotspotConfiguration. When I use AVPlayer to watch the HLS stream, everything is fine! When I use a media pod (VLC) to try to consume the HLS stream, traffic goes over cellular network even though the device's host address is 192.168.1.254. I am under the impression this is ALWAYS a local network device.
I haven't spent much time digging into the code for VLC to figure out why, but when I disable cell network in my app's settings, the VLC request resolves perfectly. I have been served radio silence on their forums and issues, so I thought if there's another solution this would be the place to ask!
Is there something going on with the way iOS handles web requests to local network devices? My IoT device's hotspot never has internet access, and after reading Quinn's Extra-ordinary Networking advice (https://developer.apple.com/forums/thread/734348), I'm still lost for how I can force my request to go to the WiFi network rather than cellular...
Does anyone have any recommendations?
Thanks in advance!
When I use AVPlayer to watch the HLS stream, everything is fine!
Yay for us!
This is almost certainly an issue with the way that your third-party code is using the networking APIs. I was gonna point you at Extra-ordinary Networking, but it seems you’ve found that (-:
I'm still lost for how I can force my request to go to the WiFi network rather than cellular...
That shouldn’t be necessary because the IP address you’re connecting to is on a directly connected network. You can verify this at all the layers:
-
Use
URLSession
to make a simple request. -
Connect to the server using
NWConnection
. -
Write some trivial BSD Sockets code to connect to the server. See Extra-ordinary Networking for a link to a wrapper that’s designed to make it easy to write this sort of test code.
All should do the right thing in this case. If not, let me know and I’ll look at this in more depth.
I suspect your third-party code has some smarts that are… well… less smart than they should be. However, it’s hard to say without digging through their code.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"