Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Flex/RED5 0.7 soundmixer.computespectrum security error while playing streaming audio, any solution?  RSS feed

Shailesh Kadam
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am using RED5(0.7.0) Flash server to create an audio streaming application using flex 3.0. In this application I want to show the spectrum graphics for streamed audio.

When I load the audio stream flash application throws security error inside the soundmixer.computespectrum function.

Error message:
Error #2123: Security sandbox violation: SoundMixer.computeSpectrum: http://appServer/audioRecorder.swf?x=7514.415487604303 cannot access rtmp://red5Server/oflaDemo/. No policy files granted access.

I have tried some possible solutions available on internet things to resolve this issue, but no success. Some of the solutions are as follows:

1.Updated the red5-web.xml with following xml Node:

<bean id="rtmpSampleAccess" class="">
<property name="audioAllowed" value="true"/>
<property name="videoAllowed" value="true"/>

2.Added the crossdomain.xml on Red-5 server.

Can anyone come across the same problem and found some way to resolve this issue?

As graphical spectrum computation works well for sound object, Can we show same using RED5 server for streaming audio?

Any help to resolve this issue is appreciated. Thanks in advance.

zhengrong zhao
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx=""
width="334" height="256" layout="absolute" applicationComplete="{init()}"
horizontalScrollPolicy="off" verticalScrollPolicy="off" viewSourceURL="srcview/index.html">

private var nc:NetConnection;
private var ns:NetStream;
private var videoBitmap:Bitmap;
private var _bitmaData:BitmapData;

import mx.controls.*;

public function init():void

nc = new NetConnection();
nc.objectEncoding = ObjectEncoding.AMF3;
nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
nc.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void {trace(e.toString())});
nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function(e:SecurityErrorEvent):void {trace(e.toString())});

var client:Object = new Object();
client.onBWDone = function():void {};
nc.client = client;

public function onNetStatus(e:NetStatusEvent):void
if ( == "NetConnection.Connect.Success" && ns == null)
ns = new NetStream(nc);
ns.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
ns.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void {trace(e.toString())});
ns.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function(e:SecurityErrorEvent):void {trace(e.toString())});

ns.client = new Object();
ns.client.onMetaData = function (info:Object):void {
trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate);
ns.client.onCuePoint = function (info:Object):void {
trace("cuepoint: time=" + info.time + " name=" + + " type=" + info.type);
ns.client.onPlayStatus = function (info:Object):void {
trace("playstatus: " + info.toString());

var v:Video = new Video(150, 120);
v.width = 150;
v.height = 120;

videoBitmap = new Bitmap();
var videoBitmapData:BitmapData = new BitmapData(150, 120, false, 0x000000);
videoBitmap.bitmapData = videoBitmapData; = "videoBitmap";
vdraw.rawChildren.addChildAt(videoBitmap, 0);"D:/stream/201102/1/20110213112808761.flv");

if ( == "NetStream.Buffer.Full" && !hasEventListener(Event.ENTER_FRAME))
addEventListener(Event.ENTER_FRAME, onTime);
if ( == "NetStream.Buffer.Empty")
removeEventListener(Event.ENTER_FRAME, onTime);

public function onTime(e:Event):void
try {
var data:BitmapData = new BitmapData(vd.width, vd.height, false, 0x000000);
var matrix:Matrix = new Matrix();
_bitmaData = data;
if (videoBitmap)
videoBitmap.bitmapData = data;
} catch (e:SecurityError) {
txt.text += "( Error #"+e.errorID+" ) ""\n";

/*public function captureHiddenDatagrid() : void
var _loc_1:* = _bitmaData;//getBitmapData(UIComponent(vdisplay));
var _loc_2:* = new JPEGEncoder(60);
var _loc_3:* = _loc_2.encode(_loc_1);
var _loc_4:* = new URLRequest(imageurl);
_loc_4.method = "POST"; = _loc_3;
var _loc_5:* = new URLLoader();
_loc_5.dataFormat = URLLoaderDataFormat.BINARY;
}// end function*/
<mx:VideoDisplay x="8" y="5" width="150" height="120" id="vd" visible="true"/>
<mx:Canvas x="176" y="5" width="150" height="120" id="vdraw" visible="true"/>
<mx:TextArea id="txt" x="10" y="133" width="314" height="113"/>
zhengrong zhao
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my english is pool... I think this is feasible
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!