<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Get Set Games &#187; MPMoviePlayerController</title>
	<atom:link href="http://getsetgames.com/tag/mpmovieplayercontroller/feed/" rel="self" type="application/rss+xml" />
	<link>http://getsetgames.com</link>
	<description></description>
	<lastBuildDate>Sat, 28 Apr 2012 16:58:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/><cloud domain='getsetgames.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<link rel="http://api.friendfeed.com/2008/03#sup" xmlns="http://www.w3.org/2005/Atom" type="application/json" href="http://friendfeed.com/api/public-sup.json#5c973c50be"/>		<item>
		<title>How to Play a Video With MPMoviePlayerController</title>
		<link>http://getsetgames.com/2009/12/20/iphonedev-advent-tip-20-how-to-play-a-video-with-mpmovieplayercontroller/</link>
		<comments>http://getsetgames.com/2009/12/20/iphonedev-advent-tip-20-how-to-play-a-video-with-mpmovieplayercontroller/#comments</comments>
		<pubDate>Sun, 20 Dec 2009 21:27:32 +0000</pubDate>
		<dc:creator>Derek van Vliet</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[advent]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[MPMoviePlayerController]]></category>
		<category><![CDATA[objective-c]]></category>

		<guid isPermaLink="false">http://getsetgames.com/?p=1022</guid>
		<description><![CDATA[Splash screens, cutscenes, tutorials or just good old content. There are plenty of reasons to need to play a video in your iPhone app. Here&#8217;s how to do it in [...]]]></description>
			<content:encoded><![CDATA[<p>Splash screens, cutscenes, tutorials or just good old content. There are plenty of reasons to need to play a video in your iPhone app. Here&#8217;s how to do it in 3 simple steps:</p>
<p>1. Add the MediaPlayer framework to your target.</p>
<p>2. Import the MediaPlayer header file in the file you intend to begin playing the video in, like so:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#import &lt;MediaPlayer/MediaPlayer.h&gt;</span></pre></div></div>

<p>3a. Now we can stream a video from the internet like so:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSURL</span> <span style="color: #002200;">*</span>url <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURL</span> URLWithString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://www.example.com/myvideo.m4v&quot;</span><span style="color: #002200;">&#93;</span>;
MPMoviePlayerController <span style="color: #002200;">*</span>player <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>MPMoviePlayerController alloc<span style="color: #002200;">&#93;</span> initWithContentURL<span style="color: #002200;">:</span>url<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>player play<span style="color: #002200;">&#93;</span>;</pre></div></div>

<p>3b. Alternately, we can stream a video that you include in your app bundle. To stream a file called <em>myvideo.m4v</em>, you would run the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="objc" style="font-family:monospace;"><span style="color: #400080;">NSString</span> <span style="color: #002200;">*</span>path <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #400080;">NSBundle</span> mainBundle<span style="color: #002200;">&#93;</span> pathForResource<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;myvideo&quot;</span> ofType<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;m4v&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #400080;">NSURL</span> <span style="color: #002200;">*</span>url <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #400080;">NSURL</span> fileURLWithPath<span style="color: #002200;">:</span>path<span style="color: #002200;">&#93;</span>;
&nbsp;
MPMoviePlayerController <span style="color: #002200;">*</span>player <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>MPMoviePlayerController alloc<span style="color: #002200;">&#93;</span> initWithContentURL<span style="color: #002200;">:</span>url<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>player play<span style="color: #002200;">&#93;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://getsetgames.com/2009/12/20/iphonedev-advent-tip-20-how-to-play-a-video-with-mpmovieplayercontroller/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
	</item>
	</channel>
</rss>

