Macromedia Flash Server - Server side mp3 radio type streaming application and

This is Interesting: Free IT Magazines  
Home > Archive > Macromedia Flash Server > December 2005 > Server side mp3 radio type streaming application and





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Server side mp3 radio type streaming application and
Yves Ducreuzet

2005-12-20, 5:45 pm

Hello ,

I have been developping a small sub-application for our community iso
world. It is a very basic
mp3 playlist player. From the instance name, the application know which
playlist it have to play
, each radio have 20 mp3s to play.

I keep track of the number of users and if it reach 0 i clear the
Stream, if again it reach one later
i restart the radio.

Everything works fine exept that the memory used by previous sessions
never get released, and
with something like 5 radios now playing playing each 20's 64Kbits mp3 ,
the memory grows up quickly.
I understand the grow but why the memory is never released.

I checked my code, checked names collisions,valid stream names, mp3
bitrates ,...nothing helps.
For some reason it seems that flashcom GC cant clean up the stuff.

When i check the AppInspector i can see that the iddle streams are
correctly removed but the used memory
still there. Any ideas ? Thx in advance, Yves

here is the ssas code for the mp3-radio

/*

FcRadio.asc

*/

application.onAppStart = function ()
{

maxGuest = 60
gCount =0
tIndex=0
load("playList.asc")
application.radioName = application.name.split("/")[1]
application.playList = getPlayList(application.radioName)


}


application.onConnect = function(rClient)
{
if (gCount<maxGuest)
{
gCount++
if (gCount==1)
{
application.radioStart()
}

application.acceptConnection(rClient)

if (application.id3Obj)
rClient.call("curTrackInfo",null,application.id3Obj)
}
else
{
application.refuseConnection(rClient,"too_many_clients")
}
}

application.radioStart=function()
{

strObj = Stream.get("str")
strObj.onStatus=function(info)
{
trace ("receive a : " + info.code + " event")
if (info.code=="NetStream.Play.Stop" )
{

if (tIndex<application.playList.length-1)
{
tIndex++
mp3_title = application.playList[tIndex]
mp3Sound = "mp3:"+application.radioName+"/"+mp3_title
mp3ID3 = "id3:"+application.radioName+"/"+mp3_title
this.play(mp3ID3, 0, -1, false)
this.play(mp3Sound, 0, -1, false)
}
else
{
tIndex=0;
mp3_title = application.playList[tIndex]
mp3Sound = "mp3:"+application.radioName+"/"+mp3_title
mp3ID3 = "id3:"+application.radioName+"/"+mp3_title
this.play(mp3ID3, 0, -1, false)
this.play(mp3Sound, 0, -1, false)
}
}
}

strObj.onId3=function($o)
{
application.id3Obj={}

for (var i in $o)
{
trace (i + " : " + $o[i])
application.id3Obj[i]=$o[i]
}

this.send("id3",application.id3Obj)
}

mp3_title = application.playList[tIndex]
mp3Sound = "mp3:"+application.radioName+"/"+mp3_title
mp3ID3 = "id3:"+application.radioName+"/"+mp3_title
strObj.play(mp3ID3, 0, -1, false)
strObj.play(mp3Sound, 0, -1, false)
}

application.onDisconnect=function($client)
{
gCount--

if (gCount==0)
{
delete strObj.onStatus
delete strObj.onId3
result = strObj.clear()
delete strObj
trace ("nomore user we clear the stream and the operation
success == "+ result)
}
}


/*
Methods
*/

function getPlayList($plistId)
{

var plArray=[]
var curPlayListBank=eval("playList_"+$plistId)
for (var i in curPlayListBank)
{
plArray.push(i)
}
return plArray
}



=-----------------------------------------------------------
Supported by Fig Leaf Software - http://www.figleaf.com
=-----------------------------------------------------------

To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com