Я пытаюсь воспроизвести видео из моего приложения iOS при нажатии кнопки, но мне было интересно, как и где я могу разместить свое видео (бесплатно), чтобы я мог воспроизвести видео в AVPlayer, используя URL-адрес , Я попытался разместить видео на YouTube и установить URL-адрес AVPlayer для URL-адреса видео YouTube, но проигрыватель загружается вечно. Я включил свой код, он функционален, мне просто нужно знать, где я могу загрузить свое видео, чтобы получить правильный URL.
@IBAction func didTapPlayButton(_ sender: UIButton) {
guard let url = URL(string: "") else {
return
}
// Create an AVPlayer, passing it the HTTP Live Streaming URL.
let player = AVPlayer(url: url)
// Create a new AVPlayerViewController and pass it a reference to the player.
let controller = AVPlayerViewController()
controller.player = player
// Modally present the player and call the player's play() method when complete.
present(controller, animated: true) {
player.play()
}
}