Handling NetStream

I'm trying to publish live webcam feed, but I noticed something odd going on.
After a connection has been made to FMS a user can press a button to start streaming. The button will simply create a netstream and attach audio/video devices to the net stream and start publishing.
If that user wants to stop publishing I have a differernt button that assigns my netstream to null.  The reason why I do this is because I don't want the user to drop the connection to the server, just stop publishing.
What's weird is I think the way I'm handling netstream is causing odd things to happen in the Admin Console. If I have 2 users waiting to listen to a stream; I will have 2 clients subscribed to the stream.  When a new user comes in and wants to publish the live stream it doubles the clients already subscribed and gives them another client id that is handling the stream.  If the publisher then decides to stop publishing then it only removes 1 of the duplicated clients from the stream.
Here's an attempt at a visual of the admin console
Before Publishing:
AAAAAA   rtmp   bytesIn  bytesOut  <-- Viewer
AAAAAB   rtmp   bytesIn  bytesOut  <-- Viewer
After a user starts publishing:
AAAAAA   rtmp   bytesIn  bytesOut  <-- Viewer (Client ID made when a connection was made), no longer appears to be used
AAAAAB   rtmp   bytesIn  bytesOut  <-- Viewer (Client ID made when a connection was made), no longer appears to be used
AAAAAC   rtmp   bytesIn  bytesOut  <-- Publisher
AAAAAD   rtmp   bytesIn  bytesOut  <-- Duplicated Viewer that is playing the stream
AAAAAE   rtmp   bytesIn  bytesOut  <-- Duplicated Viewer that is playing the stream
After user stops publishing:
AAAAAA   rtmp   bytesIn  bytesOut  <-- Viewer (Client ID made when a connection was made), no longer appears to be used
AAAAAB   rtmp   bytesIn  bytesOut  <-- Viewer (Client ID made when a connection was made), no longer appears to be used
AAAAAC   rtmp   bytesIn  bytesOut  <-- Publisher
AAAAAE   rtmp   bytesIn  bytesOut  <-- Duplicated Viewer that was playing the stream

