Red5 流 flv 文件
我正在检查 Red5 的 oflaDemo。 我想知道如何更改 oflaDemo 以便我可以将某个 flv 文件流式传输给所有订阅者...
/** {@inheritDoc} */
@Override
public boolean appConnect(IConnection conn, Object[] params) {
// Trigger calling of "onBWDone", required for some FLV players
measureBandwidth(conn);
if (conn instanceof IStreamCapableConnection) {
IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
SimpleConnectionBWConfig bwConfig = new SimpleConnectionBWConfig();
bwConfig.getChannelBandwidth()[IBandwidthConfigure.OVERALL_CHANNEL] =
1024 * 1024;
bwConfig.getChannelInitialBurst()[IBandwidthConfigure.OVERALL_CHANNEL] =
128 * 1024;
streamConn.setBandwidthConfigure(bwConfig);
}
serverStream = StreamUtils.createServerStream(appScope, "live0");
SimplePlayItem item = new SimplePlayItem();
item.setStart(0);
item.setLength(10000);
item.setName("IronMan");
serverStream.addItem(item);
item = new SimplePlayItem();
item.setStart(20000);
item.setLength(10000);
item.setName("DarkKnight");
serverStream.addItem(item);
serverStream.start();
serverStream.setRepeat(true);
return super.appConnect(conn, params);
}
上面代码的结果对于所有订阅者来说只是一个空白屏幕...
你们有人知道吗?
提前致谢!
I was inspecting the oflaDemo from Red5.
I was wondering how I could change the oflaDemo so that I could stream a certain flv file to all the subscribers...
/** {@inheritDoc} */
@Override
public boolean appConnect(IConnection conn, Object[] params) {
// Trigger calling of "onBWDone", required for some FLV players
measureBandwidth(conn);
if (conn instanceof IStreamCapableConnection) {
IStreamCapableConnection streamConn = (IStreamCapableConnection) conn;
SimpleConnectionBWConfig bwConfig = new SimpleConnectionBWConfig();
bwConfig.getChannelBandwidth()[IBandwidthConfigure.OVERALL_CHANNEL] =
1024 * 1024;
bwConfig.getChannelInitialBurst()[IBandwidthConfigure.OVERALL_CHANNEL] =
128 * 1024;
streamConn.setBandwidthConfigure(bwConfig);
}
serverStream = StreamUtils.createServerStream(appScope, "live0");
SimplePlayItem item = new SimplePlayItem();
item.setStart(0);
item.setLength(10000);
item.setName("IronMan");
serverStream.addItem(item);
item = new SimplePlayItem();
item.setStart(20000);
item.setLength(10000);
item.setName("DarkKnight");
serverStream.addItem(item);
serverStream.start();
serverStream.setRepeat(true);
return super.appConnect(conn, params);
}
The result of the code above is just a blank screen for all subscribers...
Does anyone of you have any idea?
thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这在客户端会更容易完成,如果您不想对流名称进行硬编码,则可以将其名称作为 flash 变量传递。
This would be easier to accomplish on the client side and if you didn't want to hard-code the stream name, you could pass its name as a flash var.
我遇到了同样的问题。 我发现黑屏是因为哪一行,
如果将重复设置为 false,则一切正常
UPD:
我认为这是 red5 的错误。 我做了一个 hack 来连续重复一个 flv。 我添加了自定义播放列表控制器:
I got the same problem. I found that blank screen is because of what line
if you set repeat to false all works fine
UPD:
I think that this is red5 bug. I made a hack to repeat continiously one flv. I added custom play list controller: