<?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/"
	>

<channel>
	<title>Random Fractals&#187; flex music player</title>
	<atom:link href="http://randomfractals.com/blog/flex/flex-music-player/feed/" rel="self" type="application/rss+xml" />
	<link>http://randomfractals.com/blog</link>
	<description></description>
	<lastBuildDate>Sat, 27 Mar 2010 13:57:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Flex MusicPlayer v.2 with MusicVisualizer</title>
		<link>http://randomfractals.com/blog/2009/01/15/flex-music-player-v2/</link>
		<comments>http://randomfractals.com/blog/2009/01/15/flex-music-player-v2/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 19:35:30 +0000</pubDate>
		<dc:creator>Taras</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[flex music player]]></category>
		<category><![CDATA[music visualizer]]></category>

		<guid isPermaLink="false">http://tarasnovak.com/blog/?p=511</guid>
		<description><![CDATA[I fixed some bugs and added new features to my Flex Music Player example.
New Features

- View Modes: Normal and Large. I plan to add Full Screen in v.3.
 &#8211; Skins menu with Obsidian and Jukebox player skins as a follow up example to my previous Flex application CSS skinning post
- MusicVisualizer container component that you [...]]]></description>
			<content:encoded><![CDATA[<p>I fixed some bugs and added new features to my <a href="http://tarasnovak.com/blog/2009/01/13/flex-music-player-example/">Flex Music Player example</a>.</p>
<p><strong>New Features</strong></p>
<ol>
<li>- View Modes: Normal and Large. I plan to add Full Screen in v.3.</li>
<li> &#8211; Skins menu with Obsidian and Jukebox player skins as a follow up example to my previous <a href="http://tarasnovak.com/blog/2009/01/12/how-to-add-multiple-ui-skins-to-your-flex-application-with-compiled-css-stylesheets/" target="_blank">Flex application CSS skinning post</a></li>
<li>- MusicVisualizer container component that you can use with or without my Music Player control</li>
<li>- Alternative SmoothSpectrum visualization created by <a href="http://www.bytearray.org/?p=9" target="_blank">Thibault Imbert</a></li>
</ol>
<p><strong>MusicPlayer v.2 with MusicVisualizer</strong></p>
<p>Here is <a href="http://www.tarasnovak.com/lab/FlexMusicPlayer/02/FlexMusicPlayer.html" target="_blank">Flex Music Player v.2</a> with Jukebox UI skin in Large view mode with Music Visualizer set to Smooth Spectrum, playing 15 Step:</p>
<p><a href="http://www.tarasnovak.com/lab/FlexMusicPlayer/02/FlexMusicPlayer.html" target="_blank"><img class="size-full wp-image-533 alignnone" title="Flex Music Player 2" src="http://tarasnovak.com/blog/wp-content/uploads/2009/01/flexmusicplayer2.jpg" alt="flexmusicplayer2" width="480" height="384" /></a></p>
<p><strong>Interacting with Music Visualizations</strong></p>
<p>Click on the visualization to swap it.</p>
<p>Move your mouse over music visualization to change colors.</p>
<p>You can also change MusicPlayer&#8217;s mini visualization in the bottom left corner to alternate between wave, line and bars. This one is from <a href="http://blog.benstucki.net/?id=18" target="_blank">Ben Stucki</a>.</p>
<p>The skin swap and view mode toggle buttons are located in the bottom right corner of the Music Player.</p>
<p><strong>Source Code Updates<br />
</strong></p>
<p><a href="http://www.tarasnovak.com/lab/FlexMusicPlayer/srcview/index.html">View source</a> and let me know if you run into problems or what new features you&#8217;d like to see added in v.3.</p>
<p>I refactored the original <a href="http://nocreativity.com/blog/visualizr-source" target="_blank">Visualizr</a> and <a href="http://www.bytearray.org/?p=9" target="_blank">Smooth Spectrum</a> code to tweak them for my needs and converted them to custom UIComponents for easy inclusion in Flex mxml views.</p>
<p>You can grab them individually or use my Music Visualizer component (com.randomFractals.media.controls.MusicVisualizer).</p>
<p>I also cleaned up my music player code (com.randomFractals.media.controls.MusicPlayer) and added comments.</p>
<p><strong>Usage Example</strong></p>
<p>Here is an example of embedding MusicVisualizer and MusicPlayer in your application:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span></span>
<span style="color: #000000;">	xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> </span>
<span style="color: #000000;">	xmlns:rf=<span style="color: #ff0000;">&quot;com.randomFractals.media.controls.*&quot;</span>	</span>
<span style="color: #000000;">	width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span> </span>
<span style="color: #000000;">	color=<span style="color: #ff0000;">&quot;#FFFFFF&quot;</span> backgroundAlpha=<span style="color: #ff0000;">&quot;0&quot;</span>  </span>
<span style="color: #000000;">	horizontalAlign=<span style="color: #ff0000;">&quot;center&quot;</span> </span>
<span style="color: #000000;">	verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span> </span>
<span style="color: #000000;">	creationComplete=<span style="color: #ff0000;">&quot;initPlayer(event);&quot;</span><span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- </span>
<span style="color: #000000;">... action script code from below...</span>
<span style="color: #000000;">--&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:VBox</span> id=<span style="color: #ff0000;">&quot;musicBox&quot;</span></span>
<span style="color: #000000;">        verticalGap=<span style="color: #ff0000;">&quot;0&quot;</span>   </span>
<span style="color: #000000;">        horizontalAlign=<span style="color: #ff0000;">&quot;center&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
     <span style="color: #000000;"><span style="color: #7400FF;">&lt;rf:MusicVisualizer</span> id=<span style="color: #ff0000;">&quot;musicVis&quot;</span>  </span>
<span style="color: #000000;">         width=<span style="color: #ff0000;">&quot;{musicPlayer.width}&quot;</span> height=<span style="color: #ff0000;">&quot;400&quot;</span></span>
<span style="color: #000000;">         backgroundColor=<span style="color: #ff0000;">&quot;#212121&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
     <span style="color: #000000;"><span style="color: #7400FF;">&lt;rf:MusicPlayer</span> id=<span style="color: #ff0000;">&quot;musicPlayer&quot;</span></span>
<span style="color: #000000;">resize=<span style="color: #ff0000;">&quot;{musicVis.height = (musicPlayer.width - musicPlayer.width/3)}&quot;</span> </span>
<span style="color: #000000;">         width=<span style="color: #ff0000;">&quot;422&quot;</span> height=<span style="color: #ff0000;">&quot;110&quot;</span> autoPlay=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:VBox</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>The AS code to initialize MusicPlayer and  load sample tracks is very simple, thanks to the <a href="http://playr.nocreativity.com/" target="_blank">Playr</a> control library:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;">            
            <span style="color: #0033ff; font-weight: bold;">import</span> com.nocreativity.playr.<span style="color: #000000; font-weight: bold;">*</span>;
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> playList<span style="color: #000000; font-weight: bold;">:</span>PlaylistManager;
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> initPlayer<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #009900;">// create a sample playlist</span>
                playList = <span style="color: #0033ff; font-weight: bold;">new</span> PlaylistManager<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
&nbsp;
                <span style="color: #009900;">// add sample tracks</span>
                playList.addTrack<span style="color: #000000;">&#40;</span>
                    createTrack<span style="color: #000000;">&#40;</span><span style="color: #990000;">'Radiohead'</span>,
                        <span style="color: #990000;">'In Rainbows'</span>,
                        <span style="color: #990000;">'15 Step'</span>,
                        <span style="color: #990000;">'assets/music/15_Step.mp3'</span>, <span style="color: #000000; font-weight:bold;">228</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span>;
&nbsp;
                <span style="color: #009900;">// add more tracks here</span>
&nbsp;
                <span style="color: #009900;">// load playlist</span>
                musicPlayer.playlist = playList;
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> createTrack<span style="color: #000000;">&#40;</span><span style="color: #004993;">artist</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>, <span style="color: #004993;">album</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>,
                title<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>, file<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>, <span style="color: #004993;">seconds</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span>PlayrTrack
            <span style="color: #000000;">&#123;</span>
                <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">track</span><span style="color: #000000; font-weight: bold;">:</span>PlayrTrack = <span style="color: #0033ff; font-weight: bold;">new</span> PlayrTrack<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                <span style="color: #004993;">track</span>.<span style="color: #004993;">artist</span> = <span style="color: #004993;">artist</span>;
                <span style="color: #004993;">track</span>.<span style="color: #004993;">album</span> = <span style="color: #004993;">album</span>;
                <span style="color: #004993;">track</span>.title = title;
                <span style="color: #004993;">track</span>.file = file;
                <span style="color: #004993;">track</span>.totalSeconds = <span style="color: #004993;">seconds</span>;
                <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #004993;">track</span>;
            <span style="color: #000000;">&#125;</span></pre></div></div>

<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://randomfractals.com/blog/2009/01/13/flex-music-player-example/" title="Flex Music Player Example">Flex Music Player Example</a></li><li><a href="http://randomfractals.com/blog/2008/10/10/simple-flex-music-player/" title="Simple Flex Music Player">Simple Flex Music Player</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://randomfractals.com/blog/2009/01/15/flex-music-player-v2/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Flex Music Player Example</title>
		<link>http://randomfractals.com/blog/2009/01/13/flex-music-player-example/</link>
		<comments>http://randomfractals.com/blog/2009/01/13/flex-music-player-example/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 15:07:44 +0000</pubDate>
		<dc:creator>Taras</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[flex music player]]></category>
		<category><![CDATA[music visualization]]></category>

		<guid isPermaLink="false">http://tarasnovak.com/blog/?p=478</guid>
		<description><![CDATA[After analyzing my blog stats, I&#8217;ve discovered to my surprise that I get the most direct hits from Google search for a simple Flex music player example.
If you are still looking for one, see my new Flex Music Player:

I added support for multiple tracks with the Prev./Next track buttons and a couple of sample tracks, [...]]]></description>
			<content:encoded><![CDATA[<p>After analyzing my blog stats, I&#8217;ve discovered to my surprise that I get the most direct hits from Google search for a <a href="http://tarasnovak.com/blog/2008/10/10/simple-flex-music-player/">simple Flex music player</a> example.</p>
<p>If you are still looking for one, see my new <a href="http://www.tarasnovak.com/lab/FlexMusicPlayer/FlexMusicPlayer.html" target="_blank">Flex Music Player</a>:</p>
<p><a href="http://www.tarasnovak.com/lab/FlexMusicPlayer/FlexMusicPlayer.html" target="_blank"><img class="alignnone size-full wp-image-488" title="click to launch player" src="http://tarasnovak.com/blog/wp-content/uploads/2009/01/flexmusicplayer.png" alt="flexmusicplayer" width="420" height="419" /></a></p>
<p>I added support for multiple tracks with the Prev./Next track buttons and a couple of sample tracks, enabled track scrubbing (just click on the track), replaced the playback component with the <a rel="nofollow" href="http://playr.nocreativity.com/" target="_blank">Playr</a>, and added the music <a rel="nofollow" href="http://nocreativity.com/blog/visualizr-source" target="_blank">Visualizr</a> from <a rel="nofollow" href="http://nocreativity.com/blog/" target="_blank">Ronny Welter</a>. <a href="http://www.tarasnovak.com/lab/FlexMusicPlayer/srcview/index.html" target="_blank">View source</a> is enabled on this one, although it&#8217;s a little messy, but should give you a good head start.</p>
<p>I am planning to do a more extensive example with playlist management provided by the <a href="http://playr.nocreativity.com/">Playr</a>, cleaned-up source code, and a sample of pulling music from <a rel="nofollow" href="http://www.last.fm" target="_blank">last.fm</a> soon.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://randomfractals.com/blog/2010/03/04/some-degrafa-love/" title="Some Degrafa Love">Some Degrafa Love</a></li><li><a href="http://randomfractals.com/blog/2009/01/15/flex-music-player-v2/" title="Flex MusicPlayer v.2 with MusicVisualizer">Flex MusicPlayer v.2 with MusicVisualizer</a></li><li><a href="http://randomfractals.com/blog/2008/10/10/simple-flex-music-player/" title="Simple Flex Music Player">Simple Flex Music Player</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://randomfractals.com/blog/2009/01/13/flex-music-player-example/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple Flex Music Player</title>
		<link>http://randomfractals.com/blog/2008/10/10/simple-flex-music-player/</link>
		<comments>http://randomfractals.com/blog/2008/10/10/simple-flex-music-player/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 18:53:55 +0000</pubDate>
		<dc:creator>Taras</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[flex music player]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[player]]></category>
		<category><![CDATA[simple]]></category>

		<guid isPermaLink="false">http://tarasnovak.wordpress.com/?p=5</guid>
		<description><![CDATA[It&#8217;s been a while since my first post. I parted with Pathfinder Dev a few weeks ago, switched this blog to self-hosting, and currently looking for new opportunities.
While I am looking for a new gig, I&#8217;ll try to revive this blog by remixing and publishing some old toys I&#8217;ve prototyped to get my Flex chops [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since my first post. I parted with Pathfinder Dev a few weeks ago, switched this blog to self-hosting, and currently looking for new opportunities.</p>
<p>While I am looking for a new gig, I&#8217;ll try to revive this blog by remixing and publishing some old toys I&#8217;ve prototyped to get my Flex chops together.</p>
<p>Here is the one that did not make the cut for that internal AIR Flair presentation. I had to play that jungle <a title="Bamboo Banga by M.I.A." href="http://www.youtube.com/watch?v=4OPRkMAM1fA" target="_blank">Bamboo Banga</a> beat in WMP11.</p>
<p style="text-align: center;">(Click on the image to play and download sample code)</p>
<p style="text-align: center;"><a title="Simple Flex Music Player" href="http://www.tarasnovak.com/lab/SimpleMusicPlayer/SimpleMusicPlayer.html" target="_blank"><img class="size-full wp-image-15 aligncenter" title="Simple Flex Music Player" src="http://tarasnovak.com/blog/wp-content/uploads/2008/10/simplemusicplayer.jpg" alt="" width="405" height="106" /></a></p>
<p>That&#8217;s my take on simple mp3 player in Flex. Click on that visualization to see some bars jump.</p>
<p>Most of the heavy lifting is done by the components from the flex community listed below.</p>
<p><span id="more-4"></span> <strong>Under the hood:</strong></p>
<p><a title="Obsidian Flex UI Skin Explorer" href="http://www.scalenine.com/themes/obsidian/obsidian.html" target="_blank">Obsidian Flex UI</a> skin from <a title="ScaleNine Skins Gallery" href="http://www.scalenine.com/gallery/gallery-2.php" target="_blank">scalenine.com gallery</a> to give this player some polished look and feel.</p>
<p><a title="MP3Player" href="http://labs.flexcoders.nl/samples/MP3Player/version003/srcview/index.html" target="_blank">nl.fxc.controls.MP3Player.as</a> class from <a href="http://labs.flexcoders.nl/" target="_blank">labs.flexcoders.nl</a> for the audio playback control with minor changes to expose some properties and events to the main view controls. Why reinvent the wheel :)</p>
<p>Music Visualization is provided by the excellent <a title="Free Audio Visualization Component" href="http://blog.benstucki.net/?id=18" target="_blank">Audio Visualization component by Ben Stucki</a>.</p>
<p>I created the main mxml view, layout and custom icons. All in all about two pages of code and a couple of days to prototype it and publish.</p>
<p>Now, this music player is intentionally very basic and only plays one sample.mp3 track from the /assets/music folder.</p>
<p>If you are looking for a more versatile Flex music player that&#8217;s scriptable and supports playlists, I&#8217;d suggest you grab the latest <a href="http://code.google.com/p/xmlmp3player/" target="_blank">Flex xml mp3 player</a> which is an excellent port of the well known <a href="http://musicplayer.sourceforge.net/" target="_blank">XSPF Web Music Player</a> to Flex.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://randomfractals.com/blog/2009/01/15/flex-music-player-v2/" title="Flex MusicPlayer v.2 with MusicVisualizer">Flex MusicPlayer v.2 with MusicVisualizer</a></li><li><a href="http://randomfractals.com/blog/2009/01/13/flex-music-player-example/" title="Flex Music Player Example">Flex Music Player Example</a></li><li><a href="http://randomfractals.com/blog/2008/10/16/perlin-noise-music-vis/" title="Perlin Noise Music Vis">Perlin Noise Music Vis</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://randomfractals.com/blog/2008/10/10/simple-flex-music-player/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

