Creating a Simple Iphone Movie Player

Posted: July 24, 2009 in iOS Development
Tags: , ,

To do anything in Iphone SDK development the 1st step is to find
the right framework you’ll be using!

There are two simple ways to play a video on your device.

1 – Play a Video which is locally available.
2 – Play a Video from an URL.

For both the things you need to use MediaPlayer framework.

Here are the steps you need to follow to build the application.

* Create a view based application on your Xcode.

* Expand Targets and select your project. Type ‘Command + I’
to bring the info window. You can add the MediaPlayer framework
there. (By default it’s not included)

* Import <MediaPlayer/MediaPlayer.h> in the header file of your

* Change your header file like this, you need to have a ‘Play’
button that plays the video. And link the button’s “Touch Up
Inside” event to the playVideo: action.

* Once both the header and view in the InterfaceBuilder is
ready you can write the implementation part in “.m” file

* MPMoviePlayerController work with a single designated initializer,
initWitContenthURL:. It either takes a file:// or a network URL (http://)

* You can add a Video that you want to play on project “Resources”

* Coming back to the playVideo action you just need to invoke the
play method on moviePlayer object.

* For more reference check Apple’s Iphone development reference library.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s