Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 22.214.171.124 release ready!
Updated 28 May 2021
In today’s blog we will know how we can play a video in swift
This is the easiest way to play video in swift,
You can play a video from url or you can play a video from your project
Let’s code to play a video in your project
You need to create an Xcode project
Create a button to play video in the main.storyboard
Add a video in your project or you can play video from url
Lets’s move to view controller
Add AVFoundation fremwork in you controller
let’s know more about AVFoundation
AVFoundation is the full featured framework for working with time-based audiovisual media on iOS, macOS, watchOS and tvOS. Using AVFoundation, you can easily play, create, and edit QuickTime movies and MPEG-4 files, play HLS streams, and build powerful media functionality into your apps.
We need to add the property of the AVFoundation
Create a function and add the video player in the your view controller
Call the above function from the button
You can do what you want to do after video ended.
Now you can run the above code and you can now play video in your project
Thanks for reading 🙂
Hope this blog helped you with a better understanding of how to use AVAudioPlayer.
For more blogs please visit here.
For more information regarding the AVFoundation please click here.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.