I am not sure what i am doing wrong. But getAvailableCasts() function always returns array with 0 length.
Lapo please comment
Piece of my code :
private function onLiveCastPublished(ev:RedBoxCastEvent):void
{
var liveCast:LiveCast = ev.params.liveCast
// Subscribe live cast
var stream:NetStream = avCastMan.subscribeLiveCast(liveCast.id);
...... //Some other code
}
private function onAVCastConnectionInited(ev:RedBoxCastEvent):void {
/*Listen for live broadcasts*/
var castsArray:Array = avCastMan.getAvailableCasts();
trace("LENGTH :", castsArray.length); //ALWAYS 0
.... //Some other code
}
public function publishLiveCast():void
{
try{
avCastMan.publishLiveCast(true, true);
}
catch(e:NoAVConnectionException)
{
/*Show Error Popup to the user*/
dispatchEvent(new Event("RedBoxConnectionError"));
}
}
getAvailableCasts() always returns 0 length array
[solved]
Solved the issue. To have getAvailableCasts() work for you, you need to make sure that it is called after SmartFox room is joined.
In my case there was a race condition and getAvailableCasts() was being called before room was joined.
In my case there was a race condition and getAvailableCasts() was being called before room was joined.
-
- Posts: 9
- Joined: 06 Jan 2012, 22:38
same problem
I'm having the same problem, only waiting to make sure I join a room doesn't help. No matter what I've tried, the getAvailableCasts is always empty or null.
-
- Posts: 9
- Joined: 06 Jan 2012, 22:38
Fixed
So I've solved my problem regarding the empty getAvailableCasts array. It's not that it's empty. It's that it's an associative array.
So instead of doing:
for(i=0; i < length; i++)
You have to do:
for each(var livecast:LiveCast in array)
Although the first method should work regardless, it's actually because I was limiting "length" to the max number of streams I was expecting.
So I was doing:
length = Math.min(getAvailableCasts.length, maxStreams)
*pseudo code*
So instead of doing:
for(i=0; i < length; i++)
You have to do:
for each(var livecast:LiveCast in array)
Although the first method should work regardless, it's actually because I was limiting "length" to the max number of streams I was expecting.
So I was doing:
length = Math.min(getAvailableCasts.length, maxStreams)
*pseudo code*
Who is online
Users browsing this forum: No registered users and 51 guests