Dan Rossi wrote:
ive been currently trying to get deep into the API to collect useful information to create windows media / FMS log fields out of it. Here is what ive come up with so far, its not perfect yet or possibly incorrect as im still trying to work out which is the proper data for bytes sent to the client from the server and bytes sent from the client to the server etc. Im trying to collect this once the stream has closed, so im still trying to work out how to get the stream name and its codec info, duration, etc. The other useful bit of info i need to find out is how to obtain client side info like the flash player version, user agent, os etc. Hi here is the updated version, it seems no information from the client gets sent apart from the version number which is strange, so ive had to send that info by the arguments to connect. I still cant manage to get the user agent , audio and video codecs from the stream among other things. Im also needing to know if collecting this information to pass along the methods like conn.getClient().setAttribute("os", args.get("os")); is the most appropriate way ? public void streamSubscriberClose(ISubscriberStream stream) { IConnection conn = Red5.getConnectionLocal(); // StreamDataFormatter formatter = new StreamDataFormatter(); DateFormat date = new SimpleDateFormat("yyyy-MM-dd"); DateFormat time = new SimpleDateFormat("HH:MM:SS"); //conn.getConnectParams().get(key) //dumpMap(conn.getConnectParams()); log.info("c-playerversion: " + conn.getConnectParams().get("flashVer")); log.info("c-swffile: " + conn.getConnectParams().get("swfUrl")); log.info("c-referer: " + conn.getConnectParams().get("pageUrl")); log.info("c-totalbuffertime: " + stream.getStreamFlow().getClientTimeBuffer()); log.info("x-duration: " + stream.getStreamFlow().getTotalStreamTime()); //log.info("x-sname: " + ); log.info("x-app: " + conn.getPath()); log.info("x-appinst: " + conn.getScope().getName()); log.info("avgbandwidth: " + stream.getBandwidthConfigure().getOverallBandwidth()); log.info("maxbandwidth: " + stream.getBandwidthConfigure().getOverallBandwidth()); log.info("c-proto: " + conn.getType()); log.info("s-uri: " + conn.getConnectParams().get("tcUrl")); //log.info("audiocodec: " + stream.getCodecInfo().getAudioCodecName()); //log.info("videocodec: " + stream.getCodecInfo().getVideoCodecName()); log.info("date: " + date.format(new Date())); log.info("time: " + time.format(new Date())); log.info("s-session-id" + conn.getSessionId()); log.info("c-ip: " + conn.getRemoteAddress()); log.info("c-port: " + conn.getRemotePort()); log.info("s-ip: " + conn.getHost()); log.info("c-starttime: " + conn.getClient().getCreationTime()); log.info("c-endtime: " + conn.getLastPingTime()); log.info("c-bytes: " + conn.getWrittenBytes()); log.info("sc-bytes: " + stream.getStreamFlow().getTotalBytesTransfered()); log.info("c-os: " + conn.getClient().getAttribute("os")); log.info("c-playermanufacturer: " + conn.getClient().getAttribute("manufacturer")); log.info("c-playertype: " + conn.getClient().getAttribute("type")); log.info("c-playerlanguage: " + conn.getClient().getAttribute("lang")); log.info("c-screenres: " + conn.getClient().getAttribute("res")); log.info(conn); } in the appConnect method public boolean appConnect(IConnection conn, Object[] params) { if (params.length > 0) { HashMap<String,String> args = (HashMap<String,String>)params[0]; conn.getClient().setAttribute("os", args.get("os")); conn.getClient().setAttribute("lang", args.get("lang")); conn.getClient().setAttribute("manufacturer", args.get("manufacturer")); conn.getClient().setAttribute("type", args.get("type")); conn.getClient().setAttribute("res", args.get("res")); } } on the client side nc.connect(serverURL, ClientInfo.toArray()); import flash.system.Capabilities; public final class ClientInfo { public static function toArray():Object { var clientInfo:Object = {manufacturer:Capabilities.manufacturer, os:Capabilities.os, lang:Capabilities.language, type:Capabilities.playerType, res:Capabilities.screenResolutionX + "x" + Capabilities.screenResolutionY}; return clientInfo; } } let me know. dan |
_______________________________________________ Red5 mailing list [email protected] http://osflash.org/mailman/listinfo/red5_osflash.org
