Re: [flexcoders] Re: Buffer progress bar for streaming FLV

2006-09-01 Thread Abdul Qabiz



VideoDisplay is just wrapper around VideoPlayer. I think, Flex 2 is great because you get source code. So you can extend things rather than using workarounds or hacks...Thanks to Adobe for making SDK free and this indeed has advantage over last version (Flex 
1.5).I am not promising but If I get time, I would write a simple Video component that can handle different type of FLV playback (RTMP, HTTP, PHP/Lighttpd FLV streaming). Which would be easy to use and customize. I feel, VideoDisplay component is quite complicated and big for unknown reasons.
I can not post my current code due to some reasons (company, employer etc). I have classes to handle RTMP, Progressive download, Lighttpd FLV streaming; all of these use same interface and events. There is factory which creates required stream transparently. Basically, UI doesn't need to know about specific streams.
Hope this give some idea, if you want to implement something reuseable, lightweight and compact...-abdulOn 9/1/06, greg h 
[EMAIL PROTECTED] wrote:












  



Wow Chris. You are way out ahead of me :-)

When Abdul mentioned in the other thread last week needing to hack the
code properly I figured it might be a bridge too far for me.

Any chance of your posting your solution over at http://www.onflex.org/code/

Regarding getting Adobe to add this type of functionality to the framework? Maybe Flex 3?

Congratulations again.

gOn 8/31/06, Chris Simeone 
[EMAIL PROTECTED] wrote:













  



Well, my hack worked.
 


I
created a new package in my project. Then I copied the Flex video
classes into the package folders and hacked those (about 50 lines of
code in 10 files - less not counting the package name changes). Then I
created a new video event - BUFFERINGPCT. The VideoEvent object now
contains a numeric property named bufferingProgress. The hack works
like a charm!

Now I can track buffering progress using my hacked version of the mx:videoDisplay component.

The question is how do I get Adobe to add this type of functionality to the framework?

Greg  Abdul, thanks for all your responses. I learned much and I hope other find this thread useful.


  Chris
  


  















__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



[flexcoders] Re: Buffer progress bar for streaming FLV

2006-09-01 Thread Chris Simeone
Greg - I'll upload the code sometime today or tonight.

Impudent1 - I'll create a new post sometime today or tonight talking
about what I did.  

I'm starting a new website  blog (www.flexdojo.com). Since it's a
site about FLEX I want to be 100% FLEX based. I'll see if I can 
get more detailed up there over the weekend.

What I've been writing is a video/slide/workbook player. The Video
player is on the left, the slide player is on the right and the 
fill-in-the-blank workbook component under both. The slide player and
workbook are kept in sync with the video using cue points. 

Everything about the slides (content, cue points, properties,
backgrounds, transitions, style names and so much more) are defined in
an XML file. The same goes for the workbook component. It's very
dynamic. It's a great project and I still have much work to do.

My C#, Java, JavaScript background has been a huge help understanding
Flex, which I just started coding in June. I still have tons to learn,
but of all the languages I've worked with in my 20+ years of coding,
Flex 2.0 has become my favorite. I have not been this excited about
programming in a while!

Chris

--- In flexcoders@yahoogroups.com, Chris Simeone [EMAIL PROTECTED] wrote:

 Hi All,
 
 I've been trying to create a Buffering progress bar for streaming
 FLV (via FMS) with the mx:videoDisplay component. But, the
 videoDisplay is not firing progress events for some odd reason. So I
 changed my strategy and started using the netStream object.
 
 The video is streaming via FMS, but the netStream bytesLoaded and
 bytesTotal properties are always zero. Any ideas what I may be doing
 wrong. The code's below. 
 
 Also, it would be great if anyone can show how to pull this of with
 the mx:videoDisplay component as well!!!
 
 Thanks!
 Chris
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns=*
 layout=vertical horizontalAlign=left
 creationComplete=onCreationComplete();
   mx:Script
   ![CDATA[
   

//
   import mx.events.VideoEvent;
   import myComponents.*;
   import flash.events.*;
   import flash.net.*;
   import flash.media.Video;
   import mx.controls.*;
   import mx.core.UIComponent;
   

//
   private var nc:NetConnection;
   private var stream:NetStream;
   private var fmsUrl:String;
   private var flvName:String;
   private var video:Video;
   private var loaded_interval:Number;
   

//
   NetConnection.defaultObjectEncoding = 
 flash.net.ObjectEncoding.AMF0;
   

//
   public function onCreationComplete():void
   {
   nc = new NetConnection();
   configureListeners(nc);
   
   var videoHolder:UIComponent = new UIComponent();
   videoHolder.setActualSize(700, 525);
   
   video = new Video();
   configureListeners(video);
   
   videoHolder.addChild(video);
   video.x = 0;
   video.y = 0;
   
   fmsUrl = rtmp://localhost/test_video;
   flvName = testVideo;
   theBox.addChild(videoHolder);
   nc.connect(fmsUrl);
   }
   /
   private function 
 configureListeners(dispatcher:IEventDispatcher):void 
   {
   
 dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
 onSecurityError);
   dispatcher.addEventListener(AsyncErrorEvent.ASYNC_ERROR,
onAsyncError);
   dispatcher.addEventListener(NetStatusEvent.NET_STATUS, 
 onNetStatus);
   dispatcher.addEventListener(ProgressEvent.PROGRESS, 
 onProgress);
   dispatcher.addEventListener(Event.ENTER_FRAME, 
 onEnterFrame);
   }
   /
   private function connectStream():void 
   {
   if (stream) 
   stream.close();
 
   stream = new NetStream(nc);
   configureListeners(stream);
   video.attachNetStream(stream);
   stream.bufferTime = 10;
   stream.play(flvName);
   

[flexcoders] Re: Buffer progress bar for streaming FLV

2006-08-31 Thread Chris Simeone
So, does the following summary sound right?

1) I can't create a progress bar that shows buffering progress as long
as I use the mx:videoDisplay component (I'm hoping my assumption on
this point is wrong). 

2) I have to use the netStream objects if I want to create a buffering
progress bar, because that's the only way I can access the streams
time and bufferLength properties.

