<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Playing Audio Files using the iPhone SDK</title>
	<atom:link href="http://9mmedia.com/blog/?feed=rss2&#038;p=308" rel="self" type="application/rss+xml" />
	<link>http://9mmedia.com/blog/?p=308</link>
	<description>Flex / Actionscript  / Java</description>
	<lastBuildDate>Fri, 03 Sep 2010 15:41:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Lance Drake</title>
		<link>http://9mmedia.com/blog/?p=308&#038;cpage=1#comment-41989</link>
		<dc:creator>Lance Drake</dc:creator>
		<pubDate>Wed, 28 Jul 2010 22:50:22 +0000</pubDate>
		<guid isPermaLink="false">http://9mmedia.com/blog/?p=308#comment-41989</guid>
		<description>Very nicely done - VERY helpful - thank you so much.
The &quot;SpeakHere&quot; sample code from Apple is a big help, as well - but, funny enough, it doesn&#039;t deal with application-contained sounds, just new ones created after being recorded at runtime via the app itself.</description>
		<content:encoded><![CDATA[<p>Very nicely done &#8211; VERY helpful &#8211; thank you so much.<br />
The &#8220;SpeakHere&#8221; sample code from Apple is a big help, as well &#8211; but, funny enough, it doesn&#8217;t deal with application-contained sounds, just new ones created after being recorded at runtime via the app itself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ankush</title>
		<link>http://9mmedia.com/blog/?p=308&#038;cpage=1#comment-31846</link>
		<dc:creator>Ankush</dc:creator>
		<pubDate>Wed, 14 Apr 2010 17:58:07 +0000</pubDate>
		<guid isPermaLink="false">http://9mmedia.com/blog/?p=308#comment-31846</guid>
		<description>Hi,This is fer playing the video thats already in the iphone. but please help me out if i wan to play it from any link.i.e from server.</description>
		<content:encoded><![CDATA[<p>Hi,This is fer playing the video thats already in the iphone. but please help me out if i wan to play it from any link.i.e from server.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Umaid</title>
		<link>http://9mmedia.com/blog/?p=308&#038;cpage=1#comment-24923</link>
		<dc:creator>Umaid</dc:creator>
		<pubDate>Fri, 05 Mar 2010 10:42:48 +0000</pubDate>
		<guid isPermaLink="false">http://9mmedia.com/blog/?p=308#comment-24923</guid>
		<description>I have implemented my sound stop and play through other method, it is working fine, on same view, but when I navigate to different view and return to same view to stop the sound so it won&#039;t stop and continuosly playing. I am enclosing my code as below. Please help me where I am lacking.

-(IBAction)Play:(UIButton *)sender
{

	NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
	

//	NSString *myLastPlay = [def objectForKey:@&quot;myLastPlay&quot;];
	if([lastindexbtn tag] == [sender tag])
	{
		if([self.playstop isEqualToString:@&quot;play&quot;])
		{
			//Stop

		[sender setImage:[UIImage imageNamed:@&quot;playbtn.png&quot;] forState:UIControlStateNormal];
			
			NSLog(@&quot;Player stop at time %f&quot;, myExampleSound.currentTime);
			[myExampleSound pause];
			//[myExampleSound stop];
			self.playstop = @&quot;stop&quot;;
		}
		else if([self.playstop isEqualToString:@&quot;stop&quot;])
		{
			//play
						//[myExampleSound stop];
			[sender setImage:[UIImage imageNamed:@&quot;stop.png&quot;] forState:UIControlStateNormal];					

			NSString *playme = [NSString stringWithFormat:@&quot;%d&quot;,[sender tag]];
			//this variable can be named differently
			
			NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:playme ofType:@&quot;mp3&quot;]; // *Music filename* is the name of the file that you want to play.  BE SURE that you type the correct characters as the system is case-sensitive.  It caused a crash for me...  Very painful.
			
			myExampleSound =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:nil];
//			NSLog(@&quot;%f&quot;,myExampleSound.duration);
			myExampleSound.delegate = self;
			
			//[myExampleSound prepareToPlay];
			  [myExampleSound play];
			self.playstop = @&quot;play&quot;;
			
			[def setObject:[NSString stringWithFormat:@&quot;%d&quot;,[sender tag]-1] forKey:@&quot;myLastPlay&quot;];
		}
	}
	   else
	   {
			//[myExampleSound stop];
		   [lastindexbtn setImage:[UIImage imageNamed:@&quot;playbtn.png&quot;] forState:UIControlStateNormal];
		   [sender setImage:[UIImage imageNamed:@&quot;stop.png&quot;] forState:UIControlStateNormal];
		   
		   NSString *playme = [NSString stringWithFormat:@&quot;%d&quot;,[sender tag]];
		   //this variable can be named differently
		   
		   NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:playme ofType:@&quot;mp3&quot;]; // *Music filename* is the name of the file that you want to play.  BE SURE that you type the correct characters as the system is case-sensitive.  It caused a crash for me...  Very painful.
		   
		   myExampleSound =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:nil];
		 //  NSLog(@&quot;%f&quot;,myExampleSound.duration);
		   myExampleSound.delegate = self;
		   
		   //[myExampleSound prepareToPlay];
		   
		   [myExampleSound play];
		   self.playstop = @&quot;play&quot;;
		   		[def setObject:[NSString stringWithFormat:@&quot;%d&quot;,[sender tag]-1] forKey:@&quot;myLastPlay&quot;];
	   }
	//[myExampleSound stop];
	
//	myExampleSound.numberOfLoops = 10; /* can be as many times as needed by the application   -    myExampleSound.numberOfLoops = -1; &gt;&gt; this will allow the file to play an infinite number of times  */
	
	lastindexbtn =  sender;
	//[def setObject:lastindexbtn forKey:@&quot;LastObj&quot;];
	
	
	
}</description>
		<content:encoded><![CDATA[<p>I have implemented my sound stop and play through other method, it is working fine, on same view, but when I navigate to different view and return to same view to stop the sound so it won&#8217;t stop and continuosly playing. I am enclosing my code as below. Please help me where I am lacking.</p>
<p>-(IBAction)Play:(UIButton *)sender<br />
{</p>
<p>	NSUserDefaults *def = [NSUserDefaults standardUserDefaults];</p>
<p>//	NSString *myLastPlay = [def objectForKey:@"myLastPlay"];<br />
	if([lastindexbtn tag] == [sender tag])<br />
	{<br />
		if([self.playstop isEqualToString:@"play"])<br />
		{<br />
			//Stop</p>
<p>		[sender setImage:[UIImage imageNamed:@"playbtn.png"] forState:UIControlStateNormal];</p>
<p>			NSLog(@&#8221;Player stop at time %f&#8221;, myExampleSound.currentTime);<br />
			[myExampleSound pause];<br />
			//[myExampleSound stop];<br />
			self.playstop = @&#8221;stop&#8221;;<br />
		}<br />
		else if([self.playstop isEqualToString:@"stop"])<br />
		{<br />
			//play<br />
						//[myExampleSound stop];<br />
			[sender setImage:[UIImage imageNamed:@"stop.png"] forState:UIControlStateNormal];					</p>
<p>			NSString *playme = [NSString stringWithFormat:@"%d",[sender tag]];<br />
			//this variable can be named differently</p>
<p>			NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:playme ofType:@&#8221;mp3&#8243;]; // *Music filename* is the name of the file that you want to play.  BE SURE that you type the correct characters as the system is case-sensitive.  It caused a crash for me&#8230;  Very painful.</p>
<p>			myExampleSound =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:nil];<br />
//			NSLog(@&#8221;%f&#8221;,myExampleSound.duration);<br />
			myExampleSound.delegate = self;</p>
<p>			//[myExampleSound prepareToPlay];<br />
			  [myExampleSound play];<br />
			self.playstop = @&#8221;play&#8221;;</p>
<p>			[def setObject:[NSString stringWithFormat:@"%d",[sender tag]-1] forKey:@&#8221;myLastPlay&#8221;];<br />
		}<br />
	}<br />
	   else<br />
	   {<br />
			//[myExampleSound stop];<br />
		   [lastindexbtn setImage:[UIImage imageNamed:@"playbtn.png"] forState:UIControlStateNormal];<br />
		   [sender setImage:[UIImage imageNamed:@"stop.png"] forState:UIControlStateNormal];</p>
<p>		   NSString *playme = [NSString stringWithFormat:@"%d",[sender tag]];<br />
		   //this variable can be named differently</p>
<p>		   NSString *myExamplePath = [[NSBundle mainBundle] pathForResource:playme ofType:@&#8221;mp3&#8243;]; // *Music filename* is the name of the file that you want to play.  BE SURE that you type the correct characters as the system is case-sensitive.  It caused a crash for me&#8230;  Very painful.</p>
<p>		   myExampleSound =[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:myExamplePath] error:nil];<br />
		 //  NSLog(@&#8221;%f&#8221;,myExampleSound.duration);<br />
		   myExampleSound.delegate = self;</p>
<p>		   //[myExampleSound prepareToPlay];</p>
<p>		   [myExampleSound play];<br />
		   self.playstop = @&#8221;play&#8221;;<br />
		   		[def setObject:[NSString stringWithFormat:@"%d",[sender tag]-1] forKey:@&#8221;myLastPlay&#8221;];<br />
	   }<br />
	//[myExampleSound stop];</p>
<p>//	myExampleSound.numberOfLoops = 10; /* can be as many times as needed by the application   &#8211;    myExampleSound.numberOfLoops = -1; &gt;&gt; this will allow the file to play an infinite number of times  */</p>
<p>	lastindexbtn =  sender;<br />
	//[def setObject:lastindexbtn forKey:@"LastObj"];</p>
<p>}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://9mmedia.com/blog/?p=308&#038;cpage=1#comment-20364</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Fri, 29 Jan 2010 17:12:27 +0000</pubDate>
		<guid isPermaLink="false">http://9mmedia.com/blog/?p=308#comment-20364</guid>
		<description>How do you just use one button to toggle between play/stop?
I have just tried an if in the IBACtion button to see if (myAudio isPlaying =!  YES) then Play, Else myAudio stop.
Is there a way to do this just off one button?
Thank,s
Mark</description>
		<content:encoded><![CDATA[<p>How do you just use one button to toggle between play/stop?<br />
I have just tried an if in the IBACtion button to see if (myAudio isPlaying =!  YES) then Play, Else myAudio stop.<br />
Is there a way to do this just off one button?<br />
Thank,s<br />
Mark</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: TC</title>
		<link>http://9mmedia.com/blog/?p=308&#038;cpage=1#comment-17445</link>
		<dc:creator>TC</dc:creator>
		<pubDate>Sat, 26 Dec 2009 18:42:31 +0000</pubDate>
		<guid isPermaLink="false">http://9mmedia.com/blog/?p=308#comment-17445</guid>
		<description>Hi jeff,

I am unable to log in to the svn links above when leaving both the username and password fields empty.  I&#039;m using Safari - does that matter?</description>
		<content:encoded><![CDATA[<p>Hi jeff,</p>
<p>I am unable to log in to the svn links above when leaving both the username and password fields empty.  I&#8217;m using Safari &#8211; does that matter?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
