red5服务器流已启动,但Flash客户端无法播放

时间:2016-04-27 03:09:50

标签: red5

我想要实现的是flash客户端中的用户调用red5应用程序中定义的处理程序方法,该方法创建服务器端流然后播放它,以便具有Flash客户端的其他用户可以查看广播的流。

这是我点击按钮触发的动作脚本客户端代码:

 private function playLiveStream():void {
    nc.call("remoteControl.playLiveStream", null, "demo_video.flv");
 }

这是我在注册处理程序中定义的服务器端java代码:

 public void playLiveStream(String fileName) {
       IScope scope=Red5.getConnectionLocal().getScope();
       IServerStream stream=
       StreamUtils.getServerStream(scope,"livestream1");
       if (stream==null) {
          stream=StreamUtils.createServerStream(scope, "livestream1");
         StreamUtils.putServerStream(scope, "livestream1");
       }
       stream.addItem(SimplePlayItem.build(fileName));
       stream.start();
 }

以下是播放广播流的动作:

    ns = new NetStream(nc);
    ns.play("livestream1");

但是,在Flash客户端中,流只播放一秒然后停止。

如果我再次单击该按钮来调用处理程序方法,则java日志中会出现错误。这是我的错误日志:

java.lang.reflect.InvocationTargetException:null     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)〜[na:1.8.0_25]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[na:1.8.0_25]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[na:1.8.0_25]     在java.lang.reflect.Method.invoke(Method.java:483)〜[na:1.8.0_25]     在org.red5.server.service.ServiceInvoker.invoke(ServiceInvoker.java:193)[red5-server-common-1.0.6-RELEASE.jar:na]     在org.red5.server.service.ServiceInvoker.invoke(ServiceInvoker.java:115)[red5-server-common-1.0.6-RELEASE.jar:na]     在org.red5.server.net.rtmp.RTMPHandler.invokeCall(RTMPHandler.java:186)[red5-server-common-1.0.6-RELEASE.jar:1.0.6-RELEASE]     在org.red5.server.net.rtmp.RTMPHandler.onCommand(RTMPHandler.java:293)[red5-server-common-1.0.6-RELEASE.jar:1.0.6-RELEASE]     在org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(BaseRTMPHandler.java:105)[red5-server-common-1.0.6-RELEASE.jar:1.0.6-RELEASE]     at org.red5.server.net.rtmp.ReceivedMessageTask.call(ReceivedMessageTask.java:63)[red5-server-common-1.0.6-RELEASE.jar:1.0.6-RELEASE]     at org.red5.server.net.rtmp.ReceivedMessageTask.call(ReceivedMessageTask.java:14)[red5-server-common-1.0.6-RELEASE.jar:1.0.6-RELEASE]     at java.util.concurrent.FutureTask.run(FutureTask.java:266)[na:1.8.0_25]     at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511)[na:1.8.0_25]     at java.util.concurrent.FutureTask.run(FutureTask.java:266)[na:1.8.0_25]     在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[na:1.8.0_25]     at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617)[na:1.8.0_25]     在java.lang.Thread.run(Thread.java:745)[na:1.8.0_25] 引起:java.lang.IllegalStateException:状态STOPPED无效启动     在org.red5.server.stream.ServerStream.start(ServerStream.java:428)〜[red5-server.jar:1.0.6-RELEASE]     在com.eeplace.red5.core.RemoteControlHandler.playLiveStream(RemoteControlHandler.java:144)〜[classes /:na]     ...省略了17个常见帧

之前有没有人遇到同样的错误?

感谢您的任何建议。

0 个答案:

没有答案