Video Streaming Tutorial for iOS: Getting Started | raywenderlich.com

Learn how to build a video streaming app using AVKit and AVFoundation frameworks.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/22372639-video-streaming-tutorial-for-ios-getting-started

I see this lesson was updated for SwiftUI. Would it be possible for the original, non-SwiftUI version to be accessible? Even if only the starter + final project files were available that would be great.

Hello,
Our policy at raywenderlich.com is to use SwiftUI in all sample projects. However, we had to use UIKit for some specific parts of the tutorial such as AVLayer. You can take advantage of those.

Hi Saeed! Thank you for the detailed example of local and remote video streaming. I have a question regarding remote video URL. how do we pass remote url with headers like auth token etc. ?

Hello,
In such cases where passing some tokens are needed, there are a couple of approaches you can take. It’s needless to say it completely depends on how your server is serving the chunks for HLS.

  1. Use URLSession to create a custom request with any headers you desire, save the response to a file, and pass the file URL to AVPlayer.
  2. Pass needed tokens and stuff in the URL itself as query parameters.
  3. Use AVURLAsset in combination with AVAssetResourceLoader to customize the request AVPlayer sends.