本文整理汇总了Java中org.red5.server.stream.PlaylistSubscriberStream类的典型用法代码示例。如果您正苦于以下问题:Java PlaylistSubscriberStream类的具体用法?Java PlaylistSubscriberStream怎么用?Java PlaylistSubscriberStream使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlaylistSubscriberStream类属于org.red5.server.stream包,在下文中一共展示了PlaylistSubscriberStream类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newPlaylistSubscriberStream
import org.red5.server.stream.PlaylistSubscriberStream; //导入依赖的package包/类
/** {@inheritDoc} */
public IPlaylistSubscriberStream newPlaylistSubscriberStream(int streamId) {
if (isValidStreamId(streamId)) {
// get PlaylistSubscriberStream defined as a prototype in red5-common.xml
PlaylistSubscriberStream pss = (PlaylistSubscriberStream) scope.getContext().getBean("playlistSubscriberStream");
Integer buffer = streamBuffers.get(streamId - 1);
if (buffer != null) {
pss.setClientBufferDuration(buffer);
}
pss.setName(createStreamName());
pss.setConnection(this);
pss.setScope(this.getScope());
pss.setStreamId(streamId);
registerStream(pss);
usedStreams.incrementAndGet();
return pss;
}
return null;
}
示例2: newPlaylistSubscriberStream
import org.red5.server.stream.PlaylistSubscriberStream; //导入依赖的package包/类
/** {@inheritDoc} */
public IPlaylistSubscriberStream newPlaylistSubscriberStream(Number streamId) {
if (isValidStreamId(streamId)) {
// get PlaylistSubscriberStream defined as a prototype in red5-common.xml
PlaylistSubscriberStream pss = (PlaylistSubscriberStream) scope.getContext().getBean("playlistSubscriberStream");
customizeStream(streamId, pss);
if (!registerStream(pss)) {
log.trace("Stream: {} for stream id: {} failed to register", streamId);
pss = null;
}
return pss;
}
return null;
}
示例3: streamPlayItemStop
import org.red5.server.stream.PlaylistSubscriberStream; //导入依赖的package包/类
public void streamPlayItemStop(ISubscriberStream stream, IPlayItem item) {
// since there is a fair amount of processing below we will check log
// level prior to proceeding
if (log.isInfoEnabled()) {
// log w3c connect event
String remoteAddress = "";
long readBytes = -1;
long writtenBytes = -1;
IConnection conn = Red5.getConnectionLocal();
if (conn != null) {
remoteAddress = conn.getRemoteAddress();
readBytes = conn.getReadBytes();
writtenBytes = conn.getWrittenBytes();
}
long playDuration = -1;
if (stream instanceof PlaylistSubscriberStream) {
// converted to seconds
playDuration = (System.currentTimeMillis() - ((PlaylistSubscriberStream) stream).getCreationTime()) / 1000;
}
long playItemSize = -1;
String playItemName = "";
if (item != null) {
playItemName = item.getName();
//get file size in bytes if available
IProviderService providerService = (IProviderService) scope.getContext().getBean(IProviderService.BEAN_NAME);
if (providerService != null) {
File file = providerService.getVODProviderFile(scope, playItemName);
if (file != null) {
playItemSize = file.length();
} else {
log.debug("File was null, this is ok for live streams");
}
} else {
log.debug("ProviderService was null");
}
}
log.info("W3C x-category:stream x-event:stop c-ip:{} cs-bytes:{} sc-bytes:{} x-sname:{} x-file-length:{} x-file-size:{} x-name:{}", new Object[] { remoteAddress, readBytes, writtenBytes, stream.getName(), playDuration, playItemSize, playItemName });
}
}
示例4: streamPlayItemStop
import org.red5.server.stream.PlaylistSubscriberStream; //导入依赖的package包/类
public void streamPlayItemStop(ISubscriberStream stream, IPlayItem item) {
// since there is a fair amount of processing below we will check log
// level prior to proceeding
if (log.isInfoEnabled()) {
// log w3c connect event
String remoteAddress = "";
long readBytes = -1;
long writtenBytes = -1;
IConnection conn = Red5.getConnectionLocal();
if (conn != null) {
remoteAddress = conn.getRemoteAddress();
readBytes = conn.getReadBytes();
writtenBytes = conn.getWrittenBytes();
}
long playDuration = -1;
if (stream instanceof PlaylistSubscriberStream) {
// converted to seconds
playDuration = (System.currentTimeMillis() - ((PlaylistSubscriberStream) stream).getCreationTime()) / 1000;
}
long playItemSize = -1;
String playItemName = "";
if (item != null) {
playItemName = item.getName();
//get file size in bytes if available
IProviderService providerService = (IProviderService) scope.getContext().getBean(IProviderService.BEAN_NAME);
if (providerService != null) {
File file = providerService.getVODProviderFile(scope, playItemName);
if (file != null) {
playItemSize = file.length();
} else {
log.debug("File was null, this is ok for live streams");
}
} else {
log.debug("ProviderService was null");
}
}
log.info("W3C x-category:stream x-event:stop c-ip:{} cs-bytes:{} sc-bytes:{} x-sname:{} x-file-length:{} x-file-size:{} x-name:{}", new Object[] { remoteAddress,
readBytes, writtenBytes, stream.getName(), playDuration, playItemSize, playItemName });
}
}