No edge-orgin is set up.
Inside my main.asc when a stream is started I call application.broadcastmsg() to alert all users a stream is being published.
UPDATE:
I changed a lot of my code around and I got everything working now.
For my publishing side:
I'm publishing a stream and using ns.close() to close the stream.  I'm no longer using application.broadcastmsg() either anymore, I'm using netstream.send().
For my client side:
I've changed the code to use Video instead of FLVPlayback. I  tie my netstream to my video and have my netstream send functions listening.
New problem I'm having though is on my client side is I can't get a hold of my Video because of the following:
package {
     public class mainform {
          var video:Video;
          var cc = new CustomClient();
          ns.client = cc;
class CustomClient {
     public  function started():void {
          How can I get ahold of my video?
     public function stopped():void {
          How can I get ahold of my video?

Similar Messages

  • Some NetStream statuses are not triggered anymore with FP 11.2

    I'm in charge of developing a video recorder in as3 (http://hdfvr.com) and the video recorder has been working fine for the past 2 years however with the latest FP update (11.2) it has stopped working because these 3 NetStream events are never triggered anymore:
    HDFVR.netStatusHandler(NetStream.Buffer.Empty) _state=uploading
    HDFVR.netStatusHandler(NetStream.Record.Stop) _state=idle
    HDFVR.netStatusHandler(NetStream.Unpublish.Success) _state=idle
    This happens regardless of the media server used (Red5/FMIS/Wowza)
    I have posted this issue in the Adobe Flash Player Bug Database:
    https://bugbase.adobe.com/index.cfm?event=bug&id=3154124
    I have also informed my clients and they're waiting for a fix, unfortunately I am not sure I can do a workaround without those NetStream events.

    I've report the same problem using Flash Player 11.2.
    From test that performed using  Flash Player 11.3 beta 3 the issue seems to be solved, so I can handle NetStream.Buffer.Empty event correctly.
    I'd like to ask your suggestion how is possibile workaround this problem until Flash Player 11.3 is not release as stable version.
    Some users that use automatic update has Flash Player update to last stable release (11.2), I'd like to ask you suggestion how to correct manage this case.
    I'd like to introduce some modification in the code for handle this case for example start a timer and monitor how many data are present in buffer, and when buffer is empty, use same function that should be called when NetStream.Buffer.Empty event is raised?
    I'd kindly like to ask if you can give to me some suggestion.
    Thank you very much
    Maurizio

  • Flash not playing correctly in Chrome or Firefox

    I did a Flash SWF file on CS5.5, and then published the output. It has 5 imported videos (FLV), all placed within the same directory as the FLA, SWF and HTML files. When I go ahead and open the HTML file on Chrome, the SWF file plays, but when I get to the frame where the placed FLV files were supposed to play, the videos don't appear at all. Same goes for Firefox. However, it plays correctly in Internet Explorer.
    I'm a total Flash beginner, so I have no idea what I'm doing wrong here.
    I've uploaded screenshots of the HTML code and of the SWF file in Chrome.
    http://dl.dropbox.com/u/89001193/screenshot1.jpg
    http://dl.dropbox.com/u/89001193/screenshot2.jpg
    http://dl.dropbox.com/u/89001193/screenshot3.jpg
    Also, I tried creating a Win Projector EXE file, and I get an error dialog saying "Destination Directory Does Not Exist. Change Your Publish Settings", whe in fact I used the default publish settings.
    I'd really appreciate expert advice on this, especially if you can "dumb down" your answers to total beginner level.

    Are you using relative links to the paths of the media, e.g.: assets/videos/movie1.flv ?
    What are you using for FLV playback, the FLVPlayback component itself or are you handling NetStream/Video yourself, or StageVideo?
    Default publish settings are never to be trusted in Flash, ever. Paths are RARELY ever saved correctly unless they're relative and even then it's not safe to assume it's correct. I've, long ago, made it a habit of going into publish settings, clicking the browse icon next to SWF/HTML/EXE/etc and manually set the location to publish every single time. If you do that the error should go away about publish destination (and yes, it's really irritating).
    What FLV codec did you use?

  • Flash not fully functioning in Chrome

    When going to a flash page, initial video or flash object will play, but no actions (pause/play/follow link) can be selected.  After any click in the flash pane, the mouse pointer will be constantly engaged (i.e. moving the mouse back and forth across the pane will move a video scroll bar right/left, but it will have no effect on the video playback; google maps street view- any click on the map image will allow you to pan but nothing can be selected to advance the view down the street, zoom, etc)
    Using Chrome default plugin Flash - Version: 10.3.183.5.  Same version in use for IE8 is fully functional.

    Are you using relative links to the paths of the media, e.g.: assets/videos/movie1.flv ?
    What are you using for FLV playback, the FLVPlayback component itself or are you handling NetStream/Video yourself, or StageVideo?
    Default publish settings are never to be trusted in Flash, ever. Paths are RARELY ever saved correctly unless they're relative and even then it's not safe to assume it's correct. I've, long ago, made it a habit of going into publish settings, clicking the browse icon next to SWF/HTML/EXE/etc and manually set the location to publish every single time. If you do that the error should go away about publish destination (and yes, it's really irritating).
    What FLV codec did you use?

  • Using MVC framework with LCCS

    I'm developing a project in PureMVC and seperate skin classes.
    Now there are a few 'view' components available in the lccs sdk, but when I use
    them they require data far away from the skin. The approach we made in the project
    is far from simple but extremely oop based and it's not very nice to use the
    standard components in the sdk.
    When looking to the WebcamSubscriber for instance, I would like to use basic netstreams in the
    skin with live streams. Is there a simple way to get the netstream out of the streamManager
    in the sdk? Or do I need to pull apart the WebcamSubscriber and seperate the code?
    Thanks, Florus

    Ok, sorry for my vague question.
    What I'm trying to do is, creating a skin which has got a minimized amount of intelligent code.
    To show a webcam there should be only a videocomponent for instance.
    That videocomponent can handle netstreams which are created in our framework.
    At the moment we are using all the components in the sdk like WebcamSubscriber, etc  for rapid prototyping.
    But that component needs a lot of data related references like connectsession, etc which I don't like to pass on
    to a skin component.
    So, We've looked into the WebcamSubscriber yesterday and found out that the streammanager is indeed the model
    layer for the WebcamSubscriber but that it is only meta data. The actual netstream used inside the WebcamSubscriber
    is build up on the meta data out of the streammanager. So there's no hard connection between netstreams and streamdescriptors,
    if I'm correct?
    Then we can split most of the code inside WebcamSubscriber and divide the blocks over our framework. And pass
    netstreams to the skin component, which are created in the framework, I would think?
    I hope you understand what I'm trying to achieve, and maybe you've got ideas or advices.
    Thanks, Florus

  • NetStream.onStatus handler for end of FLV

    Hey,
    Basically I want to cue an event when an FLV playing through
    a netConnection/netStream is finished - if anybody has any tips
    it'd be much appreciated.
    I could put a CuePoint on the last frame of each FLV and use
    an onCuePoint Event Handler - but there must be an easier way?
    I'm assuming the 'NetStream.Play.Stop' Code Property won't do
    the job because then simply pausing the Video would cause the event
    to trigger, whereas I only want to trigger it at the very end of
    the stream.
    Is there a way of coding 'When my_ns.time == the last second
    of the stream then perform function X'?
    Thanks in advance for any assistance,
    Justin.

    It would really depend on how you are getting the video into
    you .swf: if it's embeded or you're creating your own video
    instance. Assuming you're creating your own instance of the video
    player, you could set and event listening for a net status event
    like so:
    private function onNetStatus(evt:NetStatusEvent):void
    if(evt.info.code == "NetStream.Play.Start")
    isPlaying = true;
    }else if (evt.info.code == "NetStream.Play.Stop") {
    isPlaying = false;
    trace("video stopped");
    Then if you're watching the isPlaying variable, if it's shows
    up as false you know the video isn't playing anymore and you could
    then call another function.

  • [svn:osmf:] 13028: Fix bug where NetStream would continue playback upon completion ( due to our not handling the new STOPPED state).

    Revision: 13028
    Revision: 13028
    Author:   [email protected]
    Date:     2009-12-16 18:10:28 -0800 (Wed, 16 Dec 2009)
    Log Message:
    Fix bug where NetStream would continue playback upon completion (due to our not handling the new STOPPED state).  Injection from trait refactoring.
    Modified Paths:
        osmf/trunk/framework/MediaFramework/org/osmf/net/NetStreamPlayTrait.as

    My daughter has had her Razr for about 9 months now.  About two weeks ago she picked up her phone in the morning on her way to school when she noticed two cracks, both starting at the camera lens. One goes completely to the bottom and the other goes sharply to the side. She has never dropped it and me and my husband went over it with a fine tooth comb. We looked under a magnifying glass and could no find any reason for the glass to crack. Not one ding, scratch or bang. Our daughter really takes good care of her stuff, but we still wanted to make sure before we sent it in for repairs. Well we did and we got a reply from Motorola with a picture of the cracks saying this was customer abuse and that it is not covered under warranty. Even though they did not find any physical damage to back it up. Well I e-mailed them back and told them I did a little research and found pages of people having the same problems. Well I did not hear from them until I received a notice from Fed Ex that they were sending the phone back. NOT FIXED!!! I went to look up why and guess what there is no case open any more for the phone. It has been wiped clean. I put in the RMA # it comes back not found, I put in the ID #, the SN# and all comes back not found. Yet a day earlier all the info was there. I know there is a lot more people like me and all of you, but they just don't want to be bothered so they pay to have it fix, just to have it do it again. Unless they have found the problem and only fixing it on a customer pay only set up. I am furious and will not be recommending this phone to anyone. And to think I was considering this phone for my next up grade! NOT!!!!

  • NetStream client handler

    Hi,
    I want to add an handler for onMetaData on my netStream Client.
    The onMetaData function is never called, but I know that the .flv file I'm playing contains metadata...
    public class CustomNetStream extends NetStream
         public function CustomNetStream(connection:NetConnection)
            super(connection);
            client = new NetClient();
            NetClient(client).addHandler(NetStreamCodes.ON_META_DATA, onMetaData);
            addEventListener(NetStatusEvent.NET_STATUS, onNetStreamStatus);
         public function onMetaData(value:Object):void
               NetClient(client).removeHandler(NetStreamCodes.ON_META_DATA, onMetaData);
               trace("Got metadata.");
        private function onNetStreamStatus(event:NetStatusEvent):void
           trace("onNetStreamStatus() - event.info.code=" + event.info.code);

    Hello!
    Do you need to handle metadata in NetStream descendant?
    If not I would have used a different approach.
    LightWeightedVideoElement has a property "client" that is being set to NetClient upon element load.
    So you may want to load an element and use that property instead of subclassing netstream.
    Regards!

  • How do i make a single connection to handle video, audio and chat

    I'm developing an application and i want to make one single connection for video(netstream) and chat(sharedObject).
    I have one connection for each but i have limited connection availeble in the server so i need to make a single connection to handle the video net stream and chat sharedObject.
    I use this urls to connect:
    private var serverWebcamURL:String = "rtmp://myserverIP/live";
    private var serverChatURL:String = "rtmp://myserverIP/multicast/chat";
    What do i have to do to make this work?
    Thank You,
    Just-ME

    LOL...thanks QTK.
    In front of my face!

  • NetStream.send not working in Flash Player 11.2 Beta with Cirrus, Please confirm if it is a bug

    Title
    NetStream.send not working in Flash Player 11.2 Beta with Cirrus, Please confirm if it is a bug or feature
    Description
    Problem Description:
    NetStream.send can not send data to peerstreams when using with cirrus. Conflict with documents.
    Sorry for tag the build as 11.0.1.3 while the bug is actually on 11.2 beta since the bug report system didn't have 11.2 beta yet.
    If you are not responsible for 11.2 beta bug fix, please help a hand to handle this bug to 11.2 team.
    This bug is "killing" to your application, so we really appreciate your help. Thanks.
    ==Publisher==
    nc.connect("rtmfp://");
    var ns:NetStream = new NetStream(nc, NetStream.DIRECT_CONNECTIONS);
    ns.publish("sendtest");
    ...//after connection success.
    ns.send("clientfunction", "ok"); // this line cannot reach subscribers. even if subscribers have client object correctly.
    ==Subscriber==
    nc.connect("rtmfp://");
    var ns:NetStream = new NetStream(nc, cirrusid);
    var client:Object = new Object();
    client.clientfunction = clientfunction; // target function
    ns.client = client;
    ns.play("sendtest");
    Steps to Reproduce:
    1. compile the code in the attachment to SendTestExample.swf (not be able to paste it here)
    2. run it under flash player 11.2.202.19 beta
    3. run it under flash player 11
    Actual Result:
    HeartBeat is:
    Start HeartBeat:
    send hello
    send hello
    send hello
    which means NetStream.send was not able to call "clientfunction" as expected.
    Expected Result:
    Start HeartBeat:
    send hello
    in client function: hello
    send hello
    in client function: hello
    send hello
    in client function: hello
    which can call into the clientfunction as flash player 11 did.
    Any Workarounds:
    I can not find it out since it's an api level bug. But this can be very important for lots of applications which rely on send to do rpc.
    Test Configuration
    IE8, Firefox under Windows 7
    Also have problem under Windows XP (but not well tested on this platform)
    App Language(s)
    ALL
    OS Language(s)
    ALL
    Platform(s)
    Windows 7
    Browser(s)
    Internet Explorer 8.0
    ==Attachment==
    package {
        import flash.display.Sprite;
        import flash.events.Event;
        import flash.events.NetStatusEvent;
        import flash.events.TimerEvent;
        import flash.media.Video;
        import flash.net.NetConnection;
        import flash.net.NetStream;
        import flash.text.TextField;
        import flash.utils.Timer;
        import flash.utils.setTimeout;
        public class SendTestExample extends Sprite
            public static var statusArea:TextField;
            var ncServer:NetConnection = new NetConnection();
            var nsServer:NetStream;
            var ncClient:NetConnection = new NetConnection();
            var nsClient:NetStream;
            var timer:Timer = new Timer(1000);
            public function SendTestExample() {
                ncServer.addEventListener("netStatus", onNCStatusServer);
                ncServer.connect("rtmfp://p2p.rtmfp.net","99f72ccbed0948d7589dc38a-3ce1b2616680");
                statusArea = new TextField();
                status("status");
                statusArea.x = 0;
                statusArea.y = 0;
                statusArea.border = true;
                statusArea.width = 200;
                statusArea.height = 350;
                addChild(statusArea);
            function onNCStatusServer(event:NetStatusEvent):void {
                status("Step 1:");
                status("server: " + event.info.code);
                status("id: " + ncServer.nearID);
                switch (event.info.code) {
                    case "NetConnection.Connect.Success":
                        nsServer = new NetStream(ncServer, NetStream.DIRECT_CONNECTIONS);
                        nsServer.addEventListener(NetStatusEvent.NET_STATUS, onNSStatusServer);
                        nsServer.publish("sendtest");
                        ncServer.removeEventListener(NetStatusEvent.NET_STATUS, onNCStatusServer);
                        ncClient.connect("rtmfp://p2p.rtmfp.net","99f72ccbed0948d7589dc38a-3ce1b2616680");
                        ncClient.addEventListener("netStatus", onNCStatusClient);
                    case "NetStream.Publish.BadName":
                        //status("Please check the name of the publishing stream" );
                        break;
            function onNCStatusClient(event:NetStatusEvent):void {
                status("Step 2:");
                status("client: " + event.info.code);
                status("id: " + ncClient.nearID);
                switch (event.info.code) {
                    case "NetConnection.Connect.Success":
                        nsClient = new NetStream(ncClient, ncServer.nearID);
                        var c:Object = new Object();
                        c["clientfunction"] = clientfunction;
                        nsClient.client = c;
                        nsClient.play("sendtest");
                        ncClient.removeEventListener(NetStatusEvent.NET_STATUS, onNCStatusClient);
                        //setTimeout(sendHello, 5000);
                    case "NetStream.Publish.BadName":
                        //status("Please check the name of the publishing stream" );
                        break;
            protected function onNSStatusServer(event:NetStatusEvent):void {
                status("nsserver: " + event.info.code);
                if (event.info.code == "NetStream.Play.Start") {
                    status("Start HeartBeat:");
                    this.timer.addEventListener(TimerEvent.TIMER, function (e:Event):void {
                        sendHello();
                    this.timer.start();
            protected function sendHello():void {
                status("send hello");
                nsServer.send("clientfunction", "hello");
            protected function status(msg:String):void
                statusArea.appendText(msg + "\n");
                trace("ScriptDebug: " + msg);
            protected function clientfunction(event:Object):void {
                status("in client function: " + event);

    Thanks for reporting. I can reproduce the bug in house. We will investigate.
    Calise

  • Webcam runs in background even after the netstream is closed

    Hi All,
    We are having an application for capturing live video from presenter and broadcasting to a viewer. We have coded this using flex as3 and the server is Adobe Media Server. When a broadcasting happens and suddenly the presenter stops the video, the video display becomes blank as i have given the code and also i have closed the netstream by giving
    videoDisplay.visible = false;
    videoDisplay.attachCamera(null);
    _ns.close();
    _video.attachCamera(null);
    _ns.attachCamera(null);
    _ns.attachAudio(null);
    _video = null;
    But still the webcam runs in background and capturing the video. I can see the increase in size of video in the server. Is there any possible way to stop webcam from capturing the video when it si set to off?
    Thanks in advance
    Arasakumar.

    Possibly the Camera object is still attached to the NetStream.
    Add this to a NetStream.Status.Closed event handler:
    netSream.attachCamera(null);
    I hope this helps.

  • Syncing a FLVPlayback item and a NetStream item

    Hello everybody !
    Here's my problem:
    - I play a video in a FLVPlayback item
    - I have another video as a ByteArray, that I play through a NetStream item
    I would like to play the two videos at the same time, keeping them synced, making the second one stopping when the first one stops, etc...
    And I have a "start again" button at the end of the playback, if the user wants to watch the two videos again.
    So:
    - is it possible to keep the videos synced?
    - how should I handle the "start again" thing? Do I have to close the NetStream at the end of the playback, and reopen it when the user clicks on the button?
    Thanks a lot in advance!!

    they can be "roughly" sync'd.
    that means if there is sound in, at most, one video, the sync'g should be passable.  however, if there is sound in both, it's unlikely you will achieve satifactory results unless you have control of the source of both streams, ensure their deadspace is the same and you preload or, at least, ensure there is no bottle-neck when starting/playing the streams.

  • StartTransmit / stopTransmit reference error on NetStream when connecting to device

    Hi all,
    I'm trying to create a P2P connection between a mobile device (Android) and a PC using the NetStream class.
    When the connection is established, the Flash Player Instance on the PC is crashing with a reference error:
    “Property startTransmit not found on flash.net.NetStream”
    I have seen the thread located located here: http://stackoverflow.com/questions/9676496/adobe-cirrus-error-on-direct-connectproperty-st arttransmit-not-found-on-flash-n
    but was not successfull in making it work with my code.
    I have tried extending the NetStream class like so:
    import com.frimastudio.cosy.util.NetConsole;
    import flash.net.NetConnection;
    import flash.net.NetStream;
    public class NetStreamProvider extends NetStream
      public function NetStreamProvider (connection:NetConnection, peerID:String)
       super(connection, peerID);
      // For AIR Android projects: when the device is put to sleep for a moment, this function will be
      // called so we need to implement it to prevent flash from crashing.
      public function startTransmit($p1:*, $p2:*):void
       COSY::console { NetConsole.WarningInternal("NetInterfaceSlot", "startTransmit", "startTransmit called"); }
      public function stopTransmit():void
       COSY::console { NetConsole.WarningInternal("NetInterfaceSlot", "stopTransmit", "stopTransmit called"); }
    and using the NetStreamProvider instead. Without success.
    Any help would be greatly appreciated.
    Thanks.
    Guillaume

    >> i suspect this is AIR-specific (probably if AIR is the sender) -- in my experience it doesn't happen with plain Flash Player.
    [Guillaume] -> Right, it does not happen on NetStreams between 2 Flash Players and 2 AIR app. Only between AIR-FlashPlayer NetStreams. Basically, after a stream is opened between AIR and Flash Player, the AIR is calling "starTransmit" on the FlashPlayer NetStream, wich is not implemented.
    >> try making an object with those method names and assign it to netStream.client
    [Guillaume] -> I tried the following:
    Implement starTransmit/stopTransmit functions in the NetStream.client object
    Implement startTransmit/stopTransmit functions in the NetStream instance (subclassed)
    Without success. Basically, it works fine if I just create a "dummy" client object for the NetStream that has those 2 functions. But If I want to use my own client it was still crashing.
    I found a work around for my problem.
    My NetStream object is sub classed as such:
    public class NetStreamProvider extends NetStream
      public var customClient:Object;
      public function NetStreamProvider (connection:NetConnection, peerID:String)
       super(connection, peerID);
       customClient = new Object();
       this.client = customClient;
       // Implement startTransmit and stopTransmit here for dummy client
       customClient.onPeerConnect = function(subscriber:NetStream): Boolean{
        var subClient:Object=new Object();
        subClient.stopTransmit=function($p1:*,$p2:*):void{
         trace("Cosy: stopTransmit called",$p1,$p2);
        subClient.startTransmit=function():void{
         trace("Cosy: startTransmit called");
        subscriber.client = subClient;
        return true;
      public function SetClient(c:Object):void
       this.client = c;
      public function OnNetStreamAsyncError(event:AsyncErrorEvent):void
    And in the stream status event handler, when the stream is ready (events "NetStream.Play.PublishNotify" and "NetStream.Play.Start") I set the correct client, which has the receive handler. At that point startTransmit was already called:
    And in the stream status event handler, when the stream is ready (events "NetStream.Play.PublishNotify" and "NetStream.Play.Start") I set the correct client, which has the receive handler. At that point startTransmit was already called:
    private function OnNetStreamStatus(e:NetStatusEvent)
    switch(e.info.code)
      case "NetStream.Play.PublishNotify":
               stream = e.target as NetStreamProvider;
               stream.SetupClient(client);
      break;
      case "NetStream.Play.Start":
               stream = e.target as NetStreamProvider;
               stream.SetupClient(client);
      break;
    At this point, i'm not blocked anymore. However, it would be good to know why, when and who are calling those functions to understand the issue. this is not documented anywhere, and might be an issue to a lot of people now that we are starting to see more and more cross-platform connectivity.
    Cheers.
    Guillaume

  • Why onMetaData handler doesn't be called when playing some .flv?

    Hello, Everyone,
    I am encountering a problem:
    I am using NetStream to play some .flv files on local disc. My code skeleton is:
    public class AdvertisPanel extends MovieClip
              private var _video:Video;
              private var _connection:NetConnection;
              private var _stream:NetStream;
              private var _clientObject:Object;
              public function AdvertisPanel($playlist:Array, $delay:int)
                        ....(code omitted)
              public function build():void
                        this._video = new Video();
                        this._connection = new NetConnection();
                        this._connection.connect(null);
                        this._stream = new NetStream(this._connection);
                        this._video.attachNetStream(this._stream);
                        this._clientObject = new Object();
                        this._clientObject.onMetaData = this.metaDataListener;
                        this._clientObject.onXMPData = this.XMPDataListener;
                        this._stream.client = this._clientObject;
                        this._stream.addEventListener(NetStatusEvent.NET_STATUS, this.netStreamStatusHandler);
                        this._stream.addEventListener(IOErrorEvent.IO_ERROR, this.netStreamIOErrorsHandler);
                        this._stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, this.netStreamAsynErrorsHandler);
                        this.addChild(this._video);
                        this._stream.play(this._medias[this._currentPlayingIndex].mediafile); // this is the url of the video
              private function metaDataListener($metaData:Object):void
                        ....(code omitted)
                        trace(metaData.duration, $metaData.width, $metaData.height);
              private function XMPDataListener($xmpData:Object):void
                        ....(code omitted)
                        trace($xmpData);
              ....(code omitted)
    I used some .flv files that I download from YouTube to test; and I found that the handler metaDataListener would not be called when playing some .flv files, but some would. Is the problem caused by the video file? Because I may resize the video before play it on the screen, and I really need to know its original width & height.
    Would some ont help with that? Thanks a lot in advance.

    Thanks, Donny.
    But I failed to open the .flv file with Adobe Media Encoder, it said that the format was not suported.
    And the .flv is downloaded from YouTube.

  • OSMF NetStream firing end event too early

    HI,
    I originally posted this here: http://forums.adobe.com/message/5067347#5067347 but I got no responses and then remembered an OSMF specific forum where I hoped I might find more help!
    I've been digging into a bug report where the ends of adverts are clipped by up to three seconds in Android and, after a _lot_ of painful debugging, I have come to the conclusion that the issue is with the underlying NetStream object.
    After a bit of jiggery pokery to locate the NetStream on NetStreamLoadTrait, I was able to listen to the changes to NetStream.time and to compare against the TimeTrait values, also to see what events were happening where and when. After placing this code on an Event.ENTER_FRAME handler, I was able to see clearly that there is _ALMOST_ALWAYS_ a huge jump in the last two frames... This equates to clipping off the last few seconds of the video as the jump tends to occur a couple of seconds prior to the end. Having placed break-points in OSMF code, it appears that the end is "correct" in that it is always in response to a NetStream.Play.Stopped... just that the NetStream.Play.Stopped is firing at the wrong time.
    Does anyone have _any_ idea what could be causing this? Is it likely to be with the media being supplied (third-party advertsing video...) or the plugin itself?
    Thanks,
    G

    Hi,
    Bumping this one in hopes!
    This one is a huge show-stopper as _nobody_ will be happy with the potential for losing the terminal three seconds of their adverts upwards of half the number of times they are played!
    Seriously, am I the only one to have noticed this?
    G

Maybe you are looking for