Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Deepu_George_Jacob
Posts: 235
Registered: ‎12-13-2011
My Device: Curve 9380

Media player plays very slowly?

hai,

        I am trying to play a mp4 file from my server but is plays very slowly . Is any method to increase speed to play videos ?

 

Thanks

Deepu

Developer
pyth
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane

Re: Media player plays very slowly?

what do you mean by 'it plays very slowly'? have you tried downloading it completely first before playing it?

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Developer
Deepu_George_Jacob
Posts: 235
Registered: ‎12-13-2011
My Device: Curve 9380

Re: Media player plays very slowly?

It is very large file so downloading is not suitable

Developer
pyth
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane

Re: Media player plays very slowly?

[ Edited ]

*edit* added a default value for a buffersize

 

then have you tried using a NetStream? It should look somehow like this

 

//global
private var ns:NetStream;

var nc:NetConnection = new NetConnection(); nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError); nc.connect(null); ns = new NetStream(nc); ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); ns.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError); ns.client = {onMetaData: function(info:Object):void{ //do stuff like setting with and height of video depending on info of metadata

//also setting a default value for a buffer
bufferMax = info.seekpoints[info.seekpoints.length - 1].offset;
 }); //assuming, you have an instance of flash.media.video named myVideo myVideo.attachNetStream(ns);


ns.play(videoSrc);

 plus a netstreamhandler. videosrc is the link to the video

private function netStatusHandler(event:NetStatusEvent):void {
			// handles net status events
			trace("Loaded " + ns.bytesLoaded + " of " + ns.bytesTotal + " - "+ event.info.code);
			
			switch (event.info.code) {
				// trace a messeage when the stream is not found
				case "NetStream.Play.Start":
					//ns.pause();
                                        waitTillFullLoaded = false;
					break;
				case "NetStream.Buffer.Full":
					if ((ns.bytesTotal < bufferMax) && (waitTillFullLoaded == false))
					{
						waitTillFullLoaded = true;
						ns.play(videoSrc);
					}
					//ns.resume();
					break;
				case "NetStream.Buffer.Flush":
					if (ns.bytesTotal < bufferMax) //&& waitTillFullLoaded)
					{
						ns.pause();
						ns.play(videoSrc);
					}
					break;
				case "NetStream.Play.StreamNotFound":
					//do stuff
					break;
				
				// when the video reaches its end, top the player
				case "NetStream.Play.Stop":
					trace("Stop");
					ns.pause();
					ns.seek(0); //rewinding
					break;
				
			}
		}

 

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o