Skip to main content
niteshkumar
Inspiring
February 5, 2010
Question

How to deallocate last buffer displayed

  • February 5, 2010
  • 1 reply
  • 527 views

Hi,

 

    I am publishing the video over FMS and viewing it on other PC through display video. Now when I stop publishing the video, I am getting the last buffer as still image on the other PC(viewer). I want to know how we can delete that last buffer on viewr PC when publishing stops.

    This topic has been closed for replies.

    1 reply

    February 7, 2010

    Hi,

    One way to accomplish this is as follows:

    When the publish is stopped, you could check for the "NetStream.Play.UnpublishNotify" status message in the event listener for NetStatusEvent of the subscriber stream. Then stop the play and call the clear( ) method of the video object to clear the frozen frame. Stopping of the play automatically clears the flash player buffer.

    subscriber_ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);

    function netStatusHandler(event:NetStatusEvent):void
    {
        try
        {
                 if(event.info.code == "NetStream.Play.UnpublishNotify")
                 {
                     subscriber_ns.play(false);
                     subscriber_video.clear();     // subscriber_video is the instance of the Video object used to display the subscriber netstream    
            }
          }
        catch (error:TypeError)
        {
            //handle any errors.
        }
    }

    But if you don't want to stop the play then once  "NetStream.Play.UnpublishNotify" is received just set a timer to wait a couple of milliseconds for flash player to send any remnant data and then call the subscriber_video.clear(); .

    Thanks

    Mamata