<?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>anilmakhijani.com &#187; Tutorial</title>
	<atom:link href="http://anilmakhijani.com/tag/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://anilmakhijani.com</link>
	<description></description>
	<lastBuildDate>Mon, 06 Jun 2011 17:19:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Quick Introduction to Flow Player</title>
		<link>http://anilmakhijani.com/2008/11/28/quick-introduction-to-flow-player/</link>
		<comments>http://anilmakhijani.com/2008/11/28/quick-introduction-to-flow-player/#comments</comments>
		<pubDate>Fri, 28 Nov 2008 19:10:58 +0000</pubDate>
		<dc:creator>Anil</dc:creator>
				<category><![CDATA[Flow Player]]></category>
		<category><![CDATA[FlowPlayer]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://anilmakhijani.com/?p=105</guid>
		<description><![CDATA[At TOPP we have been considering switching Streetfilms over to using FlowPlayer. There are number of advantages to using FlowPlayer: It is released under a GPL3 license. It has a neat new jQuery interface. As I learn more about the advanced features of FlowPlayer I will blog about them, but here is a quick introduction. [...]]]></description>
			<content:encoded><![CDATA[<p>At <a href="http://topp.openplans.org">TOPP</a> we have been considering switching <a href="http://www.streetfilms.org">Streetfilms</a> over to using <a href="http://www.flowplayer.org">FlowPlayer</a>.  There are number of advantages to using FlowPlayer:</p>
<ol>
<li>It is released under a GPL3 license.</li>
<li>It has a neat new jQuery interface.</li>
</ol>
<p>As I learn more about the advanced features of FlowPlayer I will blog about them, but here is a quick introduction.</p>
<p><span id="more-105"></span></p>
<p>If you create a page with markup like this one (see this in action <a title="Demo 1" href="http://demos.anilmakhijani.com/flow_demo/index.html.2" target="_blank">here</a>):</p>
<pre>&lt;html&gt;
  &lt;body&gt;
    &lt;h2&gt;Anil Tube&lt;/h2&gt;
    &lt;div class="player"&gt;
       &lt;a href="http://www.streetfilms.org/wp-content/uploads/2008/01/chicanefinal16x9.flv"&gt;
            &lt;img src="chicaneposter.jpg" /&gt;
       &lt;/a&gt;
    &lt;/div&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;div class="player"&gt;
      &lt;a href="http://www.streetfilms.org/wp-content/uploads/2008/11/jan-gehl-with-aaron_768k.flv"&gt;
          &lt;img src="gehl-and-aaron-poster1.jpg" /&gt;
      &lt;/a&gt;
    &lt;/div&gt;

  &lt;/body&gt;
&lt;/html&gt;</pre>
<p>
You can make these FLV files playable with the following code (see this in action <a href="http://demos.anilmakhijani.com/flow_demo/index.html.3">here</a>):
</p>
<pre>&lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript" src="http://anilmakhijani.com/flow_test/jquery-1.2.6.js"&gt;
  &lt;/script&gt;
  &lt;script type="text/javascript" src="http://anilmakhijani.com/flow_test/flowplayer-3.0.0.min.js"&gt;
  &lt;/script&gt;
  &lt;script type="text/javascript"&gt;
        $(document).ready( function () {
           $("div.player").each( function () {
                        var link = $(this).find("a");
                        var flv_file = link.attr("href");
                        var img_file = link.find("img").attr("src");
                        $(this).empty().flowplayer({src: "flowplayer-3.0.0.swf", width:560,
                                                                height:459}, {
                                playlist: [
                                    {
                                        url: img_file,
                                        scaling: 'fit'
                                    },
                                    {
                                        url : flv_file,
                                        autoPlay: false,
                                        scaling: 'fit'
                                    }
                                ]
                            });  //end the flowplayer command
                }); //ends the div.player.each

         }); //end the jquery document.ready
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h2&gt;Anil Tube&lt;/h2&gt;
    &lt;div class="player"&gt;
       &lt;a href="http://www.streetfilms.org/wp-content/uploads/2008/01/chicanefinal16x9.flv"&gt;
           &lt;img src="chicaneposter.jpg" /&gt;
       &lt;/a&gt;
    &lt;/div&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;div class="player"&gt;
      &lt;a href="http://www.streetfilms.org/wp-content/uploads/2008/11/jan-gehl-with-aaron_768k.flv"&gt;
         &lt;img src="gehl-and-aaron-poster1.jpg" /&gt;
      &lt;/a&gt;
    &lt;/div&gt;                                                                                                                   

  &lt;/body&gt;
&lt;/html&gt;</pre>
<p>I think that the code is pretty self explanatory.   I am using straight jQuery to get the source of the image and FLV file.  I am then plugging these values into the FlowPlayer javascript API.  Flow Player doesn&#8217;t have the concept of a poster frame for a video, so instead I create a play list where the image is the first item in the play list and the FLV file is the second.</p>
<p>To get this to work you obviously need to download the <a href="http://docs.jquery.com/Downloading_jQuery">jQuery</a>, <a href="http://flowplayer.org/documentation/api.html">FlowPlayer javascript file</a> and the actual <a href="http://flowplayer.org/download/index.html">player itself.</a></p>
<p><em><strong>Update:</strong></p>
<p>I realised that the above code does not work in Internet Explorer 7.  IE7 is apparently more strict in enforcing that the Javascript Objects have the correct syntax.  I had extra comma&#8217;s in the &#8220;Playlist&#8221; array that I have now removed.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://anilmakhijani.com/2008/11/28/quick-introduction-to-flow-player/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.streetfilms.org/wp-content/uploads/2008/01/chicanefinal16x9.flv" length="3144740" type="video/x-flv" />
<enclosure url="http://www.streetfilms.org/wp-content/uploads/2008/11/jan-gehl-with-aaron_768k.flv" length="79462693" type="video/x-flv" />
		</item>
	</channel>
</rss>