Thanks!
Chris

--- In flexcoders@yahoogroups.com, Chris Simeone [EMAIL PROTECTED] wrote:

 Hi All,
 
 I've been trying to create a Buffering progress bar for streaming
 FLV (via FMS) with the mx:videoDisplay component. But, the
 videoDisplay is not firing progress events for some odd reason. So I
 changed my strategy and started using the netStream object.
 
 The video is streaming via FMS, but the netStream bytesLoaded and
 bytesTotal properties are always zero. Any ideas what I may be doing
 wrong. The code's below. 
 
 Also, it would be great if anyone can show how to pull this of with
 the mx:videoDisplay component as well!!!
 
 Thanks!
 Chris
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns=*
 layout=vertical horizontalAlign=left
 creationComplete=onCreationComplete();
   mx:Script
   ![CDATA[
   

//
   import mx.events.VideoEvent;
   import myComponents.*;
   import flash.events.*;
   import flash.net.*;
   import flash.media.Video;
   import mx.controls.*;
   import mx.core.UIComponent;
   

//
   private var nc:NetConnection;
   private var stream:NetStream;
   private var fmsUrl:String;
   private var flvName:String;
   private var video:Video;
   private var loaded_interval:Number;
   

//
   NetConnection.defaultObjectEncoding = 
 flash.net.ObjectEncoding.AMF0;
   

//
   public function onCreationComplete():void
   {
   nc = new NetConnection();
   configureListeners(nc);
   
   var videoHolder:UIComponent = new UIComponent();
   videoHolder.setActualSize(700, 525);
   
   video = new Video();
   configureListeners(video);
   
   videoHolder.addChild(video);
   video.x = 0;
   video.y = 0;
   
   fmsUrl = rtmp://localhost/test_video;
   flvName = testVideo;
   theBox.addChild(videoHolder);
   nc.connect(fmsUrl);
   }
   /
   private function 
 configureListeners(dispatcher:IEventDispatcher):void 
   {
   
 dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
 onSecurityError);
   dispatcher.addEventListener(AsyncErrorEvent.ASYNC_ERROR,
onAsyncError);
   dispatcher.addEventListener(NetStatusEvent.NET_STATUS, 
 onNetStatus);
   dispatcher.addEventListener(ProgressEvent.PROGRESS, 
 onProgress);
   dispatcher.addEventListener(Event.ENTER_FRAME, 
 onEnterFrame);
   }
   /
   private function connectStream():void 
   {
   if (stream) 
   stream.close();
 
   stream = new NetStream(nc);
   configureListeners(stream);
   video.attachNetStream(stream);
   stream.bufferTime = 10;
   stream.play(flvName);
   stream.client = this;
   }
   /
   private function onNetStatus(event:NetStatusEvent):void
   {
   trace(onNetStatus:  + event);
   switch (event.info.code) 
   {
case NetConnection.Connect.Success:
 
 trace(NetConnection.Connect.Success);
 connectStream();
 break;
case NetConnection.Connect.Failed:
 trace(NetConnection.Connect.Failed);
 

Re: [flexcoders] Re: Buffer progress bar for streaming FLV

2006-08-31 Thread Abdul Qabiz



Hi Chris,In VideoDisplay, you can subscribe to playheadUpdate event and use playheadTime, which is similar to NetStream.time.You can subscribe to stateChange event and watch BUFFERING in event handler, if you want to show BUFFERING status to user... 
-abdulOn 8/30/06, Chris Simeone [EMAIL PROTECTED] wrote:













  



Awesome!!! Worked perfectly. Thank You.

With all this in mind, is there a way to pull this of using the
mx:videoDisplay component? 

I created my app using that component but I could not figure out how
to access the stream. I figured I would do a rewrite using the
netStream object if necessary, but I would love to avoid doing that if
possible.

Thanks Again,
Chris
 

--- In flexcoders@yahoogroups.com, Michael Ritchie [EMAIL PROTECTED] wrote:

 Abdul is correct, you need to get the netstream time, use the
 following code for your enterframe function:
 
private function onEnterFrame(event:Event):void
{
if(stream == null) return;
var loadpct:Number = stream.bytesLoaded /
 stream.bytesTotal * 100;
trace(onEnterFrame:  + event +  Loaded:  +
 stream.time + %);
}
 
 stream.time will return the %
 
 - mr
 
 --- In flexcoders@yahoogroups.com, Abdul Qabiz abdul.qabiz@ wrote:
 
  Hi,
  
  bytesTotal and bytesLoaded are used when you use progressive flv
 download.
  In case of streaming (via FMS/FCS),
  your actual file is not downloaded rather bits are streamed over
 pipe
  
  To show buffer progress, you can use NetStream's bufferLength and
 bufferTime
  properties instead of bytesTotal/bytesLoaded.
  
  -abdul
  
  
  
  On 8/30/06, Chris Simeone simspace@ wrote:
  
 Hi All,
  
   I've been trying to create a Buffering progress bar for streaming
   FLV (via FMS) with the mx:videoDisplay component. But, the
   videoDisplay is not firing progress events for some odd
reason. So I
   changed my strategy and started using the netStream object.
  
   The video is streaming via FMS, but the netStream bytesLoaded and
   bytesTotal properties are always zero. Any ideas what I may be
doing
   wrong. The code's below.
  
   Also, it would be great if anyone can show how to pull this of with
   the mx:videoDisplay component as well!!!
  
   Thanks!
   Chris
  
   ?xml version=1.0 encoding=utf-8?
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml xmlns=*

   layout=vertical horizontalAlign=left
   creationComplete=onCreationComplete();
   mx:Script
   ![CDATA[
  
  

//
   import mx.events.VideoEvent;
   import myComponents.*;
   import flash.events.*;
   import flash.net.*;
   import flash.media.Video;
   import mx.controls.*;
   import mx.core.UIComponent;
  
  

//
   private var nc:NetConnection;
   private var stream:NetStream;
   private var fmsUrl:String;
   private var flvName:String;
   private var video:Video;
   private var loaded_interval:Number;
  
  

//
   NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
  
  

//
   public function onCreationComplete():void
   {
   nc = new NetConnection();
   configureListeners(nc);
  
   var videoHolder:UIComponent = new UIComponent();
   videoHolder.setActualSize(700, 525);
  
   video = new Video();
   configureListeners(video);
  
   videoHolder.addChild(video);
   video.x = 0;
   video.y = 0;
  
   fmsUrl = rtmp://localhost/test_video;
   flvName = testVideo;
   theBox.addChild(videoHolder);
   nc.connect(fmsUrl);
   }
   /
   private function
configureListeners(dispatcher:IEventDispatcher):void
   {
   dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
   onSecurityError);
   dispatcher.addEventListener(AsyncErrorEvent.ASYNC_ERROR,
 onAsyncError);
   dispatcher.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
   dispatcher.addEventListener(ProgressEvent.PROGRESS, onProgress);
   dispatcher.addEventListener(Event.ENTER_FRAME, onEnterFrame);
   }
   /
   private function connectStream():void
   {
   if (stream)
   stream.close();
  
   stream = new NetStream(nc);
   configureListeners(stream);
   video.attachNetStream(stream);
   stream.bufferTime = 10;
   stream.play(flvName);
   stream.client = this;
   }
   /
   private function onNetStatus(event:NetStatusEvent):void
   {
   trace(onNetStatus:  + event);
   switch (event.info.code)
   {
   case NetConnection.Connect.Success:
   trace(NetConnection.Connect.Success);
   connectStream();
   break;
   case NetConnection.Connect.Failed:
   trace(NetConnection.Connect.Failed);
 

Re: [flexcoders] Re: Buffer progress bar for streaming FLV

2006-08-31 Thread Abdul Qabiz



Hi,With VideoDisplay, you don't need to use onEnterFrame or any external Timer instance. Just subscribe to VideoDisplay's playheadUpdate event and do progress bar logic in event handler.-abdul
On 8/30/06, Chris Simeone [EMAIL PROTECTED] wrote:













  



Ok, Below is my updated onEnterFrame() method that updates a
progressBar component. It works great. Thanks again gang!

Now I'm going to try and get this working using the mx:videoDisplay
component. I'm not sure if I can get to its netStream object, so any
ideas/recommendations would be helpful and appreciated. 

Thanks!
Chris

		/
		private function onEnterFrame(event:Event):void
		{
			if(stream == null) return;
			if(duration == 0) return;
			var loadpct:Number = Math.round(Math.ceil((stream.time/duration)*100));

			if(loadpct=100)
			{
bar.setProgress(loadpct,100);
bar.label= CurrentProgress +   + loadpct + %;
loadpct+=10;
			}
			if(loadpct100)
			{
loadpct=0;
			}
			trace(onEnterFrame: Duration:  + duration +  Time:  +
stream.time +  Loaded:  + loadpct + %);
		}

--- In flexcoders@yahoogroups.com, Chris Simeone [EMAIL PROTECTED] wrote:

 Hi All,
 
 I've been trying to create a Buffering progress bar for streaming
 FLV (via FMS) with the mx:videoDisplay component. But, the
 videoDisplay is not firing progress events for some odd reason. So I
 changed my strategy and started using the netStream object.
 
 The video is streaming via FMS, but the netStream bytesLoaded and
 bytesTotal properties are always zero. Any ideas what I may be doing
 wrong. The code's below. 
 
 Also, it would be great if anyone can show how to pull this of with
 the mx:videoDisplay component as well!!!
 
 Thanks!
 Chris
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml xmlns=*
 layout=vertical horizontalAlign=left
 creationComplete=onCreationComplete();
 	mx:Script
 		![CDATA[
 	

//
 		import mx.events.VideoEvent;
 		import myComponents.*;
 		import flash.events.*;
 		import flash.net.*;
 		import flash.media.Video;
 		import mx.controls.*;
 		import mx.core.UIComponent;
 	

//
 		private var nc:NetConnection;
 		private var stream:NetStream;
 		private var fmsUrl:String;
 		private var flvName:String;
 		private var video:Video;
 		private var loaded_interval:Number;
 	

//
 		NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
 	

//
 		public function onCreationComplete():void
 		{
 			nc = new NetConnection();
 			configureListeners(nc);
 			
 			var videoHolder:UIComponent = new UIComponent();
 			videoHolder.setActualSize(700, 525);
 			
 			video = new Video();
 			configureListeners(video);
 			
 			videoHolder.addChild(video);
 			video.x = 0;
 			video.y = 0;
 			
 			fmsUrl = rtmp://localhost/test_video;
 			flvName = testVideo;
 			theBox.addChild(videoHolder);
 			nc.connect(fmsUrl);
 		}
 		/
 		private function configureListeners(dispatcher:IEventDispatcher):void 
 		{
 			dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
 onSecurityError);
 			dispatcher.addEventListener(AsyncErrorEvent.ASYNC_ERROR,
onAsyncError);
 			dispatcher.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
 			dispatcher.addEventListener(ProgressEvent.PROGRESS, onProgress);
 			dispatcher.addEventListener(Event.ENTER_FRAME, onEnterFrame);
 		}
 		/
 		private function connectStream():void 
 		{
 			if (stream) 
 stream.close();
 
 			stream = new NetStream(nc);
 			configureListeners(stream);
 			video.attachNetStream(stream);
 			stream.bufferTime = 10;
 			stream.play(flvName);
 			stream.client = this;
 		}
 		/
 		private function onNetStatus(event:NetStatusEvent):void
 		{
 			trace(onNetStatus:  + event);
 			switch (event.info.code) 
 			{
  case NetConnection.Connect.Success:
 	  trace(NetConnection.Connect.Success);
 	  connectStream();
 	  break;
  case NetConnection.Connect.Failed:
 	  trace(NetConnection.Connect.Failed);
 	  break;
  case NetStream.Buffer.Empty:
 	  trace(NetStream.Buffer.Empty);
 	  break;
  case NetStream.Buffer.Full:
 	  trace(NetStream.Buffer.Full);
 	  break;
  case NetStream.Play.StreamNotFound:
 	  trace(stream not found:  + flvName);
 	  break;
 			}
 		}		
 		/
 		private function onEnterFrame(event:Event):void
 		{
 			if(stream == null) return;
 			var loadpct:Number = 

[flexcoders] Re: Buffer progress bar for streaming FLV

2006-08-31 Thread Chris Simeone
Hi Abdul

Your last two responses were helpful, but I don't think they solve my
problem. 

As far as I can tell, to show buffering progress of streaming video as
a percentage reflected in a progress bar I need to do this...

var loadpct:Number = ns.time / ns.bufferLength * 100;
bar.setProgress(loadpct,100);
bar.label= Buffering  + loadpctRnd + %;

After reading through the various Flex Video ActionScript Classes
(found in my install path - C:\Program Files\Adobe\Flex 2\Flex
Builder\Flex SDK 2\frameworks\source\mx\controls\videoClasses), I've
learned that they don't expose the netStream bufferLength property.

So, I answered my own question - showing streaming video buffering
progress using the mx:videoDisplay component is not possible.

However it could be possible. As an experiment, I've copied the Flex
video classes to a test project. I'm changing all package references
to point to my new project. I'm modifying the classes to expose the
properties needed. And I'm adding a Boolean property to the
mx:videoDisplay component that will show a buffering progress bar
when set to true.

At the very least, I think Adobe needs to modify their videoDisplay
class to get a buffering progress percentage for an RMTP URL.

I'll let you know how it goes. 

Chris

--- In flexcoders@yahoogroups.com, Chris Simeone [EMAIL PROTECTED] wrote:

 Hi All,
 
 I've been trying to create a Buffering progress bar for streaming
 FLV (via FMS) with the mx:videoDisplay component. But, the
 videoDisplay is not firing progress events for some odd reason. So I
 changed my strategy and started using the netStream object.
 
 The video is streaming via FMS, but the netStream bytesLoaded and
 bytesTotal properties are always zero. Any ideas what I may be doing
 wrong. The code's below. 
 
 Also, it would be great if anyone can show how to pull this of with
 the mx:videoDisplay component as well!!!
 
 Thanks!
 Chris
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns=*
 layout=vertical horizontalAlign=left
 creationComplete=onCreationComplete();
   mx:Script
   ![CDATA[
   

//
   import mx.events.VideoEvent;
   import myComponents.*;
   import flash.events.*;
   import flash.net.*;
   import flash.media.Video;
   import mx.controls.*;
   import mx.core.UIComponent;
   

//
   private var nc:NetConnection;
   private var stream:NetStream;
   private var fmsUrl:String;
   private var flvName:String;
   private var video:Video;
   private var loaded_interval:Number;
   

//
   NetConnection.defaultObjectEncoding = 
 flash.net.ObjectEncoding.AMF0;
   

//
   public function onCreationComplete():void
   {
   nc = new NetConnection();
   configureListeners(nc);
   
   var videoHolder:UIComponent = new UIComponent();
   videoHolder.setActualSize(700, 525);
   
   video = new Video();
   configureListeners(video);
   
   videoHolder.addChild(video);
   video.x = 0;
   video.y = 0;
   
   fmsUrl = rtmp://localhost/test_video;
   flvName = testVideo;
   theBox.addChild(videoHolder);
   nc.connect(fmsUrl);
   }
   /
   private function 
 configureListeners(dispatcher:IEventDispatcher):void 
   {
   
 dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
 onSecurityError);
   dispatcher.addEventListener(AsyncErrorEvent.ASYNC_ERROR,
onAsyncError);
   dispatcher.addEventListener(NetStatusEvent.NET_STATUS, 
 onNetStatus);
   dispatcher.addEventListener(ProgressEvent.PROGRESS, 
 onProgress);
   dispatcher.addEventListener(Event.ENTER_FRAME, 
 onEnterFrame);
   }
   /
   private function connectStream():void 
   {
   if (stream) 
   stream.close();
 
   stream = new NetStream(nc);
   configureListeners(stream);
   

[flexcoders] Re: Buffer progress bar for streaming FLV

2006-08-31 Thread Chris Simeone
Well, my hack worked.

I created a new package in my project. Then I copied the Flex video
classes into the package folders and hacked those (about 50 lines of
code in 10 files - less not counting the package name changes). Then I
created a new video event - BUFFERINGPCT. The VideoEvent object now
contains a numeric property named bufferingProgress. The hack works
like a charm!

Now I can track buffering progress using my hacked version of the
mx:videoDisplay component.

The question is how do I get Adobe to add this type of functionality
to the framework?

Greg  Abdul, thanks for all your responses. I learned much and I hope
other find this thread useful.

Chris

--- In flexcoders@yahoogroups.com, Chris Simeone [EMAIL PROTECTED] wrote:

 Hi All,
 
 I've been trying to create a Buffering progress bar for streaming
 FLV (via FMS) with the mx:videoDisplay component. But, the
 videoDisplay is not firing progress events for some odd reason. So I
 changed my strategy and started using the netStream object.
 
 The video is streaming via FMS, but the netStream bytesLoaded and
 bytesTotal properties are always zero. Any ideas what I may be doing
 wrong. The code's below. 
 
 Also, it would be great if anyone can show how to pull this of with
 the mx:videoDisplay component as well!!!
 
 Thanks!
 Chris
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns=*
 layout=vertical horizontalAlign=left
 creationComplete=onCreationComplete();
   mx:Script
   ![CDATA[
   

//
   import mx.events.VideoEvent;
   import myComponents.*;
   import flash.events.*;
   import flash.net.*;
   import flash.media.Video;
   import mx.controls.*;
   import mx.core.UIComponent;
   

//
   private var nc:NetConnection;
   private var stream:NetStream;
   private var fmsUrl:String;
   private var flvName:String;
   private var video:Video;
   private var loaded_interval:Number;
   

//
   NetConnection.defaultObjectEncoding = 
 flash.net.ObjectEncoding.AMF0;
   

//
   public function onCreationComplete():void
   {
   nc = new NetConnection();
   configureListeners(nc);
   
   var videoHolder:UIComponent = new UIComponent();
   videoHolder.setActualSize(700, 525);
   
   video = new Video();
   configureListeners(video);
   
   videoHolder.addChild(video);
   video.x = 0;
   video.y = 0;
   
   fmsUrl = rtmp://localhost/test_video;
   flvName = testVideo;
   theBox.addChild(videoHolder);
   nc.connect(fmsUrl);
   }
   /
   private function 
 configureListeners(dispatcher:IEventDispatcher):void 
   {
   
 dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
 onSecurityError);
   dispatcher.addEventListener(AsyncErrorEvent.ASYNC_ERROR,
onAsyncError);
   dispatcher.addEventListener(NetStatusEvent.NET_STATUS, 
 onNetStatus);
   dispatcher.addEventListener(ProgressEvent.PROGRESS, 
 onProgress);
   dispatcher.addEventListener(Event.ENTER_FRAME, 
 onEnterFrame);
   }
   /
   private function connectStream():void 
   {
   if (stream) 
   stream.close();
 
   stream = new NetStream(nc);
   configureListeners(stream);
   video.attachNetStream(stream);
   stream.bufferTime = 10;
   stream.play(flvName);
   stream.client = this;
   }
   /
   private function onNetStatus(event:NetStatusEvent):void
   {
   trace(onNetStatus:  + event);
   switch (event.info.code) 
   {
case NetConnection.Connect.Success:
 
 trace(NetConnection.Connect.Success);
   

Re: [flexcoders] Re: Buffer progress bar for streaming FLV

2006-08-31 Thread Impudent1
Thanks for sharing, I am currently trying to get my head around 
extending videodisplay as well, but for my needs I need to pull the 
metadata as well as be able to add/remove cuepoints on the fly.

I was was going about it by learning how to extend an existing 
component. You mentioned copying the video classes into a package, then 
adding your new event.

if you could share a bit more on this I would much appreciate. I seem to 
be better at deconstructing/reconstructing examples than getting my head 
   around super classes etc :)

Impudent1
LeapFrog Productions


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





Re: [flexcoders] Re: Buffer progress bar for streaming FLV

2006-08-31 Thread greg h



Wow Chris. You are way out ahead of me :-)

When Abdul mentioned in the other thread last week needing to hack the
code properly I figured it might be a bridge too far for me.

Any chance of your posting your solution over at http://www.onflex.org/code/

Regarding getting Adobe to add this type of functionality to the framework? Maybe Flex 3?

Congratulations again.

gOn 8/31/06, Chris Simeone [EMAIL PROTECTED] wrote:













  



Well, my hack worked.
 


I
created a new package in my project. Then I copied the Flex video
classes into the package folders and hacked those (about 50 lines of
code in 10 files - less not counting the package name changes). Then I
created a new video event - BUFFERINGPCT. The VideoEvent object now
contains a numeric property named bufferingProgress. The hack works
like a charm!

Now I can track buffering progress using my hacked version of the mx:videoDisplay component.

The question is how do I get Adobe to add this type of functionality to the framework?

Greg  Abdul, thanks for all your responses. I learned much and I hope other find this thread useful.

  Chris
  


__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



[flexcoders] Re: Buffer progress bar for streaming FLV

2006-08-30 Thread Michael Ritchie
Abdul is correct, you need to get the netstream time, use the
following code for your enterframe function:

   private function onEnterFrame(event:Event):void
   {
   if(stream == null) return;
   var loadpct:Number = stream.bytesLoaded /
stream.bytesTotal * 100;
   trace(onEnterFrame:  + event +  Loaded:  +
stream.time + %);
   }

stream.time will return the %

- mr

--- In flexcoders@yahoogroups.com, Abdul Qabiz [EMAIL PROTECTED] wrote:

 Hi,
 
 bytesTotal and bytesLoaded are used when you use progressive flv
download.
 In case of streaming (via FMS/FCS),
 your actual file is not downloaded rather bits are streamed over
pipe
 
 To show buffer progress, you can use NetStream's bufferLength and
bufferTime
 properties instead of bytesTotal/bytesLoaded.
 
 -abdul
 
 
 
 On 8/30/06, Chris Simeone [EMAIL PROTECTED] wrote:
 
Hi All,
 
  I've been trying to create a Buffering progress bar for streaming
  FLV (via FMS) with the mx:videoDisplay component. But, the
  videoDisplay is not firing progress events for some odd reason. So I
  changed my strategy and started using the netStream object.
 
  The video is streaming via FMS, but the netStream bytesLoaded and
  bytesTotal properties are always zero. Any ideas what I may be doing
  wrong. The code's below.
 
  Also, it would be great if anyone can show how to pull this of with
  the mx:videoDisplay component as well!!!
 
  Thanks!
  Chris
 
  ?xml version=1.0 encoding=utf-8?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns=*
  layout=vertical horizontalAlign=left
  creationComplete=onCreationComplete();
  mx:Script
  ![CDATA[
 
 
//
  import mx.events.VideoEvent;
  import myComponents.*;
  import flash.events.*;
  import flash.net.*;
  import flash.media.Video;
  import mx.controls.*;
  import mx.core.UIComponent;
 
 
//
  private var nc:NetConnection;
  private var stream:NetStream;
  private var fmsUrl:String;
  private var flvName:String;
  private var video:Video;
  private var loaded_interval:Number;
 
 
//
  NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
 
 
//
  public function onCreationComplete():void
  {
  nc = new NetConnection();
  configureListeners(nc);
 
  var videoHolder:UIComponent = new UIComponent();
  videoHolder.setActualSize(700, 525);
 
  video = new Video();
  configureListeners(video);
 
  videoHolder.addChild(video);
  video.x = 0;
  video.y = 0;
 
  fmsUrl = rtmp://localhost/test_video;
  flvName = testVideo;
  theBox.addChild(videoHolder);
  nc.connect(fmsUrl);
  }
  /
  private function configureListeners(dispatcher:IEventDispatcher):void
  {
  dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
  onSecurityError);
  dispatcher.addEventListener(AsyncErrorEvent.ASYNC_ERROR,
onAsyncError);
  dispatcher.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
  dispatcher.addEventListener(ProgressEvent.PROGRESS, onProgress);
  dispatcher.addEventListener(Event.ENTER_FRAME, onEnterFrame);
  }
  /
  private function connectStream():void
  {
  if (stream)
  stream.close();
 
  stream = new NetStream(nc);
  configureListeners(stream);
  video.attachNetStream(stream);
  stream.bufferTime = 10;
  stream.play(flvName);
  stream.client = this;
  }
  /
  private function onNetStatus(event:NetStatusEvent):void
  {
  trace(onNetStatus:  + event);
  switch (event.info.code)
  {
  case NetConnection.Connect.Success:
  trace(NetConnection.Connect.Success);
  connectStream();
  break;
  case NetConnection.Connect.Failed:
  trace(NetConnection.Connect.Failed);
  break;
  case NetStream.Buffer.Empty:
  trace(NetStream.Buffer.Empty);
  break;
  case NetStream.Buffer.Full:
  trace(NetStream.Buffer.Full);
  break;
  case NetStream.Play.StreamNotFound:
  trace(stream not found:  + flvName);
  break;
  }
  }
  /
  private function onEnterFrame(event:Event):void
  {
  if(stream == null) return;
  var loadpct:Number = stream.bytesLoaded / stream.bytesTotal * 100;
  trace(onEnterFrame:  + event +  Loaded:  + loadpct + %);
  }
  /
  private function onProgress(event:ProgressEvent):void
  {
  trace(onProgress:  + event);
  }
  /
  private function onSecurityError(event:SecurityErrorEvent):void
  {
  trace(onSecurityError:  + event);
  }
  /

[flexcoders] Re: Buffer progress bar for streaming FLV

2006-08-30 Thread Chris Simeone
Hey Greg and Abdul,

That info is exactly what I needed! I'll make the changes and let you
know how it worked out.

Thank you for your responses. 

Take Care,
Chris


--- In flexcoders@yahoogroups.com, Chris Simeone [EMAIL PROTECTED] wrote:

 Hi All,
 
 I've been trying to create a Buffering progress bar for streaming
 FLV (via FMS) with the mx:videoDisplay component. But, the
 videoDisplay is not firing progress events for some odd reason. So I
 changed my strategy and started using the netStream object.
 
 The video is streaming via FMS, but the netStream bytesLoaded and
 bytesTotal properties are always zero. Any ideas what I may be doing
 wrong. The code's below. 
 
 Also, it would be great if anyone can show how to pull this of with
 the mx:videoDisplay component as well!!!
 
 Thanks!
 Chris
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns=*
 layout=vertical horizontalAlign=left
 creationComplete=onCreationComplete();
   mx:Script
   ![CDATA[
   

//
   import mx.events.VideoEvent;
   import myComponents.*;
   import flash.events.*;
   import flash.net.*;
   import flash.media.Video;
   import mx.controls.*;
   import mx.core.UIComponent;
   

//
   private var nc:NetConnection;
   private var stream:NetStream;
   private var fmsUrl:String;
   private var flvName:String;
   private var video:Video;
   private var loaded_interval:Number;
   

//
   NetConnection.defaultObjectEncoding = 
 flash.net.ObjectEncoding.AMF0;
   

//
   public function onCreationComplete():void
   {
   nc = new NetConnection();
   configureListeners(nc);
   
   var videoHolder:UIComponent = new UIComponent();
   videoHolder.setActualSize(700, 525);
   
   video = new Video();
   configureListeners(video);
   
   videoHolder.addChild(video);
   video.x = 0;
   video.y = 0;
   
   fmsUrl = rtmp://localhost/test_video;
   flvName = testVideo;
   theBox.addChild(videoHolder);
   nc.connect(fmsUrl);
   }
   /
   private function 
 configureListeners(dispatcher:IEventDispatcher):void 
   {
   
 dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
 onSecurityError);
   dispatcher.addEventListener(AsyncErrorEvent.ASYNC_ERROR,
onAsyncError);
   dispatcher.addEventListener(NetStatusEvent.NET_STATUS, 
 onNetStatus);
   dispatcher.addEventListener(ProgressEvent.PROGRESS, 
 onProgress);
   dispatcher.addEventListener(Event.ENTER_FRAME, 
 onEnterFrame);
   }
   /
   private function connectStream():void 
   {
   if (stream) 
   stream.close();
 
   stream = new NetStream(nc);
   configureListeners(stream);
   video.attachNetStream(stream);
   stream.bufferTime = 10;
   stream.play(flvName);
   stream.client = this;
   }
   /
   private function onNetStatus(event:NetStatusEvent):void
   {
   trace(onNetStatus:  + event);
   switch (event.info.code) 
   {
case NetConnection.Connect.Success:
 
 trace(NetConnection.Connect.Success);
 connectStream();
 break;
case NetConnection.Connect.Failed:
 trace(NetConnection.Connect.Failed);
 break;
case NetStream.Buffer.Empty:
 trace(NetStream.Buffer.Empty);
 break;
case 

[flexcoders] Re: Buffer progress bar for streaming FLV

2006-08-30 Thread Chris Simeone
Awesome!!! Worked perfectly. Thank You.

With all this in mind, is there a way to pull this of using the
mx:videoDisplay component? 

I created my app using that component but I could not figure out how
to access the stream. I figured I would do a rewrite using the
netStream object if necessary, but I would love to avoid doing that if
possible.

Thanks Again,
Chris
 

--- In flexcoders@yahoogroups.com, Michael Ritchie [EMAIL PROTECTED] wrote:

 Abdul is correct, you need to get the netstream time, use the
 following code for your enterframe function:
 
private function onEnterFrame(event:Event):void
{
if(stream == null) return;
var loadpct:Number = stream.bytesLoaded /
 stream.bytesTotal * 100;
trace(onEnterFrame:  + event +  Loaded:  +
 stream.time + %);
}
 
 stream.time will return the %
 
 - mr
 
 --- In flexcoders@yahoogroups.com, Abdul Qabiz abdul.qabiz@ wrote:
 
  Hi,
  
  bytesTotal and bytesLoaded are used when you use progressive flv
 download.
  In case of streaming (via FMS/FCS),
  your actual file is not downloaded rather bits are streamed over
 pipe
  
  To show buffer progress, you can use NetStream's bufferLength and
 bufferTime
  properties instead of bytesTotal/bytesLoaded.
  
  -abdul
  
  
  
  On 8/30/06, Chris Simeone simspace@ wrote:
  
 Hi All,
  
   I've been trying to create a Buffering progress bar for streaming
   FLV (via FMS) with the mx:videoDisplay component. But, the
   videoDisplay is not firing progress events for some odd
reason. So I
   changed my strategy and started using the netStream object.
  
   The video is streaming via FMS, but the netStream bytesLoaded and
   bytesTotal properties are always zero. Any ideas what I may be
doing
   wrong. The code's below.
  
   Also, it would be great if anyone can show how to pull this of with
   the mx:videoDisplay component as well!!!
  
   Thanks!
   Chris
  
   ?xml version=1.0 encoding=utf-8?
   mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns=*
   layout=vertical horizontalAlign=left
   creationComplete=onCreationComplete();
   mx:Script
   ![CDATA[
  
  

//
   import mx.events.VideoEvent;
   import myComponents.*;
   import flash.events.*;
   import flash.net.*;
   import flash.media.Video;
   import mx.controls.*;
   import mx.core.UIComponent;
  
  

//
   private var nc:NetConnection;
   private var stream:NetStream;
   private var fmsUrl:String;
   private var flvName:String;
   private var video:Video;
   private var loaded_interval:Number;
  
  

//
   NetConnection.defaultObjectEncoding = flash.net.ObjectEncoding.AMF0;
  
  

//
   public function onCreationComplete():void
   {
   nc = new NetConnection();
   configureListeners(nc);
  
   var videoHolder:UIComponent = new UIComponent();
   videoHolder.setActualSize(700, 525);
  
   video = new Video();
   configureListeners(video);
  
   videoHolder.addChild(video);
   video.x = 0;
   video.y = 0;
  
   fmsUrl = rtmp://localhost/test_video;
   flvName = testVideo;
   theBox.addChild(videoHolder);
   nc.connect(fmsUrl);
   }
   /
   private function
configureListeners(dispatcher:IEventDispatcher):void
   {
   dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
   onSecurityError);
   dispatcher.addEventListener(AsyncErrorEvent.ASYNC_ERROR,
 onAsyncError);
   dispatcher.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
   dispatcher.addEventListener(ProgressEvent.PROGRESS, onProgress);
   dispatcher.addEventListener(Event.ENTER_FRAME, onEnterFrame);
   }
   /
   private function connectStream():void
   {
   if (stream)
   stream.close();
  
   stream = new NetStream(nc);
   configureListeners(stream);
   video.attachNetStream(stream);
   stream.bufferTime = 10;
   stream.play(flvName);
   stream.client = this;
   }
   /
   private function onNetStatus(event:NetStatusEvent):void
   {
   trace(onNetStatus:  + event);
   switch (event.info.code)
   {
   case NetConnection.Connect.Success:
   trace(NetConnection.Connect.Success);
   connectStream();
   break;
   case NetConnection.Connect.Failed:
   trace(NetConnection.Connect.Failed);
   break;
   case NetStream.Buffer.Empty:
   trace(NetStream.Buffer.Empty);
   break;
   case NetStream.Buffer.Full:
   trace(NetStream.Buffer.Full);
   break;
   case NetStream.Play.StreamNotFound:
   trace(stream not found:  + flvName);
   break;
   }
   }
   /
   private function 

[flexcoders] Re: Buffer progress bar for streaming FLV

2006-08-30 Thread Chris Simeone
Ok, Below is my updated onEnterFrame() method that updates a
progressBar component. It works great. Thanks again gang!

Now I'm going to try and get this working using the mx:videoDisplay
component. I'm not sure if I can get to its netStream object, so any
ideas/recommendations would be helpful and appreciated. 

Thanks!
Chris

/
private function onEnterFrame(event:Event):void
{
if(stream == null) return;
if(duration == 0) return;
var loadpct:Number = 
Math.round(Math.ceil((stream.time/duration)*100));

if(loadpct=100)
{
bar.setProgress(loadpct,100);
bar.label= CurrentProgress +   + loadpct + 
%;
loadpct+=10;
}
if(loadpct100)
{
loadpct=0;
}
trace(onEnterFrame: Duration:  + duration +  Time:  
+
stream.time +  Loaded:  + loadpct + %);
}





--- In flexcoders@yahoogroups.com, Chris Simeone [EMAIL PROTECTED] wrote:

 Hi All,
 
 I've been trying to create a Buffering progress bar for streaming
 FLV (via FMS) with the mx:videoDisplay component. But, the
 videoDisplay is not firing progress events for some odd reason. So I
 changed my strategy and started using the netStream object.
 
 The video is streaming via FMS, but the netStream bytesLoaded and
 bytesTotal properties are always zero. Any ideas what I may be doing
 wrong. The code's below. 
 
 Also, it would be great if anyone can show how to pull this of with
 the mx:videoDisplay component as well!!!
 
 Thanks!
 Chris
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; xmlns=*
 layout=vertical horizontalAlign=left
 creationComplete=onCreationComplete();
   mx:Script
   ![CDATA[
   

//
   import mx.events.VideoEvent;
   import myComponents.*;
   import flash.events.*;
   import flash.net.*;
   import flash.media.Video;
   import mx.controls.*;
   import mx.core.UIComponent;
   

//
   private var nc:NetConnection;
   private var stream:NetStream;
   private var fmsUrl:String;
   private var flvName:String;
   private var video:Video;
   private var loaded_interval:Number;
   

//
   NetConnection.defaultObjectEncoding = 
 flash.net.ObjectEncoding.AMF0;
   

//
   public function onCreationComplete():void
   {
   nc = new NetConnection();
   configureListeners(nc);
   
   var videoHolder:UIComponent = new UIComponent();
   videoHolder.setActualSize(700, 525);
   
   video = new Video();
   configureListeners(video);
   
   videoHolder.addChild(video);
   video.x = 0;
   video.y = 0;
   
   fmsUrl = rtmp://localhost/test_video;
   flvName = testVideo;
   theBox.addChild(videoHolder);
   nc.connect(fmsUrl);
   }
   /
   private function 
 configureListeners(dispatcher:IEventDispatcher):void 
   {
   
 dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
 onSecurityError);
   dispatcher.addEventListener(AsyncErrorEvent.ASYNC_ERROR,
onAsyncError);
   dispatcher.addEventListener(NetStatusEvent.NET_STATUS, 
 onNetStatus);
   dispatcher.addEventListener(ProgressEvent.PROGRESS, 
 onProgress);
   dispatcher.addEventListener(Event.ENTER_FRAME, 
 onEnterFrame);
   }
   /
   private function connectStream():void 
   {
   if (stream) 
   stream.close();
 
   stream = new NetStream(nc);
   configureListeners(stream);
   video.attachNetStream(stream);
   

Re: [flexcoders] Re: Buffer progress bar for streaming FLV

2006-08-30 Thread greg h



Chris,

Regarding your post:
Now I'm going to try and get this working using the
mx:videoDisplay component. I'm not sure if I can get to its
netStream object, so any ideas/recommendations would be helpful and
appreciated. 


Last week Abdul posted a reply on this list on the thread How to assign NetStream to VideoDisplay component?

You can find Abdul's reply on the thread here: 
http://www.mail-archive.com/flexcoders@yahoogroups.com/msg39368.html

btw ... thank you very, very much Abdul :-)

hth,

g

__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Software development tool
  
  
Software development
  
  
Software development services
  
  


Home design software
  
  
Software development company
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



[flexcoders] Re: Buffer progress bar for streaming FLV

2006-08-30 Thread Chris Simeone
Hmmm Bummer...

Before I abandon my idea I want to sum up this thread...

I can't create a progress bar that shows buffering progress as long as
I use the videoDisplay component. 

I have to use the netStream objects if I want to create a buffering
progress bar, because that's the only way I can access the streams
time and bufferLength properties.

Sound right?


--- In flexcoders@yahoogroups.com, greg h [EMAIL PROTECTED] wrote:

 Chris,
 
 Regarding your post:
 Now I'm going to try and get this working using the mx:videoDisplay
 component. I'm not sure if I can get to its netStream object, so any
 ideas/recommendations would be helpful and appreciated.
 
 Last week Abdul posted a reply on this list on the thread How to assign
 NetStream to VideoDisplay component?
 
 You can find Abdul's reply on the thread here:
 http://www.mail-archive.com/flexcoders@yahoogroups.com/msg39368.html
 
 btw ... thank you very, very much Abdul :-)
 
 hth,
 
 g








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/