Client.videoSampleAccess False-Negative

In past versions of FMS, developers were barred from accessing raw audio and video data over RTMP and had to resort to a number of hacks and proxies to get around the restriction.  As time went by and new versions of the Flash Player were released, a lot of these loopholes were blocked as well.

With FMS3, there is Client.videoSampleAccess: a property of the Flash Media Server 3 that allows direct access to raw stream data for video use (“audioSampleAccess” for audio).  This can be used for things like producing visual audio spectrums or grabbing a still from a video stream.  It is applied within the onConnect method of the Application server class as demonstrated here:

appClient.audioSampleAccess = "/";
appClient.videoSampleAccess = "/";

In the above example, the “/” signifies that any streams within the application directory are allowed to be sampled in this way.  You can also specify a semicolon-delimited list of folder names instead if you need to be picky.

Something I came across today and the whole point of this post: even when you have Client.videoSampleAccess set up properly on Flash Media Server, you will still receive a security sandbox violation error #2123 if the stream data is not available.  This can easily happen if you have a timer invoking BitmapData.draw every few milliseconds on loading content.

One way to get around this is using NetStatusEvent.NET_STATUS making sure it reports “NetStream.Buffer.Full” before attempting to access the stream data.  Depending on what you are doing, you can oftentimes check the object recieving the stream data to be sure it is accessible first.  this all seems really obvious now, but threw me for a bit of a loop, initially.


  1. brillant post… I am doing just what you said and getting a the random security error…. great work…

    now I just need to work out why fms3 seems to think I am using 2 connections instead of one and I will be happy.

    Thanks for your post!!!

  2. The Buffer.Full solution doesn’t work for me. Well actualy it didn’t work, then it did a few times and now doesn’t want to anymore… i’ll keep testing…

    I didn’t change anything except for the Timer interval ComputeSpectrum is being called by. Saying that i managed to change it a few times while it worked so i don’t think that’s the problem. Would you say using the buffer full status event actually works 100% of the time in your experience?


  3. this definitely works in a random way – sometimes it’s ok and other times i get the exception… The wierd thing is when using Wowza it’s not any issue ever plus i don’t need to set the access properties on the Client object.

    So maybe that’s Wowza 1 – FMIS 0 ???

  4. This still has a mind of it’s own… sometimes working :)

    What’s more confusing is how it never works on a live stream coming from Flash Media Encoder. It sometimes works with an MP3 only stream and also with the audio data from an FLV stream as long as it’s not live (currently being published – in my case by FME 2.5).

  5. @Doug

    I’ve had this occur as well- very spotty at times (via FMS3). Something I’ve done to be extra safe is to set a delay before I try and write anything once the buffer full status is triggered. This has worked fairly well- but I’d love to NOT have to mess with such work-arounds.

Leave a Reply

Your email address will not be published. Required fields are marked *