Netstream Object

"The NetStream class opens a one-way streaming connection between a   Flash Player or AIR application  and Flash Media Server, or between a Flash Player   or AIR application and the local file system.   A NetStream object is a channel within a  NetConnection object."
Does this mean I can not get an flv streaming - if it is on a normal data server? Currently, I am reading a param in the url to retrieve the video location - Do i need the flv to be on a Flash Media Server to stream the flv file?
Thanks,
George

yes, the buffer is emptied after the stop:
ns.onStatus = function(infoObject:Object) {
trace("NetStream.onStatus called: ("+getTimer()+" ms)");
for (var prop in infoObject) {
trace("\t"+prop+":\t"+infoObject[prop]);
trace("");
};

Similar Messages

  • How can you determine the absolute path to a dynamically created NetStream object?

    We are trying to implement video captioning with a freeware component, ccforflash. This requires us to provide an absolute or relative path  to our NetStream object. How can we determine this path in Flash CS5 AS3?
    From the CCforFlashCS5 documentation:
    "2. Object name and path
    Type the name and path.  This is the instance name of the object with which CCforFlashAS3 will synchronize. It must be spelled correctly, since CCforFlashAS3 will query the object with this name for timing information in order to synchronize the captions. The path must also be included; either relative to the CCforFlashAS3 component (i.e. this.parent) or the absolute path from the main level of the movie (root)."

    It would be easier if the NetStream object was created on an easily identifiable place on the timeline. This player has an MVC architecture. The NetStream object is created in a subclass to Model class, which is itself a subclass of the EventDispatcher object. The View class access it via an interface.
    As you can guess, it's not that straightforward to determine where the NetStream object is located on the timeline. This is compounded by the fact that the NetStream object does not have a name property.
    I've tried methods like these, but they only work for the DisplayObject class:
    public static function displayObjectPath( avDisplayObject : DisplayObject ) :String
    var lvPath:String = "";
    do
    if( avDisplayObject.name ) {
    // var obj_name:String = (avDisplayObject.name == 'root1') ? 'root' : avDisplayObject.name;
    if (avDisplayObject.name != 'root1') {
    lvPath = avDisplayObject.name
       + ( lvPath == "" ? "" : "." + lvPath );
    } else {
    trace("displayObjectPath() NO NAME avDisplayObject="+avDisplayObject);
    } while( avDisplayObject = avDisplayObject.parent );
    return lvPath;
    } // displayObjectPath
    private  function showChildren(d:DisplayObjectContainer):void {
    trace("showChildren()");
    if (d.numChildren>0) {
    for (var c:Number = 0; c < d.numChildren; c++) {
    trace("showChildren c=",c," name=",d.getChildAt(c).name);

  • Still trying to get to the NetStream Object

    Hi, I am trying to get to the NetStream object so that I can listen to the NetStatusEvents. Unfortunately the code listed on:
    http://forums.adobe.com/message/2725207
    no longer works. Is there another way? Thanks.

    It can be frustrating, especially when the workflow is so different from what we are used to with video. The idea behind the structure is to let OSMF manage the stream and expose needed events on the MediaPlayer. It definitely is a different way of doing things, but most events you need can be gotten from there.
    That being said, somethings require the NetStream object. You can extend the VideoElement, which is passed a NetLoader in its constructor. You can get the NetStream off the loader, though it is a good idea to check if it is there, since loader can be one of many classes that may not have the netStream property.:
    if( elementLoader.hasOwnProperty( 'netStream' ) )
      var netStream:NetStream = elementLoader[ 'netStream' ];
    Of course, if you're using a MediaFactory, you may need to customize it to use your custom VideoElement.
    Hope that helps.

  • Total time for a netstream object?

    I'm making a video player, and I'm having trouble making a
    seek bar. There is the &quot;time&quot; property of the
    netstream, but there doesn't seem to be a way to find the total
    length of the video in seconds, making it difficult to find the
    fraction of the video played so far. I notice that there's the
    total size of the video in bytes, but I'm hoping there's an easier
    way to determine the length of the video (are bit rates variable or
    fixed for flv files?)
    tia

    If you happen to be using the FLVPlayback component, I've
    made a little tut on how to customize to have the ability to listen
    for NetStatusEvents..
    http://www.flashgods.org/blog/2008/01/18/modifying-flvplayback-to-dispach-netstatusevents/

  • Read timecode from Netstream object "onFI"? Write Plugin or edit Src

    Hi,
    I`m new to Strobe Media Playback. I need to get the Timecode information out of my rtmp stream.
    I figured out that I can access this information by adding a Handler to the LightweightVideoElement.
    var element1:LightweightVideoElement = _media as LightweightVideoElement
    element1.client.addHandler("onFI", onFI);
    public function onFI(info:Object):void {
                if (ExternalInterface.available)
                    flash.external.ExternalInterface.call("onFiFunction",info["sd"].toString(), info["st"].toString());
                }else{
                    trace ("No External Interface available! Cannot call Javascript function!!");               
    For this I have to edit the "src" of Strobe Media Playback. Is there a way to get this information by using/writing a Plugin? If so, how can I access the   LightweightVideoElement.client.addHandler method in the Plugincode?

    Mr.Elendig wrote:
    try to add
    unset LDFLAGS
    -Wl,--as-needed might be causing problems.
    Wow, I had unset CFLAGS earlier That worked. Thanks.

  • NetStream Error: NetConnection object must be connected

    I have successfully connected to NetConnection using AMF0
    format. I have verified by looking at the Connected property and
    the admin console. However, when I create a new NetStream object
    and pass a NetConnection object I get the error listed below...
    ArgumentError: Error #2126: NetConnection object must be
    connected.
    at flash.net::NetStream/flash.net:NetStream::construct()
    at flash.net::NetStream$iinit()
    at test/Testing()
    at test/___Application1_initialize()
    at
    flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()
    at mx.core::UIComponent/set processedDescriptors()
    at mx.core::Container/createComponentsFromDescriptors()
    at mx.core::Container/mx.core:Container::createChildren()
    at mx.core::UIComponent/initialize()
    at mx.core::Container/initialize()
    at mx.core::Application/initialize()
    at test/initialize()
    at mx.managers::SystemManager/
    http://www.adobe.com/2006/flex/mx/internal::childAdded()
    at mx.managers::SystemManager/::initializeTopLevelWindow()
    at mx.managers::SystemManager/::docFrameHandler()
    What am I doing wrong? The Flash Administration page says
    that I have one client connected. The NetConnectionObj.connected
    property is true... Here is my basic code
    var client_nc:NetConnection = new NetConnection();
    client_nc.objectEncoding = flash.net.ObjectEncoding.AMF0;
    client_nc.connect("rtmp:/FLEX");
    if(client_nc.connected == true)
    testBox.text += "\nConnected to rtmp:/FLEX!\n";
    else
    testBox.text += "Could NOT Connect to rtmp:/FLEX!\n";
    //THIS IS
    WHERE I GET THE ABOVE ERROR
    var out_ns:NetStream = new NetStream(client_nc);
    I am able to connect to the same application via flash and
    stream video, but not through FLEX. The only difference is where
    these folders are located...permissions issue???
    I hope its something stupid that I am doing ... Please
    help!!!

    sorry about my last piece of code.... i forgot you are coding
    in AS3 - have
    some trickies.... but the logic still same... is a good
    chooice, always, make sure you have succeded connection.....
    NetConnection.defaultObjectEncoding =
    flash.net.ObjectEncoding.AMF0;
    private function init():void{
    // Create the NetConnection and listen for NetStatusEvent
    and SecurityErrorEvent events
    nc = new NetConnection();
    nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
    nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
    netSecurityError);
    nc.connect("rtmp://pb.local:1935/flexmediaservertest");
    private function netStatus(event:NetStatusEvent):void {
    trace("netStatus: " + event);
    var info:Object = event.info;
    trace(info.code);
    if (info.code == "NetConnection.Connect.Success") {
    // lots more code here...
    // CALL YOUR PUBLISH FUNCTION HERE.
    private function
    netSecurityError(event:SecurityErrorEvent):void {
    trace("netSecurityError: " + event);
    I hope that's all....

  • SMIL File / Flash Video Object / Netstream

    Hi all!
    I have build a streaming video player bassed on the flash Video Object and netstream. The company that provides the streaming have now gone over to Dynamic Streaming and uses SMIL files. Usually this is not a problem if i had used a FLVPlayback component, But now that my player is a Video Object i just can't get it to work.
    I don't want to rebuild the entire player based on FLVPlayback component since the current play have many functions.
    Have anyone built a Dynamic player based on Video object? Anyone that can help me with this?
    Oh yeay. I use AS2  I know i'm going over to AS3 but this player in built in as2
    Looking forward to see how this can be solved

    Hi,
    I don't think there is a direct way of using SMIL files with Video Object like it can be used with FLVPlayback component.
    Also its much easier to accomplish dynamic streaming using AS3 than AS2.
    With the current AS2 implementation you might have to parse the contents of smil file store the details of different bitrate media available in the FMS app.
    Some amount of coding would be needed to leverage the QoS metrics which can be accessed from NetStream object when Flash Player 10 is used. And then based on what the metrics indicate pick an appropriate bitrate file to switch to.
    This article mentions how to use AS2 for dynamic streaming : http://www.adobe.com/devnet/flashmediaserver/articles/dynstream_actionscript.html
    Hoping to see if anyone else have tried to do it already so that it may prove helpful to you.
    In case you are looking to port your video player to AS3 , here are some useful links:
    http://www.adobe.com/devnet/flashmediaserver/articles/dynstream_advanced_pt1.html
    Now there is also an Open Source Media Framework which you can leverage to build media players easily.
    http://www.adobe.com/devnet/flash/articles/video_osmf_streaming.html
    Regards
    Mamata

  • AMS NetStream Response Object

    I am creating a NetStream object in Adobe Media Server application, and getting the following error:
    Sending error message: Response object not found (_result:0).
    I have defined a handler for the onStatus message, which is working fine, but it doesn't catch this error. And I can't find any information on this error message anywhere. Indeed, the documentation on server-side error messages is very limited.
    The code causing this error is:
      var ns = null;
        try
        ns = new NetStream(application.nc);
        catch (e)
         trace("____NetStream error" + e.name + " " + e.message);
         return;
        ns.onStatus = netStreamStatusHandler;
    I am getting NetStream.Connect.Success though. And I was wondering if the NetStream constructor calls a method initStream() on the other server?
    thanks, Paul

    I highly recommend you read either the Sun Servlet tutorial or one on the web. But this should at least get you started:
    HttpServletRequest
    Used to retrieve HTML form parameters submitted to the Servlet
    Maintains a reference to the user's HTTP web session
    Used to inspect any HTTP headers sent by the client browser
    Used to retrieve any HTTP message body data (say, XML submitted to the server or form parameters, as above)
    Used to retrieve references to other objects descriping the Servlet configuration, intialization parameters, and container informationHttpServletResponse
    Used to send HTTP headers back to the client browser (content-type, content-length, etc.)
    Used to send HTTP message body data back to the client browser (HTML content, PDF content, etc.)The reason you passed the response object to sendPage2() is so the content type could be set (in this case, 'text/html' indicating an HTML web page) and so that a Writer reference could be obtained to output the actual HTML content back to the browser.
    - Saish

  • 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

  • How can I get low level access to netstream using OSMF?

    Hi
    I'm trying to gain access to the low level netstream underneath the hood of OSMF so that I can access its netstream.info property for reading metrics.
    I find that I am able to do this for MP4 videos but not for F4M dynamic streaming videos.
    For MP4, I was successfully able to create a VideoElement that used a CustomNetLoader class which overrided the createNetStream method to return a netstream object.
    However, for F4M, I have to use either the MediaFactory.createMediaElement(element) method or the F4MElement. The F4MElement does not allow a CustomNetLoader to be used and it seems to only accept a F4MLoader class.
    Any advice on how I can access either the netstream object or the metrics of F4M videos?
    Thanks

    ok, I finally got access to the direct netstream object - someone from Akamai gave me the answer.
    Seeing how I wasn't able to find this answer anywhere on Google, I'm going to post the solution here as there's no way I would have known this solution without someone who knew how to get direct access to the netsteam object in OSMF.
    There's a hidden class that won't show up in the code hint called org.osmf.net.NetStreamLoadTrait that you have to import.
    1) First, your media player playing controlling your MediaElement has to listen for a LoadEvent.LOAD_STATE_CHANGE event after you load the MediaElement into the media player
    mediaPlayer.addEventListener(LoadEvent.LOAD_STATE_CHANGE, onLoadStateChange);
    2) Upon LoadEvent.LOAD_STATE_CHANGE, check for a org.osmf.traits.LoadState.READY - you can only access the NetStream object when it is LoadState.READY or the netstream object will return as null.
    private function onLoadStateChange(e:LoadEvent)
                                  if(e.loadState == LoadState.READY)
    3) Once the LoadState.READY is true, you can create a datatype of NetStreamLoadTrait and type cast it from a Load trait:
    private function onLoadStateChange(e:LoadEvent)
      if(e.loadState == LoadState.READY)
         var nsLoadTrait:NetStreamLoadTrait = mediaPlayer.media.getTrait(MediaTraitType.LOAD) as NetStreamLoadTrait;
    4) Once you successfully type cast the Media Load Trait from your media into NetStreamLoadTrait, you can access the property netstream from the NetStreamLoadTrait object.
    private function onLoadStateChange(e:LoadEvent)
      if(e.loadState == LoadState.READY)
         var nsLoadTrait:NetStreamLoadTrait = mediaPlayer.media.getTrait(MediaTraitType.LOAD) as NetStreamLoadTrait;
         var ns:NetStream = nsLoadTrait.netStream;
    Hope this helps someone out there.

  • 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

  • How to clear the image after NetStream.attachVideo(null)

    hello,every one.
    i got a problem.need your guys' help.
    i create a normal NetStream object,then i publish video from
    my webcam,meanwhile,i set a Video object to play that stream,when i
    use NetStream.attachVideo(null) to stop publish video,the image in
    video paused,but not clear up.i wanna the image to be clear up,how
    to do?
    thx for your help.
    var mycam:Camera=Camera.get()
    var nc:NetConnection=new NetConnection()
    nc.connect("rtmp:/testapp")
    var ns:NetStream=new NetStream(nc)
    ns.attachVideo(mycam)
    ns.publish("oo")
    var ns2:NetStream=new NetStream(nc)
    ns2.play("oo")
    livevideo.attachVideo(ns2)
    localvideo.attachVideo(mycam)

    Is your instrument constantly sending data to you or only when you request the data?  If it is on request only, then your buffer should be cleared each time you do a read (assuming you told the VISA Read to grab enough data).  If your instrument is constantly sending data, then you need a second loop that does nothing but read and parse the data coming in.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • BEX Exception with NetStream

    Hi,
    We have a flex component, which need to simultaneously stream upto 16 CCTV camera streams. We are using  a Media Server(Wowza) to convert the RTSP stream to RTMP and display in flex.
    Initially we tried the video display component, available with the flex framework..but when we were streaming more streams the application hanged and the PC monitor started to flicker. because some of the camera's will be not reachable in our deployment
    Hence we removed the videodisplay component and wrote our own custom classes and add the video component at run-time. We are creating a single netconnection object and multiple netstream objects(one per CCTV/surveillance camera stream).
    video = new Video(videoWidth, videoHeight);
    video.name = "camerafeed";
    video.attachNetStream(netStream);    
    addChild(video);
    But after a while we are getting BEX (Buffer Overflow Exception)..
    Appreciate if somebody can explain the maximum limit of the video component and the limits for the number of netstreams that can be created in one netconnection?.
    Why is the VideoDisplay Flex component not able to switch between multiple camera's and display multiple streams?
    Our PC is windows 7, having AMD Radeon H6650 graphics card.
    Thanks,

    Mavi:
    Have you ever received a resolution to this error?
    We have a user getting this on an infrequent basis... not consistently.
    Any suggestions appreciated.

  • Multiple NetStreams

    Hi, I'm building a video player which loads .flvs into a
    movie clip from a menu and places the movie clip on the stage using
    getNextHighestDepth. Everything works great except the client would
    like the viewer to be able to leave clip A, view clip B and return
    to the last viewed point in the A clip's timeline. Is this possible
    without getting into a serverside streaming application? Would I
    need to create multiple movieclips with embedded video objects, and
    start swapping depths on the stage? Or can it be done with multiple
    netStream objects? Thanks for any guidance.

    I'm working on a chat app that shows up to 10 live cams at a
    time in one swf. When a user joins the room the publish through a
    separate connection, but all of the subscribes are through one
    connection - I thought it would help to minimize connections to the
    server to stream through one connection.
    Is it recommended to separate these out into individual
    connections?

  • Post - Processing Video Data From NetStream

    Is it possible to intercept video data from a NetStream object and do some custom post-processing say 'deblocking  on decoded data  or decryption on encoded content' etc. The Sound class provides access to the SampleData but i havent been able to find the Video class providing similar support. Am i missing something or is this inherently impossible
    Thanks in advance
    Sunil M

    I managed to perform video post-processing through alchemy some time ago.  I think I drew the video to a BitmapData object, converted the pixels to a bytearray with getPixels() to read them, and then updated the contents with setPixels() straight from alchemy's memory bytearray every frame.  Just watch out for endianness.
    Really, I imagine video postprocessing would be better suited for a pixel bender filter than alchemy code, and in general it is definitely not something flash player is designed to do.

Maybe you are looking for

  • / usage questions...

    Hello. I have 2 questions: 1. I have noticed that my / partition's used space increased by ~10M from the last time I've checked it, from 111M to 121M. What could be the cause of that? (see the info below...) 2. The output of df and du is not what I a

  • File Upload Problem in Mozila

    Hi; My code is workin in IE but problem in Mozila Fireforx: <%@page import="org.apache.commons.fileupload.DiskFileUpload"%> <%@page import="org.apache.commons.fileupload.FileItem"%> <%@page import="java.util.List"%> <%@page import="java.util.Iterator

  • HDV 1080i50 to SD MASTER Workflow

    Hello all. I am working now on a documentary, shot on Sony HDV 1080i50, 70 hours material, to be delivered in DIGIBETA PAL, and I am looking to the best approach to edit and finish it. Coming from the AVID World (yes, I confess...) and having worked

  • Huge and negative  gross profit

    HI experts! I have problem with gross profit in Sales Analysis. On each Sales Order, i have some Items which don'nt have item cost ( Item cost =0) and gross profit are caculated 100%. But in Sales Analysis, i got strange result  of gross profit is hu

  • EJB in ADF BC project

    I am currently using JDeveloper 11.1.1.3 with WL 10.3 I have created a fusion project and use the BC extensively. However - I have a lot of code the needs to be run as actions in many screens. I typically seperate this logic into EJBs to support the