WepsTech
The world of development
Hey Guys, Welcome to the world for exciting learning and sort trick of the development. In this tutorial I will let you know that how you can play video in iOS. And another question is also related with it. How to to video streaming in iOS with swift programming language.
So, Guys as everyone knows that, Playing video is itself a big word. And I think I am quite sure that, You are a professional developer. And you are looking very sort trick for playing the videos in iPhone with swift language.
So, Let’s start with programming. The very first thing which you need to know that. For processing any network request you need to add some line of code in your Info.plist.
Information Property List App Transport Security Settings - Dictionary Allow Arbitrary Loads - Boolean - YES
Wonderful! Above all, is normal version of Info.plist. And below is SourceCode version of Info.plist.
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
Now, You are very close to play the videos. So let’s write the last line of codes for playing the videos.
import AVKit import AVFoundation @IBAction func btn_start(_ sender: Any) { guard let url = URL(string: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")else {return} let player = AVPlayer(url: url) var playerController = AVPlayerViewController() playerController.player = player playerController.allowsPictureInPicturePlayback = true playerController.player?.play() self.present(playerController, animated: true, completion: nil) }
Great πππππβΊοΈ
In Conclusion, It was a very sort trick for playing the videos. You can also add delegate to this playerController. For delegate arrangement you can click here. In addition, few more important link which can help you become a smart developer. And for your kind information I would like to tell you that here is one video for JSON Parsing.
Jamesfup
Appreciate it for sharing this nice webpage.