Yogi Yogi - 7 months ago 48
iOS Question

How to broadcast a local video from an iOS device and receive the stream of it by other iOS devices in the same WiFi network using VLC?

I want to develop an app which would be able to stream its local video over the WiFi network as well as get the streams from other iOS devices and play them.

I think I can use VLC for this purpose but not sure how should I go with it.

Anyone who knows about this please share your experience.



Answering the question as a reference for someone else with similar issue. As I have mentioned in the question, I thought I could use VLC for streaming local videos but I could not find a way to do it. So I used GCDWebServer to create an embedded DAV server in my app and used it to create HTTP links of my local files which I could play on any other device in the same network using AVPlayer which is default for iOS.

I used class GCDWebDAVServer from the project GCDWebServer. Created an instance of it and run it on a port on my device. Then I provided it the path of my Documents folder where I save the files which I want to host on my http server. Below is the code:

davServer = [[GCDWebDAVServer alloc] initWithUploadDirectory:documentsPath];
[davServer startWithPort:8080 bonjourName:nil];

Now when this server starts running it will provide links for the files saved in the 'UploadDirectory' which is the documents directory in my case. Example: If I have saved song.mp3 in my upload directory then it can be accessed using the link http://My-device-IP-Address:8080/song.mp3 in the same network.