This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Flex and the fly likes Flex/RED5 0.7 soundmixer.computespectrum security error while playing streaming audio, any solution? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Flex
Bookmark "Flex/RED5 0.7 soundmixer.computespectrum security error while playing streaming audio, any solution?" Watch "Flex/RED5 0.7 soundmixer.computespectrum security error while playing streaming audio, any solution?" New topic
Author

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

Shailesh Kadam
Greenhorn

Joined: Feb 08, 2011
Posts: 1

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="org.red5.server.stream.RtmpSampleAccess">
<property name="audioAllowed" value="true"/>
<property name="videoAllowed" value="true"/>
</bean>

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.

Thanks,
Shailesh
sskadam21@gmail.com
zhengrong zhao
Greenhorn

Joined: Feb 16, 2011
Posts: 2
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
width="334" height="256" layout="absolute" applicationComplete="{init()}"
horizontalScrollPolicy="off" verticalScrollPolicy="off" viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[

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

import mx.controls.*;

public function init():void
{
trace("init");

nc = new NetConnection();
nc.connect("rtmp://localhost/oflaDemo");
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
{
trace(e.info.code);
if (e.info.code == "NetConnection.Connect.Success" && ns == null)
{
trace("play");
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=" + info.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;
v.attachNetStream(ns);
vd.addChild(v);

videoBitmap = new Bitmap();
var videoBitmapData:BitmapData = new BitmapData(150, 120, false, 0x000000);
videoBitmap.bitmapData = videoBitmapData;
videoBitmap.name = "videoBitmap";
vdraw.rawChildren.addChildAt(videoBitmap, 0);

ns.play("D:/stream/201102/1/20110213112808761.flv");
ns.receiveVideoFPS(20);
ns.receiveVideo(true);
ns.receiveAudio(true);

}
if (e.info.code == "NetStream.Buffer.Full" && !hasEventListener(Event.ENTER_FRAME))
addEventListener(Event.ENTER_FRAME, onTime);
if (e.info.code == "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);
data.draw(vd);
/*
var matrix:Matrix = new Matrix();
data.draw(vdisplay,matrix);
_bitmaData = data;
*/
if (videoBitmap)
videoBitmap.bitmapData = data;
} catch (e:SecurityError) {
txt.text += "( Error #"+e.errorID+" ) "+e.name+"\n";
}
}

/*public function captureHiddenDatagrid() : void
{
_vid.attachNetStream(null);
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_4.data = _loc_3;
var _loc_5:* = new URLLoader();
_loc_5.dataFormat = URLLoaderDataFormat.BINARY;
_loc_5.load(_loc_4);
_vid.attachNetStream(_netStream);
}// end function*/
]]>
</mx:Script>
<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"/>
</mx:Application>
zhengrong zhao
Greenhorn

Joined: Feb 16, 2011
Posts: 2
my english is pool... I think this is feasible
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Flex/RED5 0.7 soundmixer.computespectrum security error while playing streaming audio, any solution?
 
Similar Threads
Using PropertyPlaceholderConfigurer to read in external properties - not working
Security error accessing url
Media player problem
Tomcat 6 Server Status - No maxThreads Attribute
Flex Developer (NYC Area)