Check out example codes for "swift play audio stream from url". It will help you in understanding the concepts better.

Code Example 1

func loadRadio(radioURL: String) {

        guard let url = URL.init(string: radioURL) else { return }
        let playerItem = AVPlayerItem.init(url: url)
        player = AVPlayer.init(playerItem: playerItem)
        player?.play()
        startNowPlayingAnimation(true)
        played = true
    }

Learn ReactJs, React Native from akashmittal.com