I am trying to play a network audio live stream from our radio station. I followed a tutorial and managed to get it to work, but it plays as if it's a video. I would like to make my own controls (e.g., the user pushes play and a pause button) instead of it opening up a whole new view as if it's a video.
https://i.ibb.co/2PhyYkt/IMG-3189.png https://i.ibb.co/9T3QbYp/IMG-3190.png
import UIKit
import AVFoundation
import AVKit
var streamController = AVPlayerViewController()
var streamPlayer: AVPlayer?
let streamVideoURL: NSURL? = NSURL(string: "http://dvstream2.bgsu.edu:8000/wbgu")
streamPlayer = AVPlayer(url: streamVideoURL! as URL)
streamController.player = streamPlayer
@IBAction func playBtnTapped(_ sender: Any) {
self.present(self.streamController, animated: true, completion: {
self.streamController.player?.play()
})
}
I would just like this audio stream to play when the user taps the play button, and pause when they tap the pause button, not open a new view that shows as if it's a video.