Skip to content

Instantly share code, notes, and snippets.

@RealEmmettS
Created March 16, 2022 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RealEmmettS/22a4cb24790a67637a16c8f7a147a255 to your computer and use it in GitHub Desktop.
Save RealEmmettS/22a4cb24790a67637a16c8f7a147a255 to your computer and use it in GitHub Desktop.
private func playVideo() {
guard let path = Bundle.main.path(forResource: "video", ofType:"m4v") else {
debugPrint("video.m4v not found")
return
}
let player = AVPlayer(url: URL(fileURLWithPath: path))
let playerController = AVPlayerViewController()
playerController.player = player
present(playerController, animated: true) {
player.play()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment