Wowza Community

I can't disconnect FME to reject publishing

Using Flash Media Live Encoder, I can’t disconnect FME to reject publishing.

Like the following

My code

public class MyModule extends ModuleCore implements IModuleOnApp2, IModuleOnConnect, IModuleOnStream {
   
    public static void publish(IClient iClient, RequestFunction requestFunction, AMFDataList amfDataList) {
        sendClientOnStatusError(iClient, "NetStream.Publish.Rejected", "Rejected");
        iClient.setShutdownClient(true);
    }
    /*
        ~~~~~~~~~~~~~~~
        ~~~~~~~~~~~~~~~
    */
}

Log

Wed Jun 24 2015 19:35:08 : Primary - Network Status: NetStream.Publish.Rejected error Rejected
Wed Jun 24 2015 19:35:08 : Primary - Network Status: NetConnection.Connect.Closed status
Wed Jun 24 2015 19:35:17 : Primary - Disconnected
Wed Jun 24 2015 19:35:18 : Problem publishing at Primary Server. Unable to publish STREAM_NAME stream either due to Network Problem at server, the stream name being used is busy, or you are not authorized to publish to this server. Please check the network connection with server, try publishing with other stream name, or contact your FMS administrator for help.

Why am I unable to disconnect immediately?

Hello

I’m not sure of the context by which you are attempting to reject the stream, but to obtain a more immediate response to the rejection you might try something similar to the following combination:

sendClientOnStatusError(stream.getClient(), "NetStream.Publish.Rejected", "Stream Rejected");
stream.getClient().rejectConnection();
stream.getClient().setAcceptConnectionDescription("[ AccessManager.Reject ] : [ authmod=adobe ] : ?reason=authfailed");
stream.getClient().setSendCloseOnRejectConnection(true);

This resulted in the following in my tests almost immediately:

Wed Jun 24 2015 11:47:34 : Primary - Network Command: onFCUnpublish
Wed Jun 24 2015 11:47:34 : Primary - Stream[test] Status: NetStream.Unpublish.Success
Wed Jun 24 2015 11:47:34 : Primary - Network Status: NetConnection.Connect.Closed status
Wed Jun 24 2015 11:47:34 : Primary - Disconnected
Wed Jun 24 2015 11:47:43 : Audio Encoding Stopped
Wed Jun 24 2015 11:47:43 : Session Stopped

Thanks,

Matt

Thanks, Matt.

Where do you implement your code to reject publishing?

I tried this code but not changed.

public class MyModule extends ModuleCore implements IModuleOnApp2, IModuleOnConnect, IModuleOnStream {
   
    public static void publish(IClient iClient, RequestFunction requestFunction, AMFDataList amfDataList) {
        sendClientOnStatusError(iClient, "NetStream.Publish.Rejected", "Rejected");
        iClient.setShutdownClient(true);
        iClient.rejectConnection();
        iClient.setAcceptConnectionDescription("[ AccessManager.Reject ] : [ authmod=adobe ] : ?reason=authfailed");
        iClient.setSendCloseOnRejectConnection(true);
    }
    /*
        ~~~~~~~~~~~~~~~
        ~~~~~~~~~~~~~~~
    */
}