Hi
I am using rtmpClient on the red5 server to publish a flv file.I need a method to delete the stream and call the method from action script. when I use deleteStream(streamId, this) it does not work.Here is the code: public void onStreamEvent(Notify notify) { // logger.debug("onStreamEvent - " + notify);
if (notify.getCall().getServiceMethodName().equals("onStatus")) {
ObjectMap<String, String> map = (ObjectMap)
notify.getCall().getArguments()[0]; String code = (String) map.get("code"); String description = (String) map.get("description"); String details = (String) map.get("details");
if (StatusCodes.NS_PUBLISH_START.equals(code)) {
// log.debug("{} for {}", new Object[]{code,details});
FLVService service = new FLVService(); service.setSerializer(new Serializer()); service.setDeserializer(new Deserializer());
// log.info("Started Publishing");
// Read In File And Publish The Data !! try {
// File f = new
File("C:/Users/eailrae/workspace/streams/IronMan.flv"); // log.debug("test: {}", f);
IFLV flv = (IFLV)
service.getStreamableFile(f); flv.setCache(NoCacheImpl.getInstance());
ITagReader reader =
flv.getReader();
FileStreamSource src = new FileStreamSource(reader);
while (src.hasMore())
{ IRTMPEvent event = src.dequeue(); RTMPMessage rtmpMsg = new
RTMPMessage(); rtmpMsg.setBody(event);
publishStreamData(streamId, rtmpMsg);
try{ Thread.sleep(16); } catch(Exception
e){} } System.out.println("\nEND!!!!!!!!!!");
//
disconnect(); deleteStream(streamId, this); //unpublish(streamId);
} catch (Exception ex) {
// log.error(ex.getCause().toString()); } }
if (StatusCodes.NS_PLAY_STOP.equals(code))
{ // logger.debug("onStatus code == NetStream.Play.Stop, disconnecting"); // disconnect(); } }
}
synchronized public void
resultReceived(IPendingServiceCall call) { // logger.debug("service call result: " + call);
Object result = call.getResult();
if (result instanceof ObjectMap) { if ("connect".equals(call.getServiceMethodName())) { //
log.info("Connected"); createStream(this); } } else { if ("createStream".equals(call.getServiceMethodName())) { if
(result instanceof Integer) { Integer streamIdInt = (Integer) result; streamId = streamIdInt.intValue(); // log.debug("createStream result stream id: " +
streamId); // waiting(4); publish(streamId,s, "live", this); // log.debug("published stream: " +
streamId); } else { // log.debug("DISCONNECT!!!!!"); // disconnect();
} } } }
I would appreciate any help.
|
_______________________________________________
Red5 mailing list
Red5@...
http://osflash.org/mailman/listinfo/red5_osflash.org