﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-&lt;h3 style="font-family: Comic Sans MS"&gt;&lt;font color="#FA1A0A" size="10"&gt;︻┳═一Java&lt;/font&gt;&lt;/h3&gt;-随笔分类-Flex</title><link>http://www.blogjava.net/rain1102/category/37637.html</link><description>&lt;br/&gt;&lt;font color="green" style="font-family: 华文行楷;font-size:16px;"&gt;子曰：危邦不入，乱邦不居。天下有道则见，无道则隐。&lt;/font&gt;&lt;font color="#3C1435"&gt;&lt;/font&gt;</description><language>zh-cn</language><lastBuildDate>Sun, 15 Feb 2009 04:34:02 GMT</lastBuildDate><pubDate>Sun, 15 Feb 2009 04:34:02 GMT</pubDate><ttl>60</ttl><item><title>建立一个简单的red5应用程序的教程[转载]</title><link>http://www.blogjava.net/rain1102/archive/2008/12/17/246924.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Wed, 17 Dec 2008 09:23:00 GMT</pubDate><guid>http://www.blogjava.net/rain1102/archive/2008/12/17/246924.html</guid><wfw:comment>http://www.blogjava.net/rain1102/comments/246924.html</wfw:comment><comments>http://www.blogjava.net/rain1102/archive/2008/12/17/246924.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/rain1102/comments/commentRss/246924.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/rain1102/services/trackbacks/246924.html</trackback:ping><description><![CDATA[原文地址：http://bbs.liuquan.net/thread-71224-1-1.html<br />
<div class="t_msgfont" id="postmessage_138836">今天,想好好改改以前做的flash+<span class="t_tag" onclick="tagshow(event)" href="tag.php?name=red5">red5</span>聊天室，程序又得从头建立，记录下过程.<br />
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;１、 到RED5的安装目录，找到doc/templates目录，该目录中存放了一个标准的RED5应用程序模版myapp，将其复制到RED5安装目录中的webapps目录下那么可以把myapp改为mychat，这个名字就是以后要连接的服务名了<br />
&nbsp; &nbsp; ２、 在WEB-INF中新建一个文件夹src用来存放程序的源代码，新建一个classes文件夹用来存放编译后的文件<br />
&nbsp; &nbsp;&nbsp;&nbsp;３、打开Eclipse将工作区指定为RED5安装目录下webapps，然后新建一个项目，项目名为myChat.这个时候你应该发现刚才myChat中的文件都被加载进来了,我们首先把src目录指定为源代码目录，右键选择src,在弹出的菜单中选择Build Path-&gt;Use as Source Folder，即将其指定为代码文件夹。接下来要指定项目的目标目录，在项目名上右键选择Properties，选择Java Bulid Path,在选择Source标签，在下面的Browse中选择Classes目录，将其指定为目标目录。然后选择Libraries，点击Add External JARs，将RED5安装目录下的red5.jar包含进来。（java下的jar也最好包含进来）<br />
　　　４、在Eclipse的左边应该多了WEB-INF/src这样一个东东，我们将要在这里开始写入我们的第一个项目代码。右键选择它，在弹出的菜单中选择New-&gt;Package，新建一个包，举例，包名可以为lchat，然后再在生成的lchat这个包上继续右键选择New-&gt;File,输入文件名Application.java。并在建好的文件中输入以下代码：<br />
package&nbsp; &nbsp;lchat;<br />
&nbsp; &nbsp;&nbsp;&nbsp;import org.red5.server.adapter.ApplicationAdapter;<br />
&nbsp; &nbsp;&nbsp;&nbsp;public class Application extends ApplicationAdapter{<br />
&nbsp; &nbsp;&nbsp;&nbsp;public Double add(Double a,Double b){<br />
&nbsp; &nbsp;&nbsp;&nbsp;return a+b;<br />
&nbsp; &nbsp;&nbsp;&nbsp;}<br />
&nbsp; &nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;5、<br />
　　把red5-web.properties文件做以下更改：将第一句修改为webapp.contextPath=/myChat<br />
　　把web.xml文件作以下更改：找到webAppRootKey，将其下面的param-value标签中的值修改为/myChat。<br />
　　把red5-web.xml文件做以下更改：找到bean id=&#8221;web.handler&#8221;一句，将class=&#8221;XXX&#8221;中的XXX位置修改为org.d5.first.Application，这样本程序将以刚才写的Application来运行。删除后面的bean id=&#8221;server.handler&#8230;整句，因为我们暂时用不到这个东东。<br />
<br />
　　把red5-web.properties文件做以下更改：将第一句修改为webapp.contextPath=/myChat<br />
<br />
6、重新启动red5<br />
７、flash里面运行<br />
nc = new NetConnection();<br />
trace(111);<br />
&nbsp; &nbsp;&nbsp;&nbsp;nc.connect("rtmp://localhost/mychat");<br />
&nbsp; &nbsp;&nbsp;&nbsp;nc.onResult = function(obj){<br />
&nbsp; &nbsp;&nbsp;&nbsp;trace("This result is " +obj);<br />
&nbsp; &nbsp;&nbsp;&nbsp;}<br />
&nbsp; &nbsp;&nbsp;&nbsp;nc.call("add",nc,1,2);<br />
<br />
就出来结果了<br />
表示连接成功<br />
<br />
一个最基本的red5连flash程序就好了<br />
<br />
下面是Python代码
<pre>
<p><font face="Arial">from org.red5.server.adapter import ApplicationAdapter<br />
from org.red5.server.api.stream import IStreamCapableConnection<br />
from org.red5.server.api.stream.support import SimpleBandwidthConfigure</font></p>
<p><font face="Arial">class Application(ApplicationAdapter):<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; def appStart(self, app):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ApplicationAdapter.appStart(self, app)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print 'Python appStart', app<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.appScope = app<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 1</font></p>
<p><font face="Arial">&nbsp;&nbsp;&nbsp; def appConnect(self, conn, params):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ApplicationAdapter.appConnect(self, conn, params)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print 'Python appConnect:', conn, params<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.measureBandwidth(conn)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if isinstance(conn, IStreamCapableConnection):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print 'Python setting bandwidth limits'<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sbc = SimpleBandwidthConfigure()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sbc.setMaxBurst(8388608)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sbc.setBurst(8388608)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sbc.setOverallBandwidth(2097152);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; conn.setBandwidthConfigure(sbc);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 1</font></p>
<p><font face="Arial">&nbsp;&nbsp;&nbsp; def toString(self):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 'Python:Application'</font></p>
<p><font face="Arial">def getInstance(*args):<br />
&nbsp;&nbsp;&nbsp; print 'Arguments:', args<br />
&nbsp;&nbsp;&nbsp; return Application()</font></p>
</pre>
<br />
</div><img src ="http://www.blogjava.net/rain1102/aggbug/246924.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/rain1102/" target="_blank">Eric.Zhou</a> 2008-12-17 17:23 <a href="http://www.blogjava.net/rain1102/archive/2008/12/17/246924.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何架设流媒体服务器[转载]</title><link>http://www.blogjava.net/rain1102/archive/2008/12/17/246840.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Wed, 17 Dec 2008 05:17:00 GMT</pubDate><guid>http://www.blogjava.net/rain1102/archive/2008/12/17/246840.html</guid><wfw:comment>http://www.blogjava.net/rain1102/comments/246840.html</wfw:comment><comments>http://www.blogjava.net/rain1102/archive/2008/12/17/246840.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/rain1102/comments/commentRss/246840.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/rain1102/services/trackbacks/246840.html</trackback:ping><description><![CDATA[<p><span style="font-size: 14pt"><span style="font-size: 10pt"><strong>一、前言</strong> </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">随着越来越多的朋友开始选择ADSL、Cable Modem或FTTB+ LAN作为首要的上网方式，宽频时代即将到来，这使我们&#8220;宽频 KTV、影音聊天室、线上电影院、远程教育&#8221;的梦想即将成为现实，而与其密切相关的&#8220;流媒体(Streaming Media)&#8221;也成了许多人谈论的热门话题，因为&#8220;流媒体&#8221;正是实现这些宽频应用的技术动力。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">宽频时代的到来还使得网民们不再满足于仅仅作为一项服务的受众，他们需要更大规模的交流，从中体现个体的价值，因此，许多朋友开始用自己的计算机，搭建网络广播和点播站点。他们充满着满腔的热情，但不可否认的是，中国网民先天技术上的不足，让他们在建设这样的站点时遇到重重险阻，以至于放弃。如何将这种热情在技术的引导下成为动力，这正是我们家用电脑所要做的，所以，在今天，在这里，我就将给大家介绍如何打造属于自己的流媒体服务器。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">不过，在开始正式的流媒体服务器架设之前，请让我们先了解一下流媒体服务器的基础知识。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt"><strong>二、流媒体基础知识</strong> </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">什么是流媒体？ </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">目前，在网络上传输音/视频等多媒体信息有两种解决方案，即http或ftp下载以及流式传输。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">http或ftp下载使用标准的http和ftp协议，但由于多媒体信息个头巨大，下载一个多媒体文件一般需要几分钟或几小时的时间，这就造成为了看一个并不知道内容的视频，首先需要耗费可能比整个视频都要长的时间来完成下载。这些被下载的文件还必须在下载前制作完成，放在网络服务器上，这样造成的直接后果就是：网络带宽不断提高，人们下载的等待时间越来越少，但最终还是不能观看网上现场直播。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">流式传输时，声音、影像或动画等多媒体信息由流媒体服务器向用户计算机连续、实时传送，它首先在使用者端的电脑上创建一个缓冲区，于播放前预先下载一段资料作为缓冲，用户不必等到整个文件全部下载完毕，而只需经过几秒或十数秒的启动延时即可进行观看。当多媒体信息在客户机上播放时，文件的剩余部分将在后台从服务器内继续下载。如果网络连接速度小于播放的多媒体信息需要的速度时，播放程序就会取用先前建立的一小段缓冲区内的资料，避免播放的中断，使得播放品质得以维持。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">流式传输除了能够发送已经制作完成的文件外，还可以通过采集服务器实时采集现场音视频，推送到流媒体服务器端，实时提供给用户。因此，流媒体除了能够更好的承担如下载一样的多媒体点播服务外，更能够应用在现场直播、电视转播、突发事件报道等多种对实时性传输要求较高的领域。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">有关流媒体的厂商 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">流媒体的市场巨大，世界上许多优秀的厂商都加入此行列，现阶段更是系统集成商竞争的风水宝地。而在通用市场上，竞争的公司主要有三个：Microsoft、RealNetworks、Apple，而相应的产品就是：Windows Media、Real Media、QuickTime。而近来，以开发Winamp著名的Nullsoft公司也在自己的MP3服务器中加入了视频支持，欲在流媒体市场分一杯羹。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">由于Apple的服务器和编辑软件一般都以Mac为操作平台，Nullsoft的流媒体服务器属于新生不成熟事务，所以今天在这里我主要给大家介绍一下Microsoft和RealNetworks的产品。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">流媒体的传输协议 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">大家在观看网上电影或者电视时，一般都会注意到这些文件的连接都不是用http或者ftp开头，而是一些rtsp或者mms开头的东西，为什么是这样呢？实际上，这些和http和ftp一样，都是数据在网络上传输的协议，只是它们是专门用来传输流式媒体的协议而已。下面，让我们来看一下现在使用的主要的流媒体协议： </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">1. RTSP（Real Time Streaming Protocol），实时流媒体协议，它是由RealNetworks和Netscape共同提出的，现在用于RealNetworks的Real Media产品中； </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">2. PNM（Progressive Networks Audio），这也是Real专用的实时传输协议，它一般采用UDP协议，并占用7070端口，但当你的服务器在防火墙内且7070端口被挡，且你的服务器把SmartingNetwork设为真时，则采用http协议，并占用默认的80端口； </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">3. MMS（Microsoft Media Server protocol），这是微软的流媒体服务器协议，MMS 是连接 Windows Media 单播服务的默认方法。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">介绍了主要的三个，可能您还会问，Apple的QuickTime使用哪种协议呢？在多数情况下，QuickTime使用http协议，但实际上它也由标准的流媒体传输协议，这就是标准RTSP协议，而Real公司使用的RTSP是自己经过开发的。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">在流媒体传输中，标准的协议就是RTP（Real time Transport Protocol，实时传输协议）、RTCP(Real-time Transport Control Protocol，实时传输控制协议)、RTSP（Real Time Streaming Protocol，实时流媒体协议）和RSVP（Resource Reserve Protocol, 资源预订协议），厂商们的产品都是在这些协议的基础上进行研究与开发，限于篇幅，在这里我们就不再深入讨论了。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">流媒体文件和发布格式 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">有了实时的传输协议，我们应该还能够想到，只有较小的文件才适合网络实时传输，那么，流媒体文件采用了什么样的压缩算法呢？ </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">而使用Windows操作系统的朋友可以看到，我们观看网上流节目时，它们的后缀名一般是rm、asf、wmv等，这些就是流媒体的格式。流媒体文件格式经过特殊编码，不仅采用较高的压缩比，还加入了许多控制信息，使其适合在网络上边下载边播放，而不是等到下载完整个文件才能播放。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">常见的流媒体格式大致有以下几种： </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">流媒体文件格式扩展(Video/Audio) 媒体类型与名称 <br />
asf 　　　　　　　　　　　　　　Advanced Streaming format. (Microsoft). <br />
rm　　　　　　　　　　　　　　　Real Video/Audio 文件 (Progressive Networks). <br />
ra　　　　　　　　　　　　　　　Real Audio 文件 (Progressive Networks). <br />
rp　　　　　　　　　　　　　　　Real Pix 文件 (Progressive Networks). <br />
rt　　　　　　　　　　　　　　　Real Text 文件 (Progressive Networks). <br />
swf 　　　　　　　　　　　　　　Shock Wave Flash (Macromedia). <br />
mov 　　　　　　　　　　　　　　QuickTime（Apple公司格式） <br />
viv 　　　　　　　　　　　　　　Vivo Movie 文件(Vivo Software). </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">另外还有一个wmv格式，是Windows Media Video的简称，它与asf文件有稍许区别，wmv一般采用window media video/audio 格式，asf视频部分一般采用Microsoft MPG4 V(3/2/1?)，音频部分是windows media audio v2/1，不过现在很多制作软件都没有把它们分开，所以直接更改后缀名就能够互相转换为对方格式。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">制作完成的流媒体文件需要发布到网络上才能够被别人使用，这就需要以特定方式安排压缩好的流媒体文件，而安排流媒体文件的格式就被成为流媒体发布格式。常见的发布格式主要有以下几种： </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">流媒体发布格式扩展 媒体类型和名称 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">asf　　　　　　　　Advanced Streaming format. <br />
smil　　　　　　　 Synchronised Multimedia Integration Language. <br />
ram　　　　　　　　RAM File. <br />
rpm　　　　　　　　Embedded RAM File. <br />
asx　　　　　　　　ASF Stream Redirector/ASF流转向器文件 <br />
xml　　　　　　　　eXtensible Markup Language </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">MPEG-4与流媒体 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">说到流媒体就不能不提及MPEG-4。MPEG-4是当前讨论的焦点之一，只因为它能够在大的压缩比下实现近似DVD品质的视频和音频效果，这也是许多朋友认为MPEG-4格式肯定比rm清晰的原因。但事实上并不是如此，MPEG-4只是一种视频编码技术，它的清晰度也根据压缩时所选择的码率的不同有较大的改变（我们见到的MPEG-4格式文件通常为500Kbps压缩生成，质量当然高了），并且，MPEG-4还有多种压缩标准，如Microsoft的asf视频部分就是基于MPEG-4的Discrete Cosine Transform (DCT)，另外还有DivX的免费MPEG-4版本（开始是破解微软的格式而来）。至于音频部分，更是混乱，Microsoft采用windows media audio v2/1，DivX采用MP3或者更高质量的AC3等。相比而言，Real或者Apple的格式使用的是自己开发的编码，在相同码率，特别是低码率下，不见得就比MPEG-4差，采取高码率的rm格式照样清晰可人，所以大家以后说rm格式清晰度差的观念要改变一下：），至少也要加上条件。而且，最新的Helix Producer中的Real Video 9采用VP5压缩格式进行编码，这可比DivX优秀多了！ </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">不过，流媒体服务器开始向MPEG-4格式靠拢是不争的事实，Real最新的Helix就开始支持mp4格式文件的服务，而RealOne Player更是只需安装一个插件便可实现MPEG-4格式的播放。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">点播与广播 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">在架设流媒体服务器之前，我们一定要了解一些点播与广播的知识。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">点播是客户端与服务器之间的主动的连接，在点播连接中，用户通过选择内容项目来初始化客户端连接，一个客户端从服务器接收一个媒体流（这个连接是唯一的，其它用户不能占用），并且能够对媒体进行开始、停止、后退、快进或暂停等操作，客户端拥有流的控制权，就像在看影碟一样。这种方式由于每个客户端各自连接服务器，服务器需要给每个用户建立连接，对服务器资源和网络带宽的需求都比较大。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">广播指的是用户被动接收流。在广播过程中，客户端接收流，但不能控制流，用户不能暂停、快进或后退该流，广播使用的数据发送手段有单播与广播。使用单播发送时，服务器需要将数据包复制多个拷贝，以多个点对点的方式分别发送到需要它的那些用户，而使用广播方式发送，数据包的单独一个拷贝将发送给网络上的所有用户，而不管用户是否需要，上述两种传输方式会非常浪费网络带宽和服务器资源，因此产生了组播（多播）技术。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">组播（多播）吸收了上述两种发送方式的长处，克服了上述两种发送方式的弱点，将数据包的单独一个拷贝发送给需要的那些客户，组播不会复制数据包的多个拷贝传输到网络上，也不会将数据包发送给不需要它的那些客户，保证了网络上多媒体应用占用网络的最小带宽。但组播不仅需要服务器端支持，更需要有多播路由器乃至整个网络结构的支持。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">单播与组播（多播） </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">在上面我们已经了解了一些单播和组播的概念，这也是现在流媒体方面讨论的焦点之一。以我的认识，点播与广播是一组概念，它们和客户端媒体交互的手段；单播和组播又是另外一组概念，它们是流媒体数据在服务器端和网络上的传输方式。 </span></span></p>
<p><span style="font-size: 14pt"><span style="font-size: 10pt">单播发送时，需要在客户端与媒体服务器之间需要建立一个单独的数据通道，从一台服务器送出的每个数据包只能传送给一个客户机，每个用户必须分别对媒体服务器发送单独的查询，而服务器必须向每个用户发送所申请的数据包拷贝。这种巨大冗余会造成服务器沉重和网络带宽的沉重负担，响应需要很长时间，甚至出现不能服务的情况。单播可以用在点播和广播上。 </span></span></p>
<div><span style="font-size: 14pt"><span style="font-size: 10pt">组播发送时，服务器将一组客户请求的流媒体数据发送到支持组播技术的路由器上，然后由路由器一次将数据包根据路由表复制到多个通道上，再向用户发送。这时候，媒体服务器只需要发送一个信息包，所有发出请求的客户端都共享同一信息包，并且信息可以发送到任意地址的客户机，没有请求的客户机不会收到信息包，网络上传输的信息包的总量没有广播那么多，大大提高了服务器和网络线路的利用率。不过组播也有自己的特点，首先是必须要开始支持组播技术的路由器，另外就是一般只能用作广播，因为用作点播会存在用户控制问题。</span></span></div>
<div><span style="font-size: 14pt">
<p><span style="font-size: 10pt"><strong>三、流媒体服务器硬件准备</strong> </span></p>
<p><span style="font-size: 10pt">流媒体服务器和网站（Web）服务器一样，要经受许多人的同时访问，相比Web服务器来说，由于多媒体文件需要更强处理能力，其硬件设备应超越一般用于Web的服务器。所以，流媒体服务器最好满足以下硬件条件。 </span></p>
<p><span style="font-size: 10pt">一颗强劲的&#8220;芯&#8221;。如果计算机CPU频率太低，处理能力过慢，电脑在被多用户访问时将我们无法进行其他任何操作（相信大家对那些网上视频点播的网站经常当机身有体会，我们和他们建立的是一样的服务器，只是规模小些罢了）。 <br />
大容量内存和硬盘。流媒体的制作和发送是系统资源的黑洞，拥有大容量内存是系统稳定运行的前提；而流媒体文件体积较大，大量的媒体文件需要更多的存储空间。建议内存至少256MB，硬盘80G以上。 </span></p>
<p><span style="font-size: 10pt">占用系统资源少的声卡。好的声卡有助于CPU占用率的降低，并且对录音的质量有很大影响（用于网上直播），建议使用Creative的SB Live!或SB Audigy、Audigy 2系列，由于笔者自己的机器不做服务器（只用来做文章，没钱升级啊），所以只拿普通的集成来演示。 <br />
良好的视频捕捉设备。我们的直播节目源就来源于这块设备，推荐使用Leadtek（丽台）的WinFast TV2000 XP豪华版，它接收信号的能力和硬件压缩的能力都是比较出众的（因为笔者没有条件，所以采集设备用了屏幕捕捉，不过使用采集设备的方法是相同的，所以请大家不要见怪）。 </span></p>
<p><span style="font-size: 10pt">尽量高的带宽。当然是上网速度越快越好，不过我们可以在流媒体服务器中对连接数做一个限制，以免当机。 </span></p>
<p><span style="font-size: 10pt">当然，上面是建设一个属于自己的流媒体服务网站必须的硬件设备，如果只是和笔者一样，只是想在架设流媒体服务器过程中学习一把，大可在现有机器的基础上大胆测试。 </span></p>
<p><span style="font-size: 10pt"><strong>四、架设流媒体服务器之旅</strong> </span></p>
<p><span style="font-size: 10pt">准备好了硬件，下面就开始一步步教大家架设自己的流媒体服务器。我将其分为Microsoft公司的Windows Media和RealNetworks的Real Media两大部分，都包括直播与点播服务器的建立，并在最后向大家介绍一下Apple的QuickTime和Nullsoft的流媒体服务器。 </span></p>
<p><span style="font-size: 10pt">由于Microsoft公司的Windows Media点播服务必须建立在Server版的操作系统上，所以笔者选取Windows .Net Enterprise Server 3647作为此次流媒体服务器建立的系统平台。为了比较RealNetworks和Microsoft最新一代流媒体服务器的优劣，笔者采用了它们最新的流媒体系统，以下是笔者使用的具体软件： </span></p>
<p><span style="font-size: 10pt">操作系统：Windows .Net Enterprise Server 3647、Windows XP Service Pack 1 <br />
流媒体软件：Windows Media Services 9.0(Windows .Net Server自带)、Windows Media Encoder 9 Series Release Candidate(由于此软件在.Net Server下运行不正常，故安装在XP中，并且只有此软件安装在XP中)、Windows Media Encoder 7.1、Windows Media Player 9.0 Build z903、Helix Universal Server 9.01 FOR Win2k(9.0.2.794)、Helix Producer Plus 9.0.1、RealOne Player 2.0 Build 6.0.11.853。 </span></p>
<p><span style="font-size: 10pt">下面，就让我们开始吧！不要走开哦！！！ </span></p>
<p><span style="font-size: 10pt">WinMedia网上广播服务 </span></p>
<p><span style="font-size: 10pt">单纯的使用Windows Media Encoder这个软件即可实现网上广播服务，不过，借助于Windows Media Services，利用Windows Media Encoder制作的流媒体文件，我们的网络广播站功能将更为强大。下面，我们将利用Windows Media Encoder单独建立广播站，并将其纳入Windows Media Services，实现更强大的功能。 </span></p>
<p><span style="font-size: 10pt">1. 安装Windows Media Services。 </span></p>
<p><span style="font-size: 10pt">首先安装Windows 2000 Server或者Windows .Net Server，然后打开&#8220;开始－控制面板－管理工具－管理您的服务器&#8221;或&#8220;开始－控制面板－添加或删除程序－添加/删除Windows组件&#8221;（建议使用第二种），在其中勾取&#8220;Web应用程序服务器&#8221;，也就是2000 Server中的IIS服务器，单击&#8220;下一步&#8221;进行添加； </span></p>
<p><span style="font-size: 10pt">添加IIS完毕后，再次启动添加/删除Windows组件程序，并勾取Windows Media Service项，单击详细信息，在其中选择&#8220;用于Web的Windows Media Services Administrator&#8221;以启动Windows Media Services的Web管理功能（2000中可能没有这些选项，只需要安装Windows Media Services即可）； </span></p>
<p><span style="font-size: 10pt">2. 安装Windows Media Encoder。 </span></p>
<p><span style="font-size: 10pt">从微软网站下载Windows Media Encoder 7.1（由于Windows Media Encoder 9.0无法在.Net Server下工作）进行安装，至此，Windows Media服务的服务器和编码器都已经具备；</span></p>
<p><span style="font-size: 10pt">3. 从&#8220;开始－程序－Windows Media&#8221;　　启动Windows Media Encoder，在出现的向导界面中根据自己的需要选择合适的选项，建议新手&#8220;使用新建会话向导广播、捕获或转换文件&#8221;，选择后单击确定； </span></p>
<p><span style="font-size: 10pt">4. 由于进行的是广播，所以在下一个弹出的画面中请选择&#8220;在附属设备或计算机屏幕广播实况事件&#8221;，这样的选择能够让Windows Media Encoder直接进行广播或者将其加入Windows Media Service服务； </span></p>
<p><span style="font-size: 10pt">5. 在下一个画面中选择您进行视频或音频捕获的设备，笔者没有视频卡，所以只能选择&#8220;屏幕捕获&#8221;，有视频卡的朋友请选择您的视频卡；</span></p>
<p><span style="font-size: 10pt">6. 广播信号必须通过一个有效的端口进行传输，因此必须对它进行设置。Windows Media Encoder默认的端口为8080，但由于这个端口经常被其它软件占用，所以建议朋友们单击&#8220;查找可用端口&#8221;以换成其它随机端口或者直接输入没有被占用的端口。我选择了&#8220;3170&#8221;端口； </span></p>
<p><span style="font-size: 10pt">7. 然后就开始选择我们进行广播的流媒体质量，有一个公式您可以参考：流媒体配置文件带宽&#215;最大连接用户数＝您的上行带宽（不是下载，是上传）。您如果有2Mbps的上行带宽，选择了100Kbps的配置文件，则允许同时20个观众看到您的广播，由此可见，流媒体服务对带宽的需求是巨大的； </span></p>
<p><span style="font-size: 10pt">8. 在这个窗口您可以选择将进行广播的流媒体存档，以便于以后观看或者进行点播，若只是作为实况广播服务，并且硬盘空间不大，您可以不选取； </span></p>
<p><span style="font-size: 10pt">9. &#8220;下一步&#8221;后，您可以选择是不是添加微软内置的欢迎、休息和再见文件，我就没要这些东西，谁给微软免费作广告，呵呵； </span></p>
<p><span style="font-size: 10pt">10. 然后，我们可以给我们的广播节目添加上版权信息，这些信息在播放时，会出现在Windows Media Player中； </span></p>
<p><span style="font-size: 10pt">11. 弹出最后一个确认窗口后，我们最终的广播界面就出现了，若是有视频捕捉设备，只要单击&#8220;开始&#8221;，我们的广播站就运行起来，只要在客户机IE中输入&#8220;mms://服务器的：端口值&#8221;就会弹出media player播放电视。如我建立的广播站地址就是&#8220;mms://192.168.0.1:3170，这些信息您也可以直接在此界面的连接标签中查看； </span></p>
<p><span style="font-size: 10pt">12. 若是您和我一样没有视频捕捉设置，或者想向用户播放一段录制好的视频，请点击&#8220;会话－属性&#8221;（此面板能够对所有设置过的数据进行调整），单击&#8220;更改&#8221;按钮，在弹出窗口中选择视频右边的下拉框，单击&#8220;查找文件&#8221;，找到您预先录制好的视频文件（支持asf、wmv、avi、mpg等格式）； </span></p>
<p><span style="font-size: 10pt">13. 再回到广播界面，点击开始，您的文件就可以被网络上的兄弟姐妹看到了， </span></p>
<p><span style="font-size: 10pt">若是想添加更多的文件或设备，请在以上窗口单击&#8220;更改&#8221;旁的&#8220;新建&#8221;进行添加即可；</span></p>
<p><span style="font-size: 10pt">14. 您可能觉得到这里我们就大功告成了，实际上远远没有，这只是最基本的直播广播，我们还需要将其加入Windows Media Services的广播服务中，以实现更强大的功能。请将你的鼠标指向&#8220;开始－控制面板－管理工具－Windows Media Services&#8221;，打开Windows Media管理器（2000 Server应该是一个Web界面）。选择左边的服务器后，单击操作菜单中的&#8220;添加发布点（向导）&#8221;，经历欢迎页面后，会出现发布点命名窗口，在其中输入您愿意使用的名字，我输入的是&#8220;SOFTICP.COM_Broadcast&#8221;； </span></p>
<p><span style="font-size: 10pt">15. 在下一个窗口中，将让您选择所要发布的内容类型，如果只是单纯的进行流媒体直播，就选择&#8220;编码器（实况流）&#8221;，若是想在实况流中加入其它制作好的文件，请选择&#8220;播放列表&#8221;，若是想建立视频点播服务器，请选择&#8220;目录中的文件&#8221;。由于我有现成的制作好的文件，所以选择了&#8220;播放列表&#8221;； </span></p>
<p><span style="font-size: 10pt">16. 选择完了发布内容的类型，就要选择发布的方案，我们进行的是网络广播的服务，当然要选择&#8220;广播发布点&#8221;。在接下来的窗口中，我们要选择内容的传递方式，看到了吧，这次我们前面介绍的单播和组播的基本概念起了作用，我们的网络一般不支持组播，所以要选择&#8220;单播&#8221;； </span></p>
<p><span style="font-size: 10pt">17. 若是您以前有创建好的播放列表文件（wsx或htm文件），直接在下一个窗口中选择&#8220;现有播放列表&#8221;，若是没有，请跟我一样，&#8220;新建播放列表后进行添加&#8221;。在添加窗口中，可以添加文件、编码器的实况流、远程发布点的流媒体、ASP、CGI的动态源等多种媒体，并且还可以添加广告信息以及调整媒体的播放顺序； </span></p>
<p><span style="font-size: 10pt">18. 完成播放列表的编辑后，点击&#8220;下一步&#8221;将播放列表保存成文件，并且在下一个窗口中可以选择是否&#8220;循环播放&#8221;或&#8220;无序播放&#8221;这些流媒体。再经历几个确认框，您就完成了Windows Media流媒体广播服务器的建立，为了快捷，我们就将&#8220;完成此向导后启动其它向导&#8221;前面的对勾去掉吧！ </span></p>
<p><span style="font-size: 10pt">19. 服务器启动后，您就可以在Windows Media Player中输入&#8220;mms://服务器IP/发布点名称&#8221;观看网络广播了。而在Windows Media Services的管理器中，我们可以随时监视流媒体的播放情况、添加/删除与调整播放列表、插入广告、发布公告（可以直接生成htm页面）、调整该广播站的属性等操作，并可以随时通过下面的按钮启动与停止广播站以及测试当前流媒体是否正常； </span></p>
<p><span style="font-size: 10pt">此图是使用公告向导建立的发布点公告网页，是不是非常方便？ </span></p>
<p><span style="font-size: 10pt">20. 我们还可以通过在浏览器中输入管理器的网址或者直接启动管理工具中的&#8220;Windows Media Services(Web)&#8221;来对整个流媒体服务器进行Web管理以及远程管理，其管理界面与本地管理除了少几个功能外，几乎没有差别。 </span></p>
<p><span style="font-size: 10pt">远程管理还可以对一个服务器组多台服务器进行管理。</span></p>
<p><span style="font-size: 10pt">&nbsp;至此，我们的Windows Media网络广播服务器已经完全建设完毕，您已经拥有了一个具有强大功能的网络广播站，是不是觉得不过瘾？因为还有许多优秀的影片想和朋友们共享，并且想让他们能够自由的观赏自己喜欢的节目，不受你广播时间表的限制？那么，跟我来，我们在此基础上再搭建一个Windows Media视频点播服务器。</span></p>
</span></div><img src ="http://www.blogjava.net/rain1102/aggbug/246840.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/rain1102/" target="_blank">Eric.Zhou</a> 2008-12-17 13:17 <a href="http://www.blogjava.net/rain1102/archive/2008/12/17/246840.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AMF介绍</title><link>http://www.blogjava.net/rain1102/archive/2008/12/14/246245.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Sun, 14 Dec 2008 10:02:00 GMT</pubDate><guid>http://www.blogjava.net/rain1102/archive/2008/12/14/246245.html</guid><wfw:comment>http://www.blogjava.net/rain1102/comments/246245.html</wfw:comment><comments>http://www.blogjava.net/rain1102/archive/2008/12/14/246245.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/rain1102/comments/commentRss/246245.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/rain1102/services/trackbacks/246245.html</trackback:ping><description><![CDATA[AMF(Action Message Format)是一种 binary format的资料型态，透过 AMF over HTTP的方式将flash端资料编码后传回server，server端的remoting adaptor接收到资料后则会译码回正确的native对象，交给正确的程序处理。<br />
AMF除了用于Flash remoting外，也广泛的用于 Local Connection 与 Flash communication server，它最大的特色在于可直接将flash native object，例如Object, Array, Date, XML，传回server端，并且在server端自动进行转译成适当的对象，例如flash 的Array传回PHP时就会自动转换为 Associative Array；这个特色对开发者最大的好处在于不需要再人工处理serialization 与 deserialization的繁复工作，不但精确度更高，同时开发也更省时间。<br />
由于AMF是binary format并且编码时经过高度压缩，因此非常适合用来传递大量的资料，根据flashorb网站的测试(主要针对web service与flash remoting)，当资料量越大时，flash remoting的传输效能就越高，远远超过web service的表现，因此同样的道理也可得知xml, loadVars, loadVariables 等使用plaine text format的传输方式自然也无可比拟<br /><img src ="http://www.blogjava.net/rain1102/aggbug/246245.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/rain1102/" target="_blank">Eric.Zhou</a> 2008-12-14 18:02 <a href="http://www.blogjava.net/rain1102/archive/2008/12/14/246245.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Papervision3D基础I[转载]</title><link>http://www.blogjava.net/rain1102/archive/2008/11/12/240172.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Wed, 12 Nov 2008 13:59:00 GMT</pubDate><guid>http://www.blogjava.net/rain1102/archive/2008/11/12/240172.html</guid><wfw:comment>http://www.blogjava.net/rain1102/comments/240172.html</wfw:comment><comments>http://www.blogjava.net/rain1102/archive/2008/11/12/240172.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/rain1102/comments/commentRss/240172.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/rain1102/services/trackbacks/240172.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: （简称PV3D）Papervision3DPV3D是一个开源的遵循MIT协议的使用AS3代码写成的3D引擎。这篇文章旨在教会各位如何使用PV3D完成一个HELLOWORD式的3D程序，同时也是这篇教程的最近更新。PV3D2.0 Alpha(也称GW)对于初学者来说使用PV3D最大的障碍在于如何安装PV3D，由于对版本控制软件不熟是造成无法完成PV3D安装的主要原因，第一部分的三节阐述了这个...&nbsp;&nbsp;<a href='http://www.blogjava.net/rain1102/archive/2008/11/12/240172.html'>阅读全文</a><img src ="http://www.blogjava.net/rain1102/aggbug/240172.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/rain1102/" target="_blank">Eric.Zhou</a> 2008-11-12 21:59 <a href="http://www.blogjava.net/rain1102/archive/2008/11/12/240172.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Installing Papervision3D on Flash and Flex </title><link>http://www.blogjava.net/rain1102/archive/2008/11/12/240110.html</link><dc:creator>Eric.Zhou</dc:creator><author>Eric.Zhou</author><pubDate>Wed, 12 Nov 2008 08:19:00 GMT</pubDate><guid>http://www.blogjava.net/rain1102/archive/2008/11/12/240110.html</guid><wfw:comment>http://www.blogjava.net/rain1102/comments/240110.html</wfw:comment><comments>http://www.blogjava.net/rain1102/archive/2008/11/12/240110.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/rain1102/comments/commentRss/240110.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/rain1102/services/trackbacks/240110.html</trackback:ping><description><![CDATA[There are quite a few articles out there discussing Papervision3D and sharing source code, etc. but very few explain in plain English how to actually get started with PV3D. For those of us that aren&#8217;t geeky enough to guess our way into getting it to work we are usually left in a dust of confusion. Papervision3D, if you aren&#8217;t familiar with it, is a way to do 3D inside Flash - it&#8217;s extensive, cutting edge and very well laid out. More and more sites are popping up on the web utilizing this technology&#8230; so what are you waiting for? It is up to you to decide which IDE you are going to use to do Papervision3D development. I will be explaining how to install it in both Flash and Flex, afterwards you&#8217;d be ready to start creating projects and learn from other examples.
<h2>Getting Started</h2>
The first thing you need to understand is that in both Flash and Flex there are 2 ways to access the source needed for your Papervision3D project. One way of doing this is getting the compiled source code that you&#8217;d use in Flash as an .mxp component or in Flex as a .swc library. The other method is using the non-compiled source code. I am going to suggest that you stick to using the non-compiled source code since the code is not encapsulated, you can easily go into your classes and modify them if needed. If you do not care about modifying the source code then you can stick to using the compiled versions. I will be explaining how to get the compiled versions for the application specific steps, if you&#8217;re planning on using that then skip the Subversion Control step (Flex needs Subversion in either case). If you&#8217;re going to use the non-compiled source in Flash or setting up in Flex then continue.
<h3>Download the source through SVN(Subversion Control)</h3>
You need to get the source from a SVN. To some Windows and Mac users this concept may sound confusing. It&#8217;s not like downloading a zip from a hyperlink or a specific file. It&#8217;s a well known concept in the open-source community so if you&#8217;ve used Linux before this is probably familiar to you. The official <a href="http://code.google.com/p/papervision3d/">Papervision3D SVN</a> is hosted at <a href="http://code.google.com/">Google Code</a>: You can get the SVN URL for all the links by going to <a href="http://code.google.com/p/papervision3d/source/checkout">http://code.google.com/p/papervision3d/source/checkout</a> but you can just type this in your SVN application (which I&#8217;ll explain below) to get the files you need.
<ul>
    <li><code>http://papervision3d.googlecode.com/svn/trunk/branches/ GreatWhite/</code> </li>
</ul>
<h4>Windows</h4>
Many other Papervision3D users have recommended TortoiseSVN and I agree with them, It&#8217;s a great tool for SVN source downloading using Windows. You can go to TortoisSVN&#8217;s site here: <a href="http://tortoisesvn.net/">Click here</a> Download the latest version directly from sourceforge: <a href="http://sourceforge.net/projects/tortoisesvn/">Click here</a> Proceed with the article once you&#8217;ve downloaded and installed you can the package. What you need to do now is create a folder, for example inside your work directory or root drive, called &#8220;Papervision3D&#8221; or &#8220;PV3DSource&#8221;. You&#8217;ll be using this folder to download the SVN. Once you&#8217;re inside you need to right click to open the folder properties menu; you&#8217;ll notice that there is 2 new options. Select &#8220;SVN Checkout&#8221; to proceed. You&#8217;ll see a input box labeled: &#8220;URL of repository&#8221; - (This is all you need to be concerned about). Add the SVN URL and let it run, it might take a couple of minutes to complete depending on your connection. Now you have the needed files to continue.
<h4>Mac</h4>
I&#8217;m not a Mac user but I did some investigation, this might or might not be useful, so if there is anyone that would like to contribute to this part of the article just leave a comment. I found this SVN client called &#8220;svnX&#8221; and its opensource so it should get the job done. Here&#8217;s a quote from their site:
<blockquote><span>An open-source GUI for Subversion, the compelling replacement for CVS. It allows you to browse your working copies, spot changes, and operate on them, but also to browse logs and revisions of your repositories!</span></blockquote>You can go to svnX&#8217;s site here: <a href="http://www.apple.com/downloads/macosx/development_tools/svnx.html">Click here</a> The first thing you need to do is click on &#8220;SVN Checkout&#8221; and set a directory for your Papervision source directory. Once you have done that you should be ago to the &#8220;Repositories&#8221; window and add the SVN URL. Let the download run and once it&#8217;s finished and you see all the files you are ready to continue.
<h2>Installing on Flash</h2>
This will be split into 2 parts depending on which source you decided to settle on. If you decided on using the Flash Component then continue, if you prefer using the non-compiled source code skip the following step.
<h3>Using the .mxp Component</h3>
<h4 style="color: red">(NB: At the time of writing this the .mxp is Version 1.5 and not 2.0)</h4>
If you&#8217;re still not 100% whether you want to use the component, I might be able to put your mind to rest. There are some benefits to using the component and John Grden from <a href="http://www.rockonflash.com/blog/">Rock On Flash</a> explains it very well <a href="http://www.rockonflash.com/blog/?p=54">here</a>
<blockquote><span># Design-time render and editing in Flash IDE # 3 Material types supported - BitmapFileMaterial, BitmaAssetMaterial and MovieAssetMaterial # Creates MovieScene3D and Free or Target camera # Manages resizing / centering of Papervision3D scene [optional] # Dynamic masking to constrain the viewable render area to the bounds of the component [optional] # Full API and access to Scene, Camera, Collada objects to code around # Automatically loads materials via Collada file [when materials list is not given] # New Custom Panel for modifying rotation, camera zoom, camera focus, camera Z at design-time</span></blockquote>You can download the Flash components from <a href="http://code.google.com/">Google Code</a> under the downloads tab. Download the latest file, it should look something like this - PV3DComponents_v#####.mxp Once you&#8217;ve downloaded the file you can run the .mxp as an executable. It will automatically open &#8220;Adobe Extension Manager&#8221; and ask you to accept an agreement and then it will install itself. If you have Flash already running you&#8217;ll have to restart to see the changes. You can create a new document inside Flash (AS3 Document) to get started. I won&#8217;t be showing you how to create anything in this article as the purpose is to show you how to install. What I will do, however, is show you which menus you can access with the Papervision3D .mxp. First off, everything is listed under Window &gt; Components, there you can either choose to create a Papervision 3D scene or Papervision 3D Collada scene. If you&#8217;re planning on using the Collada component you can access a very nice GUI menu which lets you set the location, camera, rotation, etc. You can access this by going to Window &gt; Other Panels &gt; PV3DPanel. When you&#8217;ve installed the .mxp you already have complete access to the classes in Papervision3D so there is nothing else you need to worry in terms of set-up.
<h3>Using the non-compiled source code</h3>
If you&#8217;ve already installed the .mxp file you can skip this part. Getting the non-compiled source code running with Papervision is painless. You can decide whether you want to set up Papervision3D for any project you create or for individual projects. It is best practice to set up PV3D on each individual project so I&#8217;ll explain how to do this. Create a new document inside Flash (AS3 Document) to get started. Click on &#8220;Publish: Settings&#8221; in your properties menu, if you don&#8217;t have a properties menu you can open it through Window &gt; Properties. A publish settings window will open on the &#8220;Flash&#8221; tab; select &#8220;Actionscript&#8221; on the left hand side. All you need to do now is click on the &#8220;+&#8221; symbol and specify the directory of your source. If you used the &#8220;svn/trunk/branches/ GreatWhite/src&#8221; URL in your SVN client then you can link to the folder you created to download the files, otherwise you need to navigate to the /src dir. And that&#8217;s it! Your scene file will now work with the Papervision3D classes.
<h2>Installing on Flex</h2>
The implementation of Papervision3D in Flex is similar of that in Flash in terms of the fact that you can choose between compiled and non-compiled source. We&#8217;ll start with the compiled version, (.swc file)
<h3>Using the compiled .swc library</h3>
<h4 style="color: red">(NB - The compiled .swc has been removed from the SVN until it goes out of Alpha, it is recommended you use the non-compiled source-code in the meantime since its easier to update. If you still want the .swc you can download it from <a href="http://www.fabianvercuiel.com/blogContent/papervision3D/PaperVision3D.swc">here</a>)</h4>
<div style="color: #cccccc"><span style="color: #0c0000">Lets get started - Create a new project by going to File &gt; New &gt; Flex Project Specify a name for your project and a project location and leave the rest on default, click Next, specify a debug directory and click Next again. Select the &#8220;Library&#8221; tab and click the &#8220;Add SWC&#8221; button. Navigate to the directory you created for your Papervision3D source, go to your Greatwhite directory in branches and click on the bin folder, which contains the swc file you need. All that&#8217;s left to do now is click &#8220;Finish&#8221; and your project is Papervision3D ready. Even though your project will run fine with the .swc file specified as a library it is best practice by creating a Flex library project which you can re-use. In describing how to set up the non-compiled source code with a Flex Library project below you can apply the same principle using a .swc file. </span></div>
<h3>Using the non-compiled source code</h3>
The first thing we need to do is set up a Flex Library project so that we can re-use the same Papervision3D source for every project. This practice is better since you can update, modify and manage the source code all from one location. Create a new Library Project by going to File &gt; New &gt; Flex Library Project Specify a name, something like &#8220;Papervision Library&#8221; would do, you need something that is descriptive so you can refer back in future projects. The project folder should navigate to the Greatwhite directory under branches in your source folder. Click Next. If you specified the folder correctly you will notice that you have classes listed in your classes tab. Select &#8220;src&#8221; and you will notice it populating. After you have done this you have to browse to the main source folder and select &#8220;src&#8221;. Click Fnish and your Papervision3D Flex library project is ready to go! Now that you have your Flex Library Project ready we need to have a project utilize this library. Create a new Project by going to File &gt; New &gt; Flex Project. Specify a name for your project and a project location and leave the rest on default, click Next, specify a debug directory and click Next again. Under the Library path tab click on &#8220;Add Project&#8221; and you will see that your newly created Flex Library Project for Papervision is listed, select your library project. Click Finish and you&#8217;re ready to go! Your Flex Project should now communicate with your Flex Library project, review the image below and see whether your project structure looks similar.
<h2>Conclusion</h2>
When I started this guide I was not aware that there would be so many ways to set up a Papervision3D project, hopefully this is as informative to you as it has been for me. I have done a lot of research on Google and I keep finding what I just explained to you described in 3-4 short sentences, maybe I&#8217;m the only one that found this complicated in the beginning. I would love to hear back from you to know whether this article has proved useful.<img src ="http://www.blogjava.net/rain1102/aggbug/240110.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/rain1102/" target="_blank">Eric.Zhou</a> 2008-11-12 16:19 <a href="http://www.blogjava.net/rain1102/archive/2008/11/12/240110.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>