Several options available for the confusing for newcomers the ios API for recording and playing videos. Play a video stored locally on our device which allows for media player framework from a remote location. Advanced features for track management, media editing to AV Foundation framework and covering the framework. To display videos for two main classes of framework Media Player you should use the MPMoviePlayerController for displaying a video. MPMoviePlayerController, playback occurs in a view owned by the movie player. To present a simple view controller for displaying full-screen movies the MPMoviePlayerViewController class is designed Get more info ios online course.
Demo APP Overview:
The demo application is extremely straightforward without favor UI. Once opened, the application shows a screen with a solitary “Catch” catch. When you tap the catch, it’ll raise the camcorder for video recording. Once completed the chronicle, the video is naturally appeared in the primary screen. Clients are permitted to play back the video inline.
Making Xcode Project:
Open Xcode and make another Project, pick the Single View Application layout. Name the venture as VideoApp and set the class prefix as Video. Snap alongside make and spare the venture read more at ios online course.
Planning User Interface
Go to the Main. Story board. Include a catch and place it at the base of the screen focused. Change its title to “Catch”. Once more, the following activity is to build up an association between the Capture catch and code. Keeping in mind the end goal to do that, change to the Assistant Editor mode. Make an activity strategy in the VideoViewController.h for the Capture catch. Name the technique as “captureVideo”.
Executing the VideoViewController
We utilize the UIImagePickerController class to take static photograph. A similar class is additionally proficient to catch video. In case you’re not distracted, you should at present recall how to utilize UIImagePickerController.
Over that, we’ll include two properties in the VideoViewController.h. The video URL property stores the URL of the present video, while the video Controller property is devoted for video play back. On the off chance that you did everything accurately, your VideoViewController.h document
Executing Picker Controller for Video Recording
At the point when the client taps the “Catch” catch, the capture Video: technique is called. This strategy is capable to make, arrange and show the picture picker for video recording. We’ll actualize the strategy.
Executing Video Playback
When client gets done with recording and affirm to spare the video, the application will consequently play back the video in the primary screen. Keeping in mind the end goal to actualize the video playback, there are a couple of things to be finished ios online course..:
- Get the framework URL of the video just caught
- Remove the UImage Picker Controller
- Play the video by utilizing the MP Movie Player Controller class, which is a worked in class for the playback of a video from a document.
As you probably are aware, they did Finish Picking Media with Info: technique will be called when client affirms to utilize the video. The record URL of the video is packaged in the data parameter. So in this strategy, we initially get the URL of the video besides, we reject the picker. Finally, we instantiate the MP Movie Player. Controller class and pass it with the video URL for playback. We likewise change the extent of the view to abandon some free space for the “Catch” catch. Lastly, we exhibit the view and play the video.
There is as yet one thing left. We should execute the image Picker Controller Did Cancel strategy. We specified this technique in the past part. The technique is summoned when client crosses out the video recording. For this situation, we just reject the picker.
Order and Test the App:
Alright, the time has come to gather and test our application. Like the Camera application we created in the past section, you can’t test it utilizing the inherent iPhone Simulator. You need to utilize a genuine gadget for the testing as the iPhone test system doesn’t have a camera such as ios online course.
In the event that you assemble and run the application on your iPhone, you ought to have the capacity to raise the camcorder interface in the wake of tapping the “Catch” catch.
Utilizing the Movie Player Notifications:
A decent component of the MP Movie Player Controller is that it has an accumulation of warnings that we can use to control the video playback. For instance, when the video has wrapped up, the MP Movie Player Playback Did Finish Notification will be sent. Add the accompanying code to the did Finish Picking Media with Info: strategy.