<?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>榆树网 &#187; flash</title>
	<atom:link href="http://www.wenzk.com/archives/tag/flash/feed" rel="self" type="application/rss+xml" />
	<link>http://www.wenzk.com</link>
	<description>http://www.wenzk.com</description>
	<lastBuildDate>Fri, 03 Sep 2010 13:37:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Video Blogging using Django and Flash(tm) Video (FLV)</title>
		<link>http://www.wenzk.com/archives/907</link>
		<comments>http://www.wenzk.com/archives/907#comments</comments>
		<pubDate>Thu, 08 Jul 2010 09:06:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[榆树网-杂项]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flv]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Stream]]></category>
		<category><![CDATA[开源]]></category>
		<category><![CDATA[视频]]></category>
		<category><![CDATA[视频博客]]></category>

		<guid isPermaLink="false">http://www.wenzk.com/?p=907</guid>
		<description><![CDATA[I just added Flash-based (FLV) video blogging support to my Django-powered travel portal site, trogger.de. The whole process is surprisingly simple and straightforward and can be done entirely with free (FLOSS) tools. The video publishing workflow consists of the following parts: A Django model to store our video and associated information An upload form where [...]]]></description>
			<content:encoded><![CDATA[<p>I just added Flash-based (FLV) video blogging support to my <a href="http://www.djangoproject.com/">Django</a>-powered travel portal  site, <a href="http://www.trogger.de/">trogger.de</a>. The whole process  is surprisingly simple and straightforward and can be done entirely with  free (FLOSS) tools.</p>
<p><span id="more-907"></span>The video publishing workflow consists of the following parts:</p>
<ul>
<li>A Django model to store our video and associated information</li>
<li>An upload form where the user can upload a video</li>
<li>Converting the video into a format usable on the Web</li>
<li>Extracting additional details</li>
<li>Playing the video in the Web browser</li>
<li>Making the player a bit friendlier</li>
<li>Advanced features</li>
</ul>
<p>Following this simple workflow, <a href="http://www.trogger.de/">trogger.de</a> allows users to write and submit a blog post. Once that’s submitted,  the user can add one (!) video file to it. When later viewing the blog  entry, the attached video is shown in the browser.</p>
<h2>The Django model</h2>
<p>The Django model for storing the video is rather straightforward. In  addition to storing the Video (or, rather, a reference to the video  file) in a FileField, I’ve added a reference to the blog submission with  which the video is related (I use this to look up the video when  browsing the blog). Here’s my model, VideoSubmission:</p>
<pre>class VideoSubmission(models.Model):
    videoupload = models.FileField (upload_to='videoupload')
    relatedsubmission = models.ForeignKey(Submission, null=True)
    comment = models.CharField( maxlength=250, blank=True )
    flvfilename = models.CharField( maxlength=250, blank=True, null=True )
</pre>
<p>In addition to the video FileField itself, I’ve added a “flvfilename”  field to store the name of the converted movie file (see below).</p>
<h2>Uploading the video</h2>
<p>Video uploading is done using a normal File upload form. In the view  for the upload form, we need to add the FormFields for the file upload  fields created by Django:</p>
<pre>def v_addvideo(request, submissionid):
    manipulator=VideoSubmission.AddManipulator()
    form=FormWrapper(manipulator,{},{})
    params = {'userAccount':request.user,'form':form,}
    c = Context( request, params)
    t = loader.get_template('video/addvideo.html')
    sub = Submission.objects.get(pk=submissionid)
    params['submission'] = sub
    return HttpResponse( t.render( c ) )
</pre>
<p>Our addvideo.html is pretty much the simplest upload form imaginable:</p>
<pre>&lt;form action="/video/upload/" method="post" enctype="multipart/form-data"&gt;
&lt;table&gt;
  &lt;input type="hidden" name="relatedsubmission_id" value="{{submission.id}}" /&gt;
    &lt;tr valign="top"&gt;
      &lt;td&gt;Video hochladen:&lt;br/&gt;(Nur AVI und FLV werden akzeptiert)&lt;/td&gt;
      &lt;td&gt;{{ form.videoupload}} {{ form.videoupload_file }}&lt;br/&gt;
      Kommentar: &lt;input type="text" name="comment"   style="width:100%" maxlength="250"&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr valign="top"&gt;
      &lt;td&gt; &lt;/td&gt;
      &lt;td&gt;&lt;input type="submit" Value="Hochladen"/&gt; &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
</pre>
<p>I’ve added the related submission ID as a hidden field, so that this  gets submitted back to the upload process and I can create a link  between the video and the blog entry.</p>
<h2>Converting the video for use in the site</h2>
<p>The users are asked to upload AVI videos to the site, but we cannot  play AVI videos directly in the browser (at least not in a  browser-independent manner). A good way to publish videos for viewing in  a browser is using FLV (Flash(tm) Video) format. This is what YouTube,  Google Video and a whole host of other sites use. If it’s good enough  for them, it’s good enough for me!</p>
<h3>Converting to FLV</h3>
<p>So, how to convert the AVI video the user uploaded to a usable FLV  format? Luckily, the OSS package <a href="http://ffmpeg.mplayerhq.hu/">ffmpeg</a> [2] provides this conversion functionality (plus a wide range of other  video conversion features one of which we’ll come to later on). The good  thing about ffmpeg is that it is controlled entirely from the  command-line and can be run in headless environments — this is vital for  using it on an application server. Most other FLV conversion tools were  either for Windows or came with some form of Gnome or KDE gui which  wouldn’t have worked on my hosted Linux box.</p>
<p>The basic command for converting a video into FLV format is (see [1]  in resources):<br />
<code><br />
ffmpeg -i [sourcefile.avi] -acodec mp3 -ar 22050 -ab 32 -f flv -s  320×240  [destfile.flv]<br />
</code></p>
<h3>Adding FLV metadata</h3>
<p>This command creates a simple FLV format file, containing the video  and audio streams. In addition, FLV files need meta-information such as  duration, frames, etc. FLV movie players use this information to  calculate progress bar sliders and allow the user to fast-forward or  reverse through the video. For reasons which I didn’t bother to  research, ffmpeg does not add this information. But there is a package  which can: flvtool2 (see [3]). Using this tool, we can add FLV  meta-information with the following command:<br />
<code><br />
flvtool2 -U [flvfile]<br />
</code></p>
<p>(Warning, Djangoists — flvtool2 is written in Ruby. Please check your  religious language preferences at the door and pick them up as you  leave. Thank you).</p>
<h3>Adding a video thumbnail</h3>
<p>Blog entries in <a>trogger.de</a> can  include pictures uploaded by the users. One of these pictures is  displayed as a small preview when showing the blog posting (e.g. in the  blog overview, or in the list of the latest blog submissions). Wouldn’t  it be nice if we could also add a thumbnail for a video submission, so  that the blog’s reader can get a first idea of what to expect? I think  it would. And, again, ffmpeg comes to the rescue.</p>
<p>ffmpeg can extract single frames from a video stream, storing them in  still image format. The command for doing this is:</p>
<p><code><br />
ffmpeg -y -i [videofile] -vframes 1 -ss 00:00:02 -an -vcodec png -f  rawvideo -s 320×240 [thumbnailimage.png]<br />
</code></p>
<h3>Putting it all together</h3>
<p>With these individual steps, it’s EASY to put together a video  conversion function which kicks in once a user has uploaded a video  file. Since we have the information which video the user uploaded with  the form, we convert this video into FLV format, add metadata and create  a thumbnail image:</p>
<pre>def convertvideo (video):
    if video is None:
        return "Kein Video im Upload gefunden"
    filename = video.videoupload
    print "Konvertiere Quelldatei: %s" + filename
    if filename is None:
        return "Video mit unbekanntem Dateinamen"
    sourcefile = "%s%s" % (settings.MEDIA_ROOT,filename)
    flvfilename = "%s.flv" % video.id
    thumbnailfilename = "%svideos/flv/%s.png" % (settings.MEDIA_ROOT, video.id)
    targetfile = "%svideos/flv/%s" % (settings.MEDIA_ROOT, flvfilename)
    ffmpeg = "ffmpeg -i %s -acodec mp3 -ar 22050 -ab 32 -f flv -s 320x240 %s" % (sourcefile,  targetfile)
    grabimage = "ffmpeg -y -i %s -vframes 1 -ss 00:00:02 -an -vcodec png -f rawvideo -s 320x240 %s " % (sourcefile, thumbnailfilename)
    flvtool = "flvtool2 -U %s" % targetfile
    print ("Source : %s" % sourcefile)
    print ("Target : %s" % targetfile)
    print ("FFMPEG: %s" % ffmpeg)
    print ("FLVTOOL: %s" % flvtool)
    try:
        ffmpegresult = commands.getoutput(ffmpeg)
        print "-------------------- FFMPEG ------------------"
        print ffmpegresult
        # Check if file exists and is &gt; 0 Bytes
        try:
            s = os.stat(targetfile)
            print s
            fsize = s.st_size
            if (fsize == 0):
                print "File is 0 Bytes gross"
                os.remove(targetfile)
                return ffmpegresult
            print "Dateigroesse ist %i" % fsize
        except:
            print sys.exc_info()
            print "File %s scheint nicht zu existieren" % targetfile
            return ffmpegresult
        flvresult = commands.getoutput(flvtool)
        print "-------------------- FLVTOOL ------------------"
        print flvresult
        grab = commands.getoutput(grabimage)
        print "-------------------- GRAB IMAGE ------------------"
        print grab
    except:
        print sys.exc_info()
        return sys.exc_info[1]
    video.flvfilename = flvfilename
    video.save()
    return None
</pre>
<h3>Things to note</h3>
<p>I’m keeping the media diectory for the uploads and the media  directory for the converted results separate. This way, I can later on  easily clear the upload area if I decide I don’t need the source videos  any more (after all, they eat up valuable hosting space), without having  to bother about accidentally deleting the converted data. Yes, I’m  sometimes stupid in breathtakingly dumb ways. Also I can exclude the  source video files from the daily backup.</p>
<p>If something goes wrong with the conversion, I return the output  message from the conversion tool and actually display this in the Web  page, so the user can see if there was a problem. I’m not too sure this  is a good idea, yet. ffmpeg puts pathnames into its output, so the error  message is exposing potentially exploitable information about the  directory setup of my server. You might want to consider replacing path  names before dumping the output message.</p>
<p>The converted video file is created in a subdirectory of the media  root and has the VideoSubmission model instance’s ID as a filename  (35.flv). This will always be unique, so there’s no need to think about  another unique naming scheme. The PNG image thumbnail also has the ID as  a filename, but with a PNG extension (duh!).</p>
<h2>Playing the video in the Web browser</h2>
<p>Now that the video was uploaded and (hopefully) successfully  converted, we need to provide a way of viewing it. For this, I use an  FLV player component called <a href="http://flowplayer.sourceforge.net/">FlowPlayer</a>,  avilable as a SourceForge project [4]. The FlowPlayer SWF is embedded  into the page and parameters are provided based on information from the  video. In the blog entry view, I look for a related video submission  which I pass in the context as “video”. The view template populates the  SWF parameters using information from the “video” instance:</p>
<pre>{% if video %}
&lt;div style="textalign:center; width:100%;"&gt;
&lt;center&gt;
&lt;object  type="application/x-shockwave-flash"
width="320" height="263" id="FlowPlayer" data="/showvideo/FlowPlayer.swf"&gt;
	&lt;param name="allowScriptAccess" value="sameDomain" /&gt;
	&lt;param name="movie" value="/showvideo/FlowPlayer.swf" /&gt;
	&lt;param name="quality" value="high" /&gt;
	&lt;param name="scale" value="noScale" /&gt;
	&lt;param name="wmode" value="transparent" /&gt;
	&lt;param name="flashvars" value="baseURL=/showvideo&amp;videoFile=flv/{{video.flvfilename}}&amp;autoPlay=false&amp;bufferLength=5&amp;loop=false&amp;progressBarColor1=0xAAAAAA&amp;progressBarColor2=0x555555&amp;autoBuffering=false&amp;splashImageFile=clicktoplay.jpg&amp;hideControls=false" /&gt;
&lt;p&gt;Dein Browser scheint kein Flash-Plugin installiert zu haben&lt;/p&gt;
&lt;/object&gt;
&lt;p&gt;
&lt;center&gt;
&lt;strong&gt;{{video.comment}}&lt;/strong&gt;
&lt;/center&gt;
&lt;/p&gt;
&lt;/center&gt;
&lt;/div&gt;
{% endif %}
</pre>
<p>Note the inconspicuous “splashImageFile=clicktoplay.jpg” hidden in  the jumble of FLV parameters. FlowPlayer provides a very simple way of  specifying a “splash screen” image which is displayed in place of the  video until the user clicks on the Flash player to view the video. I’ve  created a trogger-themed splash screen and use this for all embedded  video submissions:</p>
<p><img id="image58" src="http://www.wenzk.com/wp-content/uploads/2010/07/512a_clicktoplay.jpg" alt="FlowPlayer splash screen" width="128" height="96" /></p>
<h2>The end result</h2>
<p>Thew end result is shown in the screenshot. A user-written blog  entry, with an attached video which is played in the browser. Not bad  for one day’s work, if I say so myself.</p>
<p><a href="http://www.wenzk.com/wp-content/uploads/2010/07/dd94_mantavideo.gif"><br />
<img id="image57" src="http://www.wenzk.com/wp-content/uploads/2010/07/dd94_mantavideo.gif" border="0" alt="Manta Video in trogger page" width="400" /></a></p>
<h2>Conversion quality and size issues</h2>
<p>Quality of the converted FLV videos is pretty good, even at lower  resolutions. Of course, YMMV or you may have other expectations. Using  the conversion commands shown above, a 2.6MB camera movie was converted  into an FLV file of 590kB. Depending on your intended use of the video  (full-screen presentation?), and depending on how much bandwidth you  want to burn, you may want to fiddle with some quality and compression  parameters in ffmpeg.</p>
<h2>Housekeeping</h2>
<p>It is definitely a good idea to make sure that the FLV files are not  actually served by Django, but directly by Apache (or even by another  http server altogether). To serve the video files directly from Apache,  we can exclude the video location “showvideo” from processing by Django  by adding a section to the httpd.conf:</p>
<pre>Alias /showvideo/ "/path/to/my/media/root/video/"
&lt;Location "/showvideo/"&gt;
    SetHandler none
&lt;/Location&gt;
</pre>
<p>Also, we should consider limiting the size of uploads, since we don’t  want to drown in uploaded video (and we don’t want to get out-of-memory  errors from Django, which holds the entires file upload in memory at  least temporarily). As has been <a href="http://groups.google.com/group/django-users/msg/0562d78a613cb069">pointed  out by Malcolm Tredinnick in the django-users group</a>, this can be  achieved using the <a href="http://httpd.apache.org/docs/1.3/mod/core.html#limitrequestbody">LimitRequestBody  directive</a>.</p>
<h2>Open Issues</h2>
<p>One issue that I haven’t been able to solve is adequate support for  more video formats. Windows Media stuff provides so many proprietary  formats, codecs, etc., that it’s hard even for a project such as ffmpeg  to keep up. As a result, I’ve limited video upload to AVI files, and  make it quite clear to the uploader that potentially the video he’s  uploading cannot be used, due to format problems. AVI videos captured by  my digital camera (such as the diving video in the screenshot) can be  converted quite well. As soon as somebody recodes the video, converts it  to WMV, there’s trouble (even more so if the video contains any Digital  Restrictions Management). There are loads of forum entries in the Net  discussing potential solutions. Since they all involved hacking  additional (sometimes binary) codes into ffmpeg, I wasn’t adventurous  enough to try them.</p>
<p>If anyone can point me at a reliable way of converting (unprotected)  WMV files and other video formats into FLV format, I would be very  grateful.</p>
<p>I discovered that MPlayer can also be used for such conversions and  can also be run in a headless environment; since conversion with  ffmpeg  worked, I didn’t do any more experiments — maybe someone else can  enlighten me as to wether MPlayer would actually be better or cope with  more formats?</p>
<p>Also, I’m doing the video conversion in-line with the browser upload.  This is OK for shorter videos, where I can make the user wait for a  result. For larger video submissions it might be useful to decouple the  video processing and do it in a separate thread, updating the blog entry  when finished.</p>
<h2>Resources</h2>
<p>[1] <a href="http://www.summersault.com/community/weblog/2006/02/13/publishing-flash-videos-with-free-open-source-tools.html%3Cbr%20/%3E%E2%80%9C%3EPublishing%20Flash%20videos%20with%20free,%20open%20source%20tools%3Cbr%20/%3Ehttp://www.summersault.com/community/weblog/2006/02/13/publishing-flash-videos-with-free-open-source-tools.html%3C/p%3E%3Cp%3E%5B2%5D%20%3Ca%20href=">ffmpeg</a></p>
<p>http://ffmpeg.mplayerhq.hu/</p>
<p>[3] <a href="http://rubyforge.org/projects/flvtool2/">flvtool2</a></p>
<p>http://rubyforge.org/projects/flvtool2/</p>
<p>[4] <a href="http://flowplayer.sourceforge.net/">FlowPlayer</a></p>
<p>http://flowplayer.sourceforge.net/</p>
<p>Tags: <a rel="tag" href="http://technorati.com/tag/Django">Django</a>;  <a rel="tag" href="http://technorati.com/tag/Python">Python</a>; <a rel="tag" href="http://technorati.com/tag/flv">FLV</a>; <a rel="tag" href="http://technorati.com/tag/video">video</a>; <a rel="tag" href="http://technorati.com/tag/trogger">trogger</a></p>
<p>P.S. You can check out a blog entry with video submission in my  trogger blog at <a href="http://www.trogger.de/blog/8/60/mit-mantas-tauchen-vor-machchafushi/fullentry/">http://www.trogger.de/blog/8/60/mit-mantas-tauchen-vor-machchafushi/fullentry/</a>.</p>
<p>From: <a href="http://blog.go4teams.com/?p=56" target="_blank">http://blog.go4teams.com/?p=56</a></p>
<h2  class="related_post_title">相关文章</h2><ul class="related_post"><li><a href="http://www.wenzk.com/archives/648" title="Apache flv streaming done right">Apache flv streaming done right</a> (0)</li><li><a href="http://www.wenzk.com/archives/642" title="Wordpress FLV Player插件使用注意事项【官方插件无法正常使用】">Wordpress FLV Player插件使用注意事项【官方插件无法正常使用】</a> (0)</li><li><a href="http://www.wenzk.com/archives/541" title="AutoHotkey is a free, open-source utility for Windows">AutoHotkey is a free, open-source utility for Windows</a> (0)</li><li><a href="http://www.wenzk.com/archives/977" title="如何免费搭建自己的vps服务器？">如何免费搭建自己的vps服务器？</a> (0)</li><li><a href="http://www.wenzk.com/archives/625" title="测试flv player插件&#8211;她来听我的演唱会">测试flv player插件&#8211;她来听我的演唱会</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wenzk.com/archives/907/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache flv streaming done right</title>
		<link>http://www.wenzk.com/archives/648</link>
		<comments>http://www.wenzk.com/archives/648#comments</comments>
		<pubDate>Tue, 02 Mar 2010 14:31:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[榆树网-网络]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flv]]></category>

		<guid isPermaLink="false">http://www.wenzk.com/?p=648</guid>
		<description><![CDATA[Download my tuned version of mod_flvx or the original mod_flv by Paul Querna. Install apxs tool (also avaliable in RPMs for most systems as httpd-devel) Compile and install your module with the following command: apxs -c -i ./mod_flvx.c Add the following 2 lines to your httpd.conf or create a dedicated /etc/httpd/conf.d/mod_flvx.conf (path depends on your Linux distribution): LoadModule flvx_module modules/mod_flvx.so [...]]]></description>
			<content:encoded><![CDATA[<ol>
<li>Download my <a href="http://thinkscape.biz/community/mod_flvx.c" target="_new">tuned version of mod_flvx</a> or the  original <a href="http://people.apache.org/%7Epquerna/modules/mod_flvx.c" target="_new">mod_flv</a> by Paul Querna.</li>
<li>Install <samp>apxs</samp> tool (also avaliable in RPMs for most  systems as <samp>httpd-devel</samp>)</li>
<li>Compile and install your module with the following command:
<pre class="brush: plain;">apxs -c -i ./mod_flvx.c </pre>
</li>
<li>Add the following 2 lines to your <samp>httpd.conf</samp> or create a  dedicated <samp>/etc/httpd/conf.d/mod_flvx.conf</samp> (path depends on  your Linux distribution):
<pre class="brush: plain;">LoadModule flvx_module modules/mod_flvx.so
AddHandler flv-stream .flv </pre>
</li>
<li>Restart Apache (i.e. with service httpd restart)</li>
</ol>
<p>Testing:<br />
# Using curl:</p>
<pre class="brush: plain;">curl -I &quot;http://mysite.com/video.flv?start=100000&quot; </pre>
<p>..where 100000 is some byte position in your file. This should show you Content-Type: video/x-flv. Now increase the start= parameter and the Content-Length should be smaller accordingly.<br />
# Using wget:</p>
<pre class="brush: plain;">wget -O test.flv &quot;http://mysite.com/video.flv?start=1048576&quot; </pre>
<p>The generated test.flv should be of size originalSize &#8211; 1MB</p>
<p>From: <a href="http://flowplayer.org/forum/5/14679" target="_blank">http://flowplayer.org/forum/5/14679</a></p>
<h2  class="related_post_title">相关文章</h2><ul class="related_post"><li><a href="http://www.wenzk.com/archives/907" title="Video Blogging using Django and Flash(tm) Video (FLV)">Video Blogging using Django and Flash(tm) Video (FLV)</a> (0)</li><li><a href="http://www.wenzk.com/archives/642" title="Wordpress FLV Player插件使用注意事项【官方插件无法正常使用】">Wordpress FLV Player插件使用注意事项【官方插件无法正常使用】</a> (0)</li><li><a href="http://www.wenzk.com/archives/625" title="测试flv player插件&#8211;她来听我的演唱会">测试flv player插件&#8211;她来听我的演唱会</a> (1)</li><li><a href="http://www.wenzk.com/archives/614" title="3G上网，FireFox帮你省流量-不显示图片和Flash">3G上网，FireFox帮你省流量-不显示图片和Flash</a> (0)</li><li><a href="http://www.wenzk.com/archives/447" title="Nginx 0.8.25就要发布啦
">Nginx 0.8.25就要发布啦
</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wenzk.com/archives/648/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress FLV Player插件使用注意事项【官方插件无法正常使用】</title>
		<link>http://www.wenzk.com/archives/642</link>
		<comments>http://www.wenzk.com/archives/642#comments</comments>
		<pubDate>Tue, 02 Mar 2010 12:19:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[榆树网-网络]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flv]]></category>
		<category><![CDATA[player]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[插件]]></category>
		<category><![CDATA[播放器]]></category>

		<guid isPermaLink="false">http://www.wenzk.com/?p=642</guid>
		<description><![CDATA[插件官方下载地址：http://wordpress.org/extend/plugins/flv-player/ 官方文档为： 1. Expand this plugin's archive content to wp-content/plugins/ 2. Go to Administration &#62; Plugins and activate this plugin. 3. In your posts, use this syntax: [ flvplayer file&#124;url[[width [height]]] eg: [ flvplayer &#60;a rel=&#34;nofollow&#34; href=&#34;http://acme.com/video.flv&#34;&#62;http://acme.com/video.flv&#60;/a&#62; [ flvplayer &#60;a rel=&#34;nofollow&#34; href=&#34;http://acme.com/video.flv&#34;&#62;http://acme.com/video.flv&#60;/a&#62; 640 480] 但是下载官方的zip包解压后，默认地址却是：plugins/flv-player目录，所以与官方文档不一致，需要将插件中的路径进行修改。 一共2处需要修改，flvplayer.php中的20行改成 &#60;script type=&#34;text/javascript&#34; src=&#34;{$prefix}/plugins/flv-player/swfobject.js&#34;&#62;&#60;/script&#62; 52行改成： '{$prefix}/plugins/flv-player/flvplayer.swf', 如果你懒得去修改，也可以下载一个修改好的，下载地址：http://www.wenzk.com/soft/flv-player.2.0.tar.gz 还有一个需要注意的就是，上传后flv文件名不要有中文字符，否则这个插件是不work的，这个也折腾了我一阵子，测试的时候上传的带有中文名一个flv文件，结果很杯具，最终看代码搞定的。 function flvplayer_plugin($content) [...]]]></description>
			<content:encoded><![CDATA[<p>插件官方下载地址：http://wordpress.org/extend/plugins/flv-player/</p>
<p><span id="more-642"></span>官方文档为：</p>
<pre class="brush: plain;">
   1. Expand this plugin's archive content to wp-content/plugins/
   2. Go to Administration &gt; Plugins and activate this plugin.
   3. In your posts, use this syntax: [ flvplayer file|url[[width [height]]] eg: [ flvplayer &lt;a rel=&quot;nofollow&quot; href=&quot;http://acme.com/video.flv&quot;&gt;http://acme.com/video.flv&lt;/a&gt; [ flvplayer &lt;a rel=&quot;nofollow&quot; href=&quot;http://acme.com/video.flv&quot;&gt;http://acme.com/video.flv&lt;/a&gt; 640 480]
</pre>
<p>但是下载官方的zip包解压后，默认地址却是：plugins/flv-player目录，所以与官方文档不一致，需要将插件中的路径进行修改。<br />
一共2处需要修改，flvplayer.php中的20行改成</p>
<pre class="brush: plain;">&lt;script type=&quot;text/javascript&quot; src=&quot;{$prefix}/plugins/flv-player/swfobject.js&quot;&gt;&lt;/script&gt;</pre>
<p>52行改成：</p>
<pre class="brush: plain;">'{$prefix}/plugins/flv-player/flvplayer.swf',</pre>
<p>如果你懒得去修改，也可以下载一个修改好的，下载地址：<a href="http://www.wenzk.com/soft/flv-player.2.0.tar.gz">http://www.wenzk.com/soft/flv-player.2.0.tar.gz</a></p>
<p>还有一个需要注意的就是，上传后flv文件名不要有中文字符，否则这个插件是不work的，这个也折腾了我一阵子，测试的时候上传的带有中文名一个flv文件，结果很杯具，最终看代码搞定的。</p>
<pre class="brush: php;">function flvplayer_plugin($content)
{
 return preg_replace_callback('/\[flvplayer ([A-Za-z0-9\-_\/\?\&amp;\#\%\.\=@:;]+)(?:[ ]*)([A-Za-z0-9\-_\/\?\&amp;\#\%\.\=@:;]*)(?:[ ]*)([A-Za-z0-9\-_\/\?\&amp;\#\%\.\=@:;]*)\]/', 'flvplayer_plugin_callback', $content);
}</pre>
<h2  class="related_post_title">相关文章</h2><ul class="related_post"><li><a href="http://www.wenzk.com/archives/625" title="测试flv player插件&#8211;她来听我的演唱会">测试flv player插件&#8211;她来听我的演唱会</a> (1)</li><li><a href="http://www.wenzk.com/archives/907" title="Video Blogging using Django and Flash(tm) Video (FLV)">Video Blogging using Django and Flash(tm) Video (FLV)</a> (0)</li><li><a href="http://www.wenzk.com/archives/648" title="Apache flv streaming done right">Apache flv streaming done right</a> (0)</li><li><a href="http://www.wenzk.com/archives/103" title="Auto Highslide插件">Auto Highslide插件</a> (0)</li><li><a href="http://www.wenzk.com/archives/737" title="更新了Wordpress for Blacberry客户端">更新了Wordpress for Blacberry客户端</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wenzk.com/archives/642/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3G上网，FireFox帮你省流量-不显示图片和Flash</title>
		<link>http://www.wenzk.com/archives/614</link>
		<comments>http://www.wenzk.com/archives/614#comments</comments>
		<pubDate>Mon, 08 Feb 2010 15:08:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[榆树网-系统]]></category>
		<category><![CDATA[3G]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[GPRS]]></category>
		<category><![CDATA[图片]]></category>
		<category><![CDATA[流量]]></category>

		<guid isPermaLink="false">http://www.wenzk.com/?p=614</guid>
		<description><![CDATA[在没有网络的地方，通过无线上网确实很方便，但是对于我这种不是包月的来说，流量就是一个很大的问题，每个月之后150M的流量，挺紧张的啊。 于 是想到将firefox设置成不显示图片应该能节省不少流量。 1、不播放flash，需要插件支持：Flashblock 2、 不显示图片：工具(Tools)-&#62;选项(Options)-&#62;内容(Content)-&#62;自动加载图片(Load images automatically)，去掉这个选项就OK啦。 对于IE来说，可以在  工具 -&#62; Internet选项 -&#62; 高级 -&#62; 多媒体，把图片去掉就OK啦。 相关文章GPRS流量用超了 (1)Video Blogging using Django and Flash(tm) Video (FLV) (0)The Road to Success (0)从Alexa看google.com.hk的崛起 (0)Apache flv streaming done right (0)]]></description>
			<content:encoded><![CDATA[<p>在没有网络的地方，通过无线上网确实很方便，但是对于我这种不是包月的来说，流量就是一个很大的问题，每个月之后150M的流量，挺紧张的啊。</p>
<p>于 是想到将firefox设置成不显示图片应该能节省不少流量。</p>
<p>1、不播放flash，需要插件支持：Flashblock</p>
<p>2、 不显示图片：工具(Tools)-&gt;选项(Options)-&gt;内容(Content)-&gt;自动加载图片(Load images automatically)，去掉这个选项就OK啦。</p>
<p>对于IE来说，可以在  工具 -&gt; Internet选项 -&gt; 高级 -&gt; 多媒体，把图片去掉就OK啦。</p>
<h2  class="related_post_title">相关文章</h2><ul class="related_post"><li><a href="http://www.wenzk.com/archives/435" title="GPRS流量用超了">GPRS流量用超了</a> (1)</li><li><a href="http://www.wenzk.com/archives/907" title="Video Blogging using Django and Flash(tm) Video (FLV)">Video Blogging using Django and Flash(tm) Video (FLV)</a> (0)</li><li><a href="http://www.wenzk.com/archives/776" title="The Road to Success">The Road to Success</a> (0)</li><li><a href="http://www.wenzk.com/archives/760" title="从Alexa看google.com.hk的崛起">从Alexa看google.com.hk的崛起</a> (0)</li><li><a href="http://www.wenzk.com/archives/648" title="Apache flv streaming done right">Apache flv streaming done right</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.wenzk.com/archives/614/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
