Creating a dummy publisher connection in Red5

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Creating a dummy publisher connection in Red5

ak_001
This post has NOT been accepted by the mailing list yet.
This post was updated on .
Hi,
 
I am getting videodata packets from non-red5 server. I want to publish those packet on red5 server so that
clients subscribed to red5 will get that data.
I can create a dummy publisher connection as soon as my application starts receiving those packets and publish it on red5 internally, how this can be done? For now I am trying this code but it is not working:

BroadcastData bd = (BroadcastData) idata;
String publishedBSName = bd.getPublishedName();
IBroadcastScope bs = scope.getBroadcastScope(publishedBSName);
ClientBroadcastStream cbs = (ClientBroadcastStream) bs.getClientBroadcastStream();
if (cbs == null) {
        cbs = (ClientBroadcastStream) createNewBroadcastStream();
        bs.setClientBroadcastStream(cbs);
        cbs.setPublishedName(publishedBSName);
        IProviderService providerService = (IProviderService) scope.getContext().getBean(ProviderService.BEAN_NAME);
        if (providerService.registerBroadcastStream(scope, publishedBSName,cbs)) {
        cbs.start();
        cbs.startPublishing();
        }
}
if (cbs != null) {
        IRTMPEvent rtmpEvent = (IRTMPEvent) bd.getData();
        cbs.dispatchEvent(rtmpEvent);
}

private IClientBroadcastStream createNewBroadcastStream(){
        RTMPConnection rtmpConnection = RTMPConnManager.getInstance().createConnection(RTMPMinaConnection.class);
        rtmpConnection.connect(scope);
        Number randomStreamId = rtmpConnection.reserveStreamId();
        IClientBroadcastStream cbs = rtmpConnection.newBroadcastStream(randomStreamId);
        return cbs;
}

In this code, my video packets though written to channel. I do not get anything to see or hear.
Please help.