本文整理汇总了Java中org.red5.io.IStreamableFile.getReader方法的典型用法代码示例。如果您正苦于以下问题:Java IStreamableFile.getReader方法的具体用法?Java IStreamableFile.getReader怎么用?Java IStreamableFile.getReader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.red5.io.IStreamableFile
的用法示例。
在下文中一共展示了IStreamableFile.getReader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.red5.io.IStreamableFile; //导入方法依赖的package包/类
/**
* Initializes file provider. Creates streamable file factory and service, seeks to start position
*/
private void init() throws IOException {
IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
IStreamableFileService service = factory.getService(file);
if (service == null) {
log.error("No service found for {}", file.getAbsolutePath());
return;
}
IStreamableFile streamFile = service.getStreamableFile(file);
reader = streamFile.getReader();
if (start > 0) {
seek(start);
}
}
示例2: getStreamLength
import org.red5.io.IStreamableFile; //导入方法依赖的package包/类
/**
* Returns stream length. This is a hook so it may be removed.
*
* @param name
* Stream name
* @return Stream length in seconds (?)
*/
public double getStreamLength(String name) {
double duration = 0;
IProviderService provider = (IProviderService) ScopeUtils.getScopeService(scope, IProviderService.class, ProviderService.class);
File file = provider.getVODProviderFile(scope, name);
if (file != null && file.canRead()) {
IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
IStreamableFileService service = factory.getService(file);
if (service != null) {
ITagReader reader = null;
try {
IStreamableFile streamFile = service.getStreamableFile(file);
reader = streamFile.getReader();
duration = (double) reader.getDuration() / 1000;
} catch (IOException e) {
log.error("Error read stream file {}. {}", file.getAbsolutePath(), e);
} finally {
if (reader != null) {
reader.close();
}
}
} else {
log.error("No service found for {}", file.getAbsolutePath());
}
file = null;
}
return duration;
}
示例3: init
import org.red5.io.IStreamableFile; //导入方法依赖的package包/类
/**
* Initializes file provider. Creates streamable file factory and service, seeks to start position
*/
private void init() throws IOException {
IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
IStreamableFileService service = factory.getService(file);
if (service == null) {
log.error("No service found for {}", file.getAbsolutePath());
return;
}
IStreamableFile streamFile = service.getStreamableFile(file);
reader = streamFile.getReader();
if (start > 0) {
seek(start);
}
}
示例4: getStreamLength
import org.red5.io.IStreamableFile; //导入方法依赖的package包/类
/**
* Returns stream length. This is a hook so it may be removed.
*
* @param name
* Stream name
* @return Stream length in seconds (?)
*/
public double getStreamLength(String name) {
double duration = 0;
IProviderService provider = (IProviderService) ScopeUtils.getScopeService(scope, IProviderService.class, ProviderService.class);
File file = provider.getVODProviderFile(scope, name);
if (file != null && file.canRead()) {
IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils.getScopeService(scope, IStreamableFileFactory.class, StreamableFileFactory.class);
IStreamableFileService service = factory.getService(file);
if (service != null) {
ITagReader reader = null;
try {
IStreamableFile streamFile = service.getStreamableFile(file);
reader = streamFile.getReader();
duration = (double) reader.getDuration() / 1000;
} catch (IOException e) {
log.error("Error read stream file {}. {}", file.getAbsolutePath(), e);
} finally {
if (reader != null) {
reader.close();
}
}
} else {
log.error("No service found for {}", file.getAbsolutePath());
}
file = null;
}
return duration;
}