Wowza 的Http扩展
获取所有的发布的流以及该流的订阅情况
package zjzhang.wowza; import java.io.*; import java.util.*; import com.wowza.wms.vhost.*; import com.wowza.wms.logging.WMSLoggerFactory; import com.wowza.wms.rtp.model.RTPSession; import com.wowza.wms.server.*; import com.wowza.wms.stream.IMediaStream; import com.wowza.wms.stream.MediaStreamMap; import com.wowza.wms.application.*; import com.wowza.wms.http.*; import com.wowza.wms.client.*; import com.wowza.wms.http.*; import com.wowza.wms.httpstreamer.model.IHTTPStreamerSession; public class GetList extends HTTProvider2Base { private void outputConnectionInfo(StringBuffer ret, ConnectionCounter counter) { ret.append("<ConnectionsCurrent>"+counter.getCurrent()+"</ConnectionsCurrent>"); ret.append("<ConnectionsTotal>"+counter.getTotal()+"</ConnectionsTotal>"); ret.append("<ConnectionsTotalAccepted>"+counter.getTotalAccepted()+"</ConnectionsTotalAccepted>"); ret.append("<ConnectionsTotalRejected>"+counter.getTotalRejected()+"</ConnectionsTotalRejected>"); } public void onHTTPRequest(IVHost inVhost, IHTTPRequest req, IHTTPResponse resp) { if (!doHTTPAuthentication(inVhost, req, resp)) return; StringBuffer ret = new StringBuffer(); try { List vhostNames = VHostSingleton.getVHostNames(); ret.append("<?xml version=/"1.0/"?>/n<WowzaMediaServerPro>"); Iterator<String> iter = vhostNames.iterator(); while (iter.hasNext()) { String vhostName = iter.next(); IVHost vhost = (IVHost)VHostSingleton.getInstance(vhostName); if (vhost != null) { ret.append("<VHost>"); ret.append("<Name>"+vhostName+"</Name>"); ret.append("<TimeRunning>"+vhost.getTimeRunningSeconds()+"</TimeRunning>"); ret.append("<ConnectionsLimit>"+vhost.getConnectionLimit()+"</ConnectionsLimit>"); outputConnectionInfo(ret, vhost.getConnectionCounter()); List appNames = vhost.getApplicationNames(); List<String> appFolders = vhost.getApplicationFolderNames(); Iterator<String> appNameIterator = appFolders.iterator(); while (appNameIterator.hasNext()) { String applicationName = appNameIterator.next(); ret.append("<Application>"); ret.append("<Name>"+applicationName+"</Name>"); boolean appExists = appNames.contains(applicationName); ret.append("<Status>"+(appExists?"loaded":"unloaded")+"</Status>"); if (appExists) { IApplication application = vhost.getApplication(applicationName); if (application == null) continue; ret.append("<TimeRunning>"+application.getTimeRunningSeconds()+"</TimeRunning>"); outputConnectionInfo(ret, application.getConnectionCounter()); List appInstances = application.getAppInstanceNames(); Iterator<String> iterAppInstances = appInstances.iterator(); while (iterAppInstances.hasNext()) { String appInstanceName = iterAppInstances.next(); IApplicationInstance appInstance = application.getAppInstance(appInstanceName); if (appInstance == null) continue; ret.append("<ApplicationInstance>"); ret.append("<Name>"+appInstance.getName()+"</Name>"); ret.append("<TimeRunning>"+appInstance.getTimeRunningSeconds()+"</TimeRunning>"); outputConnectionInfo(ret, appInstance.getConnectionCounter()); MediaStreamMap msm=appInstance.getStreams(); List<String> publishStreams =msm.getPublishStreamNames(); Iterator<String> iterPublish = publishStreams.iterator(); while(iterPublish.hasNext()) { IMediaStream stream = msm.getStream(iterPublish.next()); //appInstance.getClient(c); if (stream == null) continue; ret.append("<PublishStream>"); ret.append("<Name>"+stream.getName()+"</Name>"); ret.append("<Type>"+stream.getStreamType()+"</Type>"); ret.append("<PublishStreamReady>"+stream.isPublishStreamReady(false, true)+"</PublishStreamReady>"); ret.append("<PublishAudioCodecId>"+stream.getPublishAudioCodecId()+"</PublishAudioCodecId>"); ret.append("<PublishVideoCodecId>"+stream.getPublishVideoCodecId()+"</PublishVideoCodecId>"); List<IMediaStream> playStreams=appInstance.getPlayStreamsByName(stream.getName()); if(playStreams!=null) { ret.append("<SessionsFlash count=/""+playStreams.size()+"/">"); Iterator<IMediaStream> iterPlay=playStreams.iterator(); while(iterPlay.hasNext()) { IMediaStream playSession= iterPlay.next(); IClient playClient=playSession.getClient(); ret.append("<Session>"); ret.append("<ClientIP>"+playClient.getIp()+"</ClientIP>"); ret.append("<ClientFlashVer>"+playClient.getFlashVer()+"</ClientFlashVer>"); ret.append("<ClientConnectTime>"+playClient.getConnectTime()+"</ClientConnectTime>"); ret.append("</Session>"); } ret.append("</SessionsFlash>"); } else { ret.append("<SessionsFlash count=/"0/"/>"); } List<IHTTPStreamerSession> cupertinoSession=appInstance.getHTTPStreamerSessions(IHTTPStreamerSession.SESSIONPROTOCOL_CUPERTINOSTREAMING, stream.getName()); if(cupertinoSession!=null) { ret.append("<SessionsCupertino count=/""+cupertinoSession.size()+"/">"); Iterator<IHTTPStreamerSession> iterPlay=cupertinoSession.iterator(); while(iterPlay.hasNext()) { IHTTPStreamerSession playSession= iterPlay.next(); ret.append("<Session>"); ret.append("<ClientIP>"+playSession.getIpAddress()+"</ClientIP>"); ret.append("<ClientUserAgent>"+playSession.getUserAgent()+"</ClientUserAgent>"); ret.append("<ClientConnectTime>"+playSession.getTimeRunning()+"</ClientConnectTime>"); ret.append("</Session>"); } ret.append("</SessionsCupertino>"); } else { ret.append("<SessionsCupertino count=/"0/"/>"); } List<IHTTPStreamerSession> smoothSession=appInstance.getHTTPStreamerSessions(IHTTPStreamerSession.SESSIONPROTOCOL_SMOOTHSTREAMING, stream.getName()); if(smoothSession!=null) { ret.append("<SessionsSmooth count=/""+smoothSession.size()+"/">"); Iterator<IHTTPStreamerSession> iterPlay=smoothSession.iterator(); while(iterPlay.hasNext()) { IHTTPStreamerSession playSession= iterPlay.next(); ret.append("<Session>"); ret.append("<ClientIP>"+playSession.getIpAddress()+"</ClientIP>"); ret.append("<ClientUserAgent>"+playSession.getUserAgent()+"</ClientUserAgent>"); ret.append("<ClientConnectTime>"+playSession.getTimeRunning()+"</ClientConnectTime>"); ret.append("</Session>"); } ret.append("</SessionsSmooth>"); } else { ret.append("<SessionsSmooth count=/"0/"/>"); } List<RTPSession> rtpStreams=appInstance.getRTPSessions(stream.getName()); if(rtpStreams!=null) { ret.append("<SessionsRTSP count=/""+rtpStreams.size()+"/">"); Iterator<RTPSession> iterPlay=rtpStreams.iterator(); while(iterPlay.hasNext()) { RTPSession playSession= iterPlay.next(); ret.append("<Session>"); ret.append("<ClientIP>"+playSession.getIp()+"</ClientIP>"); ret.append("<ClientUserAgent>"+playSession.getUserAgent()+"</ClientUserAgent>"); ret.append("</Session>"); //ret.append("<ClientConnectTime>"+playSession.get+"</ClientConnectTime>"); } ret.append("</SessionsRTSP>"); } else { ret.append("<SessionsRTSP count=/"0/"/>"); } ret.append("</PublishStream>"); } /* List<IClient> clients = appInstance.getClients(); Iterator<IClient> iterClient = clients.iterator(); while(iterClient.hasNext()) { IClient client = iterClient.next(); //appInstance.getClient(c); if (client == null) continue; ret.append("<Client>"); ret.append("<ClientId>"+client.getClientId()+"</ClientId>"); ret.append("<FlashVersion>"+client.getFlashVer()+"</FlashVersion>"); ret.append("<IpAddress>"+client.getIp()+"</IpAddress>"); ret.append("<Referrer>"+client.getReferrer()+"</Referrer>"); ret.append("<TimeRunning>"+client.getTimeRunningSeconds()+"</TimeRunning>"); //ret.append("<Duration>"+((double)(System.currentTimeMillis()-client.getConnectTime())/1000.0)+"</Duration>"); //ret.append("<DateStarted>"+client.getDateStarted()+"</DateStarted>"); ret.append("<URI>"+client.getUri()+"</URI>"); String protocolStr = "unknown"; switch(client.getProtocol()) { case RtmpSessionInfo.PROTOCOL_RTMP: protocolStr = client.isEncrypted()?"RTMPE":"RTMP"; break; case RtmpSessionInfo.PROTOCOL_RTMPT: protocolStr = client.isSSL()?"RTMPS":(client.isEncrypted()?"RTMPTE":"RTMPT"); break; } ret.append("<Protocol type=/""+client.getProtocol()+"/">"+protocolStr+"</Protocol>"); ret.append("<IsSSL>"+client.isSSL()+"</IsSSL>"); ret.append("<IsEncrypted>"+client.isEncrypted()+"</IsEncrypted>"); ret.append("<Port>"+client.getServerHostPort().getPort()+"</Port>"); ret.append("</Client>"); } */ ret.append("</ApplicationInstance>"); } } ret.append("</Application>"); } ret.append("</VHost>"); } } ret.append("</WowzaMediaServerPro>"); } catch (Exception e) { WMSLoggerFactory.getLogger(HTTPServerVersion.class).error("HTTPServerInfoXML.onHTTPRequest: "+e.toString()); e.printStackTrace(); } try { resp.setHeader("Content-Type", "text/xml"); OutputStream out = resp.getOutputStream(); byte[] outBytes = ret.toString().getBytes(); out.write(outBytes); } catch (Exception e) { WMSLoggerFactory.getLogger(HTTPServerVersion.class).error("HTTPServerInfoXML.onHTTPRequest: "+e.toString()); e.printStackTrace(); } } }
这是结果
<?xml version="1.0" ?> - <WowzaMediaServerPro> - <VHost> <Name>_defaultVHost_</Name> <TimeRunning>233.261</TimeRunning> <ConnectionsLimit>0</ConnectionsLimit> <ConnectionsCurrent>2</ConnectionsCurrent> <ConnectionsTotal>4</ConnectionsTotal> <ConnectionsTotalAccepted>4</ConnectionsTotalAccepted> <ConnectionsTotalRejected>0</ConnectionsTotalRejected> - <Application> <Name>live</Name> <Status>loaded</Status> <TimeRunning>205.952</TimeRunning> <ConnectionsCurrent>2</ConnectionsCurrent> <ConnectionsTotal>4</ConnectionsTotal> <ConnectionsTotalAccepted>4</ConnectionsTotalAccepted> <ConnectionsTotalRejected>0</ConnectionsTotalRejected> - <ApplicationInstance> <Name>_definst_</Name> <TimeRunning>205.922</TimeRunning> <ConnectionsCurrent>2</ConnectionsCurrent> <ConnectionsTotal>4</ConnectionsTotal> <ConnectionsTotalAccepted>4</ConnectionsTotalAccepted> <ConnectionsTotalRejected>0</ConnectionsTotalRejected> - <PublishStream> <Name>zzj</Name> <Type>live</Type> <PublishStreamReady>true</PublishStreamReady> <PublishAudioCodecId>-1</PublishAudioCodecId> <PublishVideoCodecId>7</PublishVideoCodecId> - <SessionsFlash count="1"> - <Session> <ClientIP>127.0.0.1</ClientIP> <ClientFlashVer>WIN 10,2,159,1</ClientFlashVer> <ClientConnectTime>1304925496758</ClientConnectTime> </Session> </SessionsFlash> <SessionsCupertino count="0" /> <SessionsSmooth count="0" /> <SessionsRTSP count="0" /> </PublishStream> </ApplicationInstance> </Application> - <Application> <Name>videochat</Name> <Status>unloaded</Status> </Application> - <Application> <Name>vod</Name> <Status>unloaded</Status> </Application> </VHost> </WowzaMediaServerPro>
您还没有登录,请您登录后再发表评论
wowza入门图文教程
wowza server trace log
WowzaMediaServer-3.6.2.exe,大小 84MB,截至 20130924 为止,Wowza 官方公布的最新 Windows 下的安装程序。...关于 Wowza 发布直播服务,请参考博客:http://blog.csdn.net/defonds/article/details/11979095。
Wowza Media Server 流媒体服务器安装配置装配
截至 20140328,wowza 官方公布的最新 Wowza Stream Engine 用户指南手册,主要针对 4.0.3 版本。
基于wowza提供的状态信息页面解析 基于wowza日志解析 (2)部署配置(客户端) 配置/usr/local/zabbix/etc/zabbix_agentd.conf 添加以下自定义键值: UserParameter=dayvv,/usr/local/WowzaStreamingEngine/...
WowzaIDE-2.0.0.exe,大小 76MB,截至 20130925 为止,Wowza 官方公布的最新 Windows 下的 IDE 安装...另有关于 Wowza IDE 的中文版使用说明,请参考博客:http://blog.csdn.net/defonds/article/details/12028351。
WowzaMediaServer-3.6.2.rpm.bin,大小 75MB,截至 20130924 为止,Wowza 官方公布的最新 Linux 下的安装程序。...关于 Wowza 发布直播服务,请参考博客:http://blog.csdn.net/defonds/article/details/11979095。
本资源是一个 Wowza 支持 RESTful web ...关于如何让 wowza 能够支持 RESTful api 的步骤请参考博客《让你的 wowza 服务器提供 RESTful web 服务》,地址是:http://blog.csdn.net/defonds/article/details/30490271。
基于Wowza的流媒体服务器 流媒体,VOD点播,Linux服务器配置 流媒体指在Internet中使用流式传输技术的连续时基媒体,如:音频、视频或多媒体文件。流式媒体在播放前并不下载整个文件,只将开始部分内容存入内存,...
本资源代码是为博客《Wowza 插件开发和 Maven 的集成》示例完整源代码,博客地址:http://blog.csdn.net/defonds/article/details/22813295。
截至 20140328 为止 wowza 官方发布的最新 Wowza Streaming Engine 安装包,版本...关于 wowza4 的安装事项,参考博客《Linux 下安装 wowza 服务器》,地址:http://blog.csdn.net/defonds/article/details/22407623。
wowza学习资料下载wowza学习资料下载wowza学习资料下载wowza学习资料下载
Wowza.Media.Server.Pro.v1.7.2 keygen 序列号生成器
只要java -jar keygen.jar 便可使用,媒体服務器 註冊機
360.ts,wowza推流测试视频。结合本人博客使用。http://blog.csdn.net/aflyeaglenku/article/details/53065598
根据Wowza服务器日志中的出错信息进行故障排查,便于快速排查故障
赶紧下载,不知道什么时候过期,有破解流程,建议百度下载,Wowza支持多转码,支持多平台的服务器,一键上传,多平台使用
据下面的建议可以降低客户端接收到实时流并开始播放时的延时
内含使用教程,和搭建的所有的环境。利用百度云的私密分享。使用过后满意记得留言和评分收藏
相关推荐
wowza入门图文教程
wowza server trace log
WowzaMediaServer-3.6.2.exe,大小 84MB,截至 20130924 为止,Wowza 官方公布的最新 Windows 下的安装程序。...关于 Wowza 发布直播服务,请参考博客:http://blog.csdn.net/defonds/article/details/11979095。
Wowza Media Server 流媒体服务器安装配置装配
截至 20140328,wowza 官方公布的最新 Wowza Stream Engine 用户指南手册,主要针对 4.0.3 版本。
基于wowza提供的状态信息页面解析 基于wowza日志解析 (2)部署配置(客户端) 配置/usr/local/zabbix/etc/zabbix_agentd.conf 添加以下自定义键值: UserParameter=dayvv,/usr/local/WowzaStreamingEngine/...
WowzaIDE-2.0.0.exe,大小 76MB,截至 20130925 为止,Wowza 官方公布的最新 Windows 下的 IDE 安装...另有关于 Wowza IDE 的中文版使用说明,请参考博客:http://blog.csdn.net/defonds/article/details/12028351。
WowzaMediaServer-3.6.2.rpm.bin,大小 75MB,截至 20130924 为止,Wowza 官方公布的最新 Linux 下的安装程序。...关于 Wowza 发布直播服务,请参考博客:http://blog.csdn.net/defonds/article/details/11979095。
本资源是一个 Wowza 支持 RESTful web ...关于如何让 wowza 能够支持 RESTful api 的步骤请参考博客《让你的 wowza 服务器提供 RESTful web 服务》,地址是:http://blog.csdn.net/defonds/article/details/30490271。
基于Wowza的流媒体服务器 流媒体,VOD点播,Linux服务器配置 流媒体指在Internet中使用流式传输技术的连续时基媒体,如:音频、视频或多媒体文件。流式媒体在播放前并不下载整个文件,只将开始部分内容存入内存,...
本资源代码是为博客《Wowza 插件开发和 Maven 的集成》示例完整源代码,博客地址:http://blog.csdn.net/defonds/article/details/22813295。
截至 20140328 为止 wowza 官方发布的最新 Wowza Streaming Engine 安装包,版本...关于 wowza4 的安装事项,参考博客《Linux 下安装 wowza 服务器》,地址:http://blog.csdn.net/defonds/article/details/22407623。
wowza学习资料下载wowza学习资料下载wowza学习资料下载wowza学习资料下载
Wowza.Media.Server.Pro.v1.7.2 keygen 序列号生成器
只要java -jar keygen.jar 便可使用,媒体服務器 註冊機
360.ts,wowza推流测试视频。结合本人博客使用。http://blog.csdn.net/aflyeaglenku/article/details/53065598
根据Wowza服务器日志中的出错信息进行故障排查,便于快速排查故障
赶紧下载,不知道什么时候过期,有破解流程,建议百度下载,Wowza支持多转码,支持多平台的服务器,一键上传,多平台使用
据下面的建议可以降低客户端接收到实时流并开始播放时的延时
内含使用教程,和搭建的所有的环境。利用百度云的私密分享。使用过后满意记得留言和评分收藏