A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: flv playback not buffering

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    5

    Question flv playback not buffering

    Hi Folks
    I have a strange situation with flv playback buffering. I have recently moved a flash based site from one server to another. Whilst buffering worked fine on the old server, on the new server for some reason when the flvplayback component runs out of data and should buffer, it instead just moves the playhead back to the start as if the flv file was finished playing. No idea what is happening there. Like i said it worked fine on the old server

    Thanks in advance

  2. #2
    Senior Member
    Join Date
    Apr 2008
    Location
    Nottingham, UK
    Posts
    348
    you might like to listen for a load of netstream events that get fired at certain points and debugging from there:

    Code:
     package {
        import flash.display.Sprite;
        import flash.events.*;
        import flash.media.Video;
        import flash.net.NetConnection;
        import flash.net.NetStream;
    
        public class NetStatusEventExample extends Sprite {
            private var videoURL:String = "Video.flv";
            private var connection:NetConnection;
            private var stream:NetStream;
    
            public function NetStatusEventExample() {
                connection = new NetConnection();
                connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
                connection.connect(null);
            }
    
            private function netStatusHandler(event:NetStatusEvent):void {
                switch (event.info.code) {
                    case "NetConnection.Connect.Success":
                        connectStream();
                        break;
                    case "NetStream.Play.StreamNotFound":
                        trace("Unable to locate video: " + videoURL);
                        break;
                }
            }
    
            private function connectStream():void {
                var stream:NetStream = new NetStream(connection);
                stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
                var video:Video = new Video();
                video.attachNetStream(stream);
                stream.play(videoURL);
                addChild(video);
            }
    
            private function securityErrorHandler(event:SecurityErrorEvent):void {
                trace("securityErrorHandler: " + event);
            }
            
            private function asyncErrorHandler(event:AsyncErrorEvent):void {
                // ignore AsyncErrorEvent events.
            }
    
        }
     }
    sorry about the codespam, i can't link directly to the page, "stupid flash"! :facepalm:

    just trace those events out with an External Interface call to the javascript Alert() function

    Dan

  3. #3
    Junior Member
    Join Date
    Aug 2009
    Posts
    5
    Thanks very much Dan. Now i have something to go with from here. Cheers.

  4. #4
    Senior Member
    Join Date
    Apr 2008
    Location
    Nottingham, UK
    Posts
    348
    no probs, happy to help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center