HLS Stream from local network failing to connect
Tl;dr: trying to stream an mp4 file from a WLAN network hosted by a dashcam that is storing the file. iOS detects no internet connection on the WLAN network, so will use cellular data for network requests. Despite this VLC can view RTSP stream from that device, but when requesting the HLS stream ("http://192.168.1.254/xxxx.mp4") the request is sent to the internet via cellular data, not local network device.
Have sniffed packet dumps with wireshark, the VLC HLS request never goes to local network device if cellular available and device does not have access to internet through WiFi network. The only instance I have seen where it does go to local network, is after 3 failed attempts. It then changes request protocol from HTTP 1.1 to HTTP 1.0 and then the stream fails anyway.
I need to keep cellular data permissions on in my app because my users likely use that in other flows, and then can share content directly from their dashcams when they review it for the first time. I think VLC seems to just handle the media url wrong with the network setup, though maybe there is something else I could be doing? Afaik I cannot configure the app to programmatically preference local network over cellular data when it has no internet access. When I use AVPlayer, it correctly handles the HLS stream.
Operating system: iOS 17.6.1 (and several more iOS versions including iOS 18 betas and iOS 17 RCs) VLC media player version: MobileVLCKit 3.6.0 (VLC/3.0.21) Hardware: iPhone 15 Pro Max, iPhone 15 Pro, iPhone 14 Pro Max, iPhone 13 Pro Max, iPhone XS Max
Steps to reproduce
- Host a WiFi network with no internet access, connect your iPhone and some other device with which you can host a http stream using VLC.*
- On that WiFi network, use a computer to host a http local network stream at an address starting with 192.168. I used an mp4 file (mp4a and H.264)
- Open the VLC app on your iPhone and try to consume the http stream. The stream will not load. ^
- Open settings on your iPhone, navigate to VLC settings and disable cellular data.
- Return to VLC and consume your stream. It will play, beca
* WiFi setup sounds tricky, here is what I did; I restricted my iPhone's ability to access the internet on my WiFi network through a router rule. I then hosted a http stream with an mp4 file on vlc using a MacBook Pro on the same WiFi network using this call: vlc -vvvv ~/Desktop/CYQ_0107.MP4 --sout #'standard{access=http,mux=ts,dst=:80/CYQ_0107.MP4}'
^ If you use router rules to restrict network access, you may need to wait until your phone throws an error saying there is no internet access via the WiFi network, and allow cellular data use. I needed to do that, the http stream works normally until your phone realises that the WiFi network has no internet access.
File type: mp4, codecs MPEG4-AAC and h.264. No subs
Issue is not file specific, is related to stream setup, but happy to provide files.
Have attached verbose logging from VLC in the cases where the stream fails due to cell data being available, and the case where cell data is not available and it works. I also have a screen recording if you'd rather watch that to understand.
cell data permission allowed: https://pastebin.com/5RDQYSBQ
cell data permission not allowed: https://pastebin.com/gzRYQApz