| 发表于:2008-01-17 17:27:33 楼主 |
1. 我现在要在客户端播放一个实时的视频流,source配置:rtmp:/test/lecture1,在action中加入了代码:flvplayer.islive = true;在服务器端的test目录下放置了main.asc,其中的代码如下main.asc摘自官方sample) copyright 2004 macromedia, inc. all rights reserved. the following is sample code and is subject to all restrictions on such code as contained in the macromedia flash communication server mx 1.5 end user license agreement . */ application.onappstart = function() { // generate random payload used in bw detection this.payload = new array(); for (var i=0; i <1200; i++){ this.payload[i] = math.random(); //16k approx } } application.onconnect = function(p_client, p_autosensebw) { //add security here p_client.writeaccess = ""; // prevents creating shared object or live streams. this.acceptconnection(p_client); if (p_autosensebw) this.calculateclientbw(p_client); else p_client.call("onbwdone"); } client.prototype.getstreamlength = function(p_streamname) { return stream.length(p_streamname); } client.prototype.checkbandwidth = function() { application.calculateclientbw(this); } application.calculateclientbw = function(p_client) { var res = new object(); res.latency = 0; res.cumlatency = 1; res.bwtime = 0; res.count = 0; res.sent = 0; res.client = p_client; var stats = p_client.getstats(); var now = (new date()).gettime()/1; res.paksent = new array(); res.pakrecv = new array(); res.beginningvalues = {b_down:stats.bytes_out, b_up:stats.bytes_in, time:now}; res.onresult = function(p_val) { var now = (new date()).gettime()/1; this.pakrecv[this.count] = now; trace("** onresult this.count = " + this.count + " : this.sent " + this.sent); //trace( "packet interval = " + (this.pakrecv[this.count] - this.paksent[this.count])*1 ); this.count++; var timepassed = (now - this.beginningvalues.time); if (this.count == 1) { this.latency = math.min(timepassed, 800); this.latency = math.max(this.latency, 10); } //trace("count = " + this.count + ", sent = " + this.sent + ", timepassed = " + timepassed); // if we have a hi-speed network with low latency send more to determine // better bandwidth numbers, send no more than 6 packets if ( this.count == 2 && (timepassed <2000)) { this.paksent[res.sent++] = now; this.cumlatency++; this.client.call("onbwcheck", res, application.payload); } else if ( this.sent == this.count ) { // see if we need to normalize latency if ( this.latency > = 100 ) { // make sure we detect sattelite and modem correctly if ( this.pakrecv[1] - this.pakrecv[0] > 1000 ) { this.latency = 100; } } // got back responses for all the packets compute the bandwidth. var stats = this.client.getstats(); var deltadown = (stats.bytes_out - this.beginningvalues.b_down)*8/1000; var deltatime = ((now - this.beginningvalues.time) - (this.latency * this.cumlatency) )/1000; if ( deltatime <= 0 ) deltatime = (now - this.beginningvalues.time)/1000; var kbitdown = math.round(deltadown/deltatime); trace("onbwdone: kbitdown = " + kbitdown + ", deltadown= " + deltadown + ", deltatime = " + deltatime + ", latency = " + this.latency + "kbytes " + (stats.bytes_out - this.beginningvalues.b_down)/1024) ; this.client.call("onbwdone", null, kbitdown, deltadown, deltatime, this.latency ); } } res.paksent[res.sent++] = now; p_client.call("onbwcheck", res, ""); res.paksent[res.sent++] = now; p_client.call("onbwcheck", res, application.payload); }以上为全部设置,可是运行之后就是不能播放,请高手帮忙分析一下是哪里出问题了?(播放服务器上的flv文件没问题) 2. 组件中的全屏按钮不起作用.......... |
|
|
|
|