0 Replies Latest reply on Oct 1, 2014 9:37 PM by Zing1911

    Video Chat Application : Problem downstream on ios device

    Zing1911

      Hi

       

           I made real time video chat application between mobile (ios and android device with flash builder 4.7 on flex 4.6.0 and adobe air 15) and flash desktop website (flash builder 4.6, on flex 4.6.0 air 4.0).   It's almost done, but there is a problem only ios device subscribe stream is very lag for the first time that video streaming start.   Sometime it is stop for several time before it can be play that stream. I find the cause of it such as network, flash desktop build version, buffer (it's very smooth but there is problem when you press home button while using video chat, It's stream is gone T^T)

       

      I have the example of downstream :

       

      // ------------ sample code that using netstream ------------

       

      if(subscribeNetStream == null)

        subscribeNetStream = new NetStream(subscribeNetConnection);

       

        trace("Initial for playing agent video")

        subscribeNetStream.client = {onMetaData:function(obj:Object):void{}};

       

        // display metadata

        var clientMetaData:Object = new Object();

        clientMetaData.onMetaData = function(info:Object):void{

        trace("onMetaData");

        // print debug information about the metaData

        for (var propName:String in info){

        trace("  "+propName + " = " + info[propName]);

        }

        };

       

        subscribeNetStream.client = clientMetaData;

       

        // trace the NetStream status information

        subscribeNetStream.addEventListener(NetStatusEvent.NET_STATUS, subscribeNetStatusHandler);

       

        // set the buffer time to zero since it is chat

        subscribeNetStream.bufferTime = 0;

       

        // subscribe to the named stream

        subscribeNetStream.play("Stream_name");

       

        // attach to the stream

        if(!videoSubscriber){

        videoSubscriber = new Video(uicAgent.width, uicAgent.height);

        }

       

        videoSubscriber.attachNetStream(subscribeNetStream);

        uicAgent.addChild(videoSubscriber);

       

      ------------------- netstream/netconnection handle method ----------------------------

       

      private function subscribeNetStatusHandler(event:NetStatusEvent):void{

        trace(event.currentTarget+" : "+event.info.clientid+" : Subscribe netStatus = "+event.info.code+"\n "+event.info.description);

        switch(event.info.code) {

       

        case "NetConnection.Connect.Success":

        {

        trace("Success to play");

        playStream();

        break;

        }

        case "NetStream.Buffer.Empty" :

        {

        if(holdingNetStream)

        holdingNetStream.seek(0);

        }

        default:

        {

        break;

        }

        }

        }

       

      // --------- End of sample code ------------------

       

      I have no idea for solving this problem please suggest me

       

      Thank you

       

      Pornphop Sudpan