Class PushPublishRTMP

Object
com.wowza.wms.pushpublish.model.PushPublishBase
com.wowza.wms.pushpublish.protocol.rtmp.PushPublishRTMP
All Implemented Interfaces:
IPushPublish
Direct Known Subclasses:
PushPublishRTMPProfileHandler

public class PushPublishRTMP extends PushPublishBase

PushPublish

Sample Code to push to Wowza Server or Adobe Media Server (no authentication)

This method should work with Level 3 as well as long as the publishing application on not authenticated.

try
{
        PushPublishRTMP publisher = new PushPublishRTMP();

        // Source stream
        publisher.setAppInstance(appInstance);
        publisher.setSrcStreamName("myStream");

        // Destination stream
        publisher.setHostname("localhost");
        publisher.setPort(1935);
        publisher.setDstApplicationName("live");
        publisher.setDstStreamName("myStream");

        // Uncomment if pushing to Adobe Media Server
        //publisher.setSendOriginalTimecodes(true);
        //publisher.setOriginalTimecodeThreshold(0x100000);

        // SecureToken shared secret
        //publisher.setSecureTokenSharedSecret("#ed%h0#w@1");

        publisher.setSendFCPublish(true);
        publisher.setSendReleaseStream(true);
        publisher.setDebugLog(true);

        publisher.connect();
}
catch(Exception e)
{
        WMSLoggerFactory.getLogger(null).info(CLASSNAME+"RTMP: ", e);
}

Sample Code to push to Wowza Server or Adobe Media Server (RTMP username/password authentication)

This method should work with Level 3 as well if the publishing application is protected using RTMP authentication.

try
{
        PushPublishRTMP publisher = new PushPublishRTMP();

        // Source stream
        publisher.setAppInstance(appInstance);
        publisher.setSrcStreamName("myStream");

        // Destination stream
        publisher.setHostname("localhost");
        publisher.setPort(1935);
        publisher.setDstApplicationName("live");
        publisher.setDstStreamName("myStream");
        publisher.setConnectionFlashVersion(PushPublishRTMP.CURRENTFMLEVERSION);

        // Uncomment if pushing to Adobe Media Server
        //publisher.setSendOriginalTimecodes(true);
        //publisher.setOriginalTimecodeThreshold(0x100000);

        // SecureToken shared secret
        //publisher.setSecureTokenSharedSecret("#ed%h0#w@1");

        publisher.setSendFCPublish(true);
        publisher.setSendReleaseStream(true);
        publisher.setDebugLog(true);

        PushPublishRTMPAuthProviderAdobe adobeRTMPAuthProvider = new PushPublishRTMPAuthProviderAdobe();

        adobeRTMPAuthProvider.init(publisher);
        adobeRTMPAuthProvider.setUserName("username");
        adobeRTMPAuthProvider.setPassword("password");
        publisher.setRTMPAuthProvider(adobeRTMPAuthProvider);

        publisher.connect();
}
catch(Exception e)
{
        WMSLoggerFactory.getLogger(null).info(CLASSNAME+"RTMP: ", e);
}

Sample Code to push to Akamai

try
{
        PushPublishRTMP publisher = new PushPublishRTMP();

        // Source stream
        publisher.setAppInstance(appInstance);
        publisher.setSrcStreamName("myStream");

        // Destination stream
        String streamId = "12345";
        String akamaiUsername = "56789";
        String akamaiPassword = "changeme";
        boolean isPrimary = true;
        String hostname = (isPrimary?"p":"b")+".ep"+streamId+".i.akamaientrypoint.net";
        String dstApplicationName = "EntryPoint";
        String dstStreamName = "myStream"+"@"+streamId;

        publisher.setHostname(hostname);
        publisher.setPort(1935);
        publisher.setDstApplicationName(dstApplicationName);
        publisher.setDstStreamName(dstStreamName);
        publisher.setDebugLog(true);

        publisher.setConnectionFlashVersion(PushPublishRTMP.getPushPublishVersionStr());

        if (PushPublishRTMP.isFlashVersionFMLE(publisher.getConnectionFlashVersion()))
        {
                PushPublishRTMPAuthProviderAdobe adobeRTMPAuthProvider = new PushPublishRTMPAuthProviderAdobe();

                adobeRTMPAuthProvider.init(publisher);
                adobeRTMPAuthProvider.setUserName(akamaiUsername);
                adobeRTMPAuthProvider.setPassword(akamaiPassword);

                publisher.setRTMPAuthProvider(adobeRTMPAuthProvider);
        }
        else
        {
                publisher.setAkamaiUserName(akamaiUsername);
                publisher.setAkamaiPassword(akamaiPassword);
        }

        publisher.setSendFCPublish(true);
        publisher.setSendReleaseStream(true);
        publisher.setSendStreamCloseCommands(true);

        publisher.setSendOriginalTimecodes(true);
        publisher.setOriginalTimecodeThreshold(0x100000);

        publisher.connect();
}
catch(Exception e)
{
        WMSLoggerFactory.getLogger(null).info(CLASSNAME+"RTMP: ", e);
}

Sample Code to push to Limelight

try
{
        PushPublishRTMP publisher = new PushPublishRTMP();

        // Source stream
        publisher.setAppInstance(appInstance);
        publisher.setSrcStreamName("myStream");

        // Destination stream
        publisher.setHostname("fmspush.lax.llnw.net");
        publisher.setPort(1935);
        publisher.setDstApplicationName("live");
        publisher.setDstStreamName("myStream");

        publisher.setSendFCPublish(true);
        publisher.setSendReleaseStream(true);
        publisher.setDebugLog(true);

        publisher.setSendOriginalTimecodes(true);
        publisher.setOriginalTimecodeThreshold(0x100000);

        PushPublishRTMPAuthProviderLimelight limelightRTMPAuthProvider = new PushPublishRTMPAuthProviderLimelight();

        limelightRTMPAuthProvider.init(publisher);
        limelightRTMPAuthProvider.setUserName("username");
        limelightRTMPAuthProvider.setPassword("password");
        publisher.setRTMPAuthProvider(limelightRTMPAuthProvider);

        publisher.connect();
}
catch(Exception e)
{
        WMSLoggerFactory.getLogger(null).info(CLASSNAME+"RTMP: ", e);
}

Sample Code to push to BitGravity (streaming needs to be setup per instructions in BG Live 3rd Party Encoder Configuration guide.)

try
{
        PushPublishRTMP publisher = new PushPublishRTMP();

        // Source stream
        publisher.setAppInstance(client.getAppInstance());
        publisher.setSrcStreamName("myStream");

        // Destination stream
        publisher.setHostname("rtpdev1.iad1.bitgravity.com");
        publisher.setPort(1935);
        publisher.setDstApplicationName("rtmp");
        publisher.setDstAppInstanceName("push");
        publisher.setDstStreamName("test@test.com/71d73d4cfd1e2f2fed77238021a2cbbe/test/live/feed01");

        publisher.setSendFCPublish(true);
        publisher.setSendReleaseStream(true);
        publisher.setDebugLog(true);

        publisher.connect();
}
catch(Exception e)
{
        WMSLoggerFactory.getLogger(null).info(CLASSNAME+"RTMP: ", e);
}
  • Field Details

    • CLASS

      public static final Class<PushPublishRTMP> CLASS
    • CLASSNAME

      public static final String CLASSNAME
      See Also:
    • CURRENTFMLEVERSION

      public static final String CURRENTFMLEVERSION
      See Also:
    • CURRENTFLASHVERSION

      public static final String CURRENTFLASHVERSION
      See Also:
    • rtmpDebugLog

      protected boolean rtmpDebugLog
    • debugLogLastPacketCount

      protected long debugLogLastPacketCount
    • debugPackets

      protected boolean debugPackets
    • netconnectToSessionHolder

      protected Map<INetConnection,PushPublishRTMPNetConnectionSession> netconnectToSessionHolder
    • ioSessionToSessionHolder

      protected Map<org.apache.mina.common.IoSession,PushPublishRTMPNetConnectionSession> ioSessionToSessionHolder
    • sessionOrder

      protected List<PushPublishRTMPNetConnectionSession> sessionOrder
    • listeners

      protected List<IPushPublishRTMPNotify> listeners
    • dstApplicationName

      protected String dstApplicationName
    • dstAppInstanceName

      protected String dstAppInstanceName
    • lock

      protected Object lock
    • howToPublish

      protected String howToPublish
    • sendFCPublish

      protected boolean sendFCPublish
    • sendFCAnnounce

      protected boolean sendFCAnnounce
    • sendReleaseStream

      protected boolean sendReleaseStream
    • sendStreamCloseCommands

      protected boolean sendStreamCloseCommands
    • sendOnMetadata

      protected boolean sendOnMetadata
    • onMetadataToSetDataFrame

      protected boolean onMetadataToSetDataFrame
    • onMetadataFilter

      protected long onMetadataFilter
    • onMetadataItemsToRemove

      protected List<String> onMetadataItemsToRemove
    • onMetadataItemsToAdd

      protected Map<String,AMFData> onMetadataItemsToAdd
    • timecodesOutOfOrderThreshold

      protected int timecodesOutOfOrderThreshold
    • tryConnect

      protected boolean tryConnect
    • isReconnectorRunning

      protected boolean isReconnectorRunning
    • connectionQueryStr

      protected String connectionQueryStr
    • queryString

      protected String queryString
    • connectionFlashVersion

      protected String connectionFlashVersion
    • connectionSwfURL

      protected String connectionSwfURL
    • connectionPageURL

      protected String connectionPageURL
    • secureTokenSharedSecret

      protected String secureTokenSharedSecret
    • akamaiUserName

      protected String akamaiUserName
    • akamaiPassword

      protected String akamaiPassword
    • akamaiOriginIp

      protected String akamaiOriginIp
    • akamaiOriginPort

      protected Integer akamaiOriginPort
    • validationFrequency

      protected long validationFrequency
    • sendOriginalTimecodes

      protected boolean sendOriginalTimecodes
    • originalTimecodeThreshold

      protected long originalTimecodeThreshold
    • originalTimecodeOffset

      protected long originalTimecodeOffset
    • connectionTimeout

      protected int connectionTimeout
    • connectLastAttempt

      protected long connectLastAttempt
    • connectLastSuccess

      protected long connectLastSuccess
    • connectionResetCount

      protected long connectionResetCount
    • connectAttemptCount

      protected long connectAttemptCount
    • connectionState

      protected PushPublishRTMP.STATE connectionState
    • doSendOnMetaData

      protected boolean doSendOnMetaData
    • removeDefaultAppInstance

      protected boolean removeDefaultAppInstance
    • resetOnTimecodeOutOfOrder

      protected boolean resetOnTimecodeOutOfOrder
    • sendStreamCloseCommandsSendTime

      protected long sendStreamCloseCommandsSendTime
    • streamCloseWaitTime

      protected int streamCloseWaitTime
    • lastIdleReadTime

      protected long lastIdleReadTime
    • lastIdleWriteTime

      protected long lastIdleWriteTime
    • totalPacketsSent

      protected long totalPacketsSent
    • lastVideoTC

      protected long lastVideoTC
    • lastVideoKeyFrameTC

      protected long lastVideoKeyFrameTC
    • lastAudioTC

      protected long lastAudioTC
    • lastDataTC

      protected long lastDataTC
    • packetsSentAudio

      protected long packetsSentAudio
    • packetsSentVideo

      protected long packetsSentVideo
    • packetsSentVideoKeyFrame

      protected long packetsSentVideoKeyFrame
    • packetsSentData

      protected long packetsSentData
    • waitOnMetadataAvailable

      protected boolean waitOnMetadataAvailable
    • waitOnMetadataVideo

      protected boolean waitOnMetadataVideo
    • waitOnMetadataVideoDatarate

      protected boolean waitOnMetadataVideoDatarate
    • waitOnMetadataAudio

      protected boolean waitOnMetadataAudio
    • waitOnMetadataAudioDatarate

      protected boolean waitOnMetadataAudioDatarate
    • waitOnMetadataTimeout

      protected long waitOnMetadataTimeout
    • waitOnMetadataReady

      protected boolean waitOnMetadataReady
    • waitOnMetadataStartime

      protected long waitOnMetadataStartime
    • srcStreamBufferSize

      protected long srcStreamBufferSize
    • bindAddress

      protected String bindAddress
    • rtmpAuthProvider

      protected IPushPublishRTMPAuthProvider rtmpAuthProvider
    • connectMetaData

      protected Map<String,AMFData> connectMetaData
    • offlineTime

      public long offlineTime
    • onlineTime

      public long onlineTime
    • outprint

      public int outprint
    • bytesAvg

      public float[] bytesAvg
    • isSSL

      protected boolean isSSL
    • usePingPong

      protected boolean usePingPong
    • pingPongListenerRegistered

      protected boolean pingPongListenerRegistered
    • syncTimecode

      protected long syncTimecode
    • syncPacketType

      protected int syncPacketType
  • Constructor Details

    • PushPublishRTMP

      public PushPublishRTMP() throws com.wowza.wms.server.LicensingException
      Throws:
      com.wowza.wms.server.LicensingException
  • Method Details

    • createNetConnectionPublisher

      protected PushPublishRTMPNetConnectionPublisher createNetConnectionPublisher(PushPublishRTMPNetConnectionSession pushPublisherSession)
    • getNetConnection

      public INetConnection getNetConnection()
      Get the underlying INetConnection interface for this session
      Returns:
      INetConnection interface for this session
    • getLock

      public Object getLock()
      Get the synchronization lock
      Returns:
      synchronization lock
    • getConnectionTimeout

      public int getConnectionTimeout()
      Get the connection timeout (milliseconds)
      Returns:
      connection timeout (milliseconds)
    • setConnectionTimeout

      public void setConnectionTimeout(int connectionTimeout)
      Set the connection timeout (milliseconds)
      Parameters:
      connectionTimeout - connection timeout (milliseconds)
    • getHowToPublish

      public String getHowToPublish()
      Get the howToPublish string (valid values are "live", "record" and "append")
      Returns:
      howToPublish string
    • setHowToPublish

      public void setHowToPublish(String howToPublish)
      Set the howToPublish string (valid values are "live", "record" and "append")
      Parameters:
      howToPublish - howToPublish string
    • isSendFCPublish

      public boolean isSendFCPublish()
      If true call FCPublish(streamName) after connecting to server
      Returns:
      true if calling FCPublish(streamName) after connecting to server
    • setSendFCPublish

      public void setSendFCPublish(boolean sendFCPublish)
      If true call FCPublish(streamName) after connecting to server
      Parameters:
      sendFCPublish - true if calling FCPublish(streamName) after connecting to server
    • isSendReleaseStream

      public boolean isSendReleaseStream()
      If true call releaseStream(streamName) after connecting to server
      Returns:
      true if calling releaseStream(streamName) after connecting to server
    • setSendReleaseStream

      public void setSendReleaseStream(boolean sendReleaseStream)
      If true call releaseStream(streamName) after connecting to server
      Parameters:
      sendReleaseStream - true if calling releaseStream(streamName) after connecting to server
    • getSessionListDebug

      public String getSessionListDebug()
      Get the list of active IoSession ids for this publishing session
      Returns:
      list of active IoSession ids for this publishing session
    • isCurrentSession

      public boolean isCurrentSession(org.apache.mina.common.IoSession session)
      Test to see if passed in session is current session
      Parameters:
      session - IoSession interface
      Returns:
      true if current session
    • getLastSession

      public PushPublishRTMPNetConnectionSession getLastSession()
      Get the last session interface
      Returns:
      last session interface
    • addSession

      public void addSession(PushPublishRTMPNetConnectionSession sessionHolder)
      Add session
      Parameters:
      sessionHolder - session holder
    • removeSession

      public void removeSession(PushPublishRTMPNetConnectionSession sessionHolder)
      Remove session
      Parameters:
      sessionHolder - session holder
    • getSessionHolderBySession

      public PushPublishRTMPNetConnectionSession getSessionHolderBySession(org.apache.mina.common.IoSession session)
      Get session holder by IoSession
      Parameters:
      session - IoSession
      Returns:
      session holder
    • getSessionHolderByNetConnection

      public PushPublishRTMPNetConnectionSession getSessionHolderByNetConnection(INetConnection netConnection)
      Get the session holder by INetConnection interface
      Parameters:
      netConnection - INetConnection interface
      Returns:
      session holder
    • sessionOpened

      public void sessionOpened(org.apache.mina.common.IoSession session)
      Internal callback
      Parameters:
      session - IoSession
    • sessionClosed

      public void sessionClosed(org.apache.mina.common.IoSession session)
      Internal callback
      Parameters:
      session - IoSession
    • tryToConnect

      protected void tryToConnect(PushPublishRTMP.STATE connectionState)
      Try to connect to server
    • resetConnection

      public void resetConnection()
      Reset server connection
    • resetConnection

      public void resetConnection(boolean noDelay)
      Reset server connection
      Parameters:
      noDelay - if true reset immediately
    • getContextStr

      public String getContextStr()
      Get the connection details
      Specified by:
      getContextStr in interface IPushPublish
      Specified by:
      getContextStr in class PushPublishBase
      Returns:
      connection details
    • internalConnect

      protected org.apache.mina.common.IoSession internalConnect(PushPublishRTMPNetConnectionSession pushPublisherSession)
      Internal connect method
      Parameters:
      pushPublisherSession - session holder
      Returns:
      Io session
    • getRemoteIpAddress

      public SocketAddress getRemoteIpAddress()
    • getConnectionQueryStr

      public String getConnectionQueryStr()
      Get the connection query string
      Returns:
      connection query string
    • setConnectionQueryStr

      public void setConnectionQueryStr(String connectionQueryStr)
      Set the connection query string
      Parameters:
      connectionQueryStr - connection query string
    • getQueryString

      public String getQueryString()
      Get the queryString
      Parameters:
      queryString -
    • setQueryString

      public void setQueryString(String queryString)
      Set the queryString, as set in the map file
      Parameters:
      queryString -
    • connect

      public void connect()
      Connect to server
    • callConnect

      protected void callConnect(PushPublishRTMPNetConnectionSession pushPublisherSession, String addQueryStr)
      Internal connect
      Parameters:
      pushPublisherSession - session holder
      addQueryStr - additional query params
    • getAkamaiSessionKey

      public String getAkamaiSessionKey(String sessionId)
      Get Akamai session key
      Parameters:
      sessionId - session Id
      Returns:
      Akamai session key
    • getConnectionFlashVerion

      public String getConnectionFlashVerion()
      Get Flash version used in connection metadata
      Returns:
      Flash version used in connection metadata
    • getConnectionFlashVersion

      public String getConnectionFlashVersion()
      Get Flash version used in connection metadata
      Returns:
      Flash version used in connection metadata
    • setConnectionFlashVersion

      public void setConnectionFlashVersion(String connectionFlashVersion)
      Set Flash version used in connection metadata
      Parameters:
      connectionFlashVersion - Flash version used in connection metadata
    • setConnectionFlashVerion

      public void setConnectionFlashVerion(String connectionFlashVersion)
      Set Flash version used in connection metadata
      Parameters:
      connectionFlashVersion - Flash version used in connection metadata
    • getConnectionSwfURL

      public String getConnectionSwfURL()
      Get SWF URL used in connection metadata
      Returns:
      SWF URL used in connection metadata
    • setConnectionSwfURL

      public void setConnectionSwfURL(String connectionSwfURL)
      Set SWF URL used in connection metadata
      Parameters:
      connectionSwfURL - SWF URL used in connection metadata
    • getConnectionPageURL

      public String getConnectionPageURL()
      Get Page URL used in connection metadata
      Returns:
      Page URL used in connection metadata
    • setConnectionPageURL

      public void setConnectionPageURL(String connectionPageURL)
      Set Page URL used in connection metadata
      Parameters:
      connectionPageURL - Page URL used in connection metadata
    • getSecureTokenSharedSecret

      public String getSecureTokenSharedSecret()
      Get SecureToken shared secret
      Returns:
      SecureToken shared secret
    • setSecureTokenSharedSecret

      public void setSecureTokenSharedSecret(String secureTokenSharedSecret)
      Set SecureToken shared secret
      Parameters:
      secureTokenSharedSecret - SecureToken shared secret
    • getAkamaiUserName

      public String getAkamaiUserName()
      Get Akamai user name
      Returns:
      Akamai user name
    • setAkamaiUserName

      public void setAkamaiUserName(String akamaiUserName)
      Set Akamai user name
      Parameters:
      akamaiUserName - Akamai user name
    • getAkamaiPassword

      public String getAkamaiPassword()
      Get Akamai password
      Returns:
      Akamai password
    • setAkamaiPassword

      public void setAkamaiPassword(String akamaiPassword)
      Set Akamai password
      Parameters:
      akamaiPassword - Akamai password
    • getAkamaiOriginIp

      public String getAkamaiOriginIp()
      Get Akamai Origin IP
      Returns:
      Akamai Origin IP
    • setAkamaiOriginIp

      public void setAkamaiOriginIp(String akamaiOriginIp)
      Set Akamai Origin IP
      Parameters:
      akamaiOriginIp - Akamai Origin IP
    • getAkamaiOriginPort

      public int getAkamaiOriginPort()
      Get Akamai Origin Port
      Returns:
      Akamai Origin Port
    • setAkamaiOriginPort

      public void setAkamaiOriginPort(int akamaiOriginPort)
      Set Akamai Origin Port
      Parameters:
      akamaiOriginPort - Akamai Origin Port
    • isSendFCAnnounce

      public boolean isSendFCAnnounce()
      If true call FCAnnounce(streamName) after connecting to server
      Returns:
      true if calling FCAnnounce(streamName) after connecting to server
    • setSendFCAnnounce

      public void setSendFCAnnounce(boolean sendFCAnnounce)
      If true call FCAnnounce(streamName) after connecting to server
      Parameters:
      sendFCAnnounce - true if calling FCAnnounce(streamName) after connecting to server
    • getValidationFrequency

      public long getValidationFrequency()
      Get connection validation frequency (millisecond). Zero to turn off validation.
      Returns:
      connection validation frequency (millisecond)
    • setValidationFrequency

      public void setValidationFrequency(long validationFrequency)
      Set connection validation frequency (millisecond). Zero to turn off validation.
      Parameters:
      validationFrequency - connection validation frequency (millisecond)
    • addListener

      public void addListener(IPushPublishRTMPNotify listener)
      Add IPushPublishRTMPNotify listener
      Parameters:
      listener - IPushPublishRTMPNotify listener
    • removeListener

      public boolean removeListener(IPushPublishRTMPNotify listener)
      rempve IPushPublishRTMPNotify listener
      Parameters:
      listener - IPushPublishRTMPNotify listener
      Returns:
      true if removed
    • getLocalListeners

      protected List<IPushPublishRTMPNotify> getLocalListeners()
      Get a list of IPushPublishRTMPNotify listeners
      Returns:
      list of IPushPublishRTMPNotify listeners
    • notifyConnectStart

      protected void notifyConnectStart(PushPublishRTMPNetConnectionSession pushPublisherSession)
      Notify connect start
      Parameters:
      pushPublisherSession - session holder
    • notifyConnectSuccess

      protected void notifyConnectSuccess(PushPublishRTMPNetConnectionSession pushPublisherSession)
      Notify connect success
      Parameters:
      pushPublisherSession - session holder
    • notifyConnectFailure

      protected void notifyConnectFailure(PushPublishRTMPNetConnectionSession pushPublisherSession)
      Notify connect failure
      Parameters:
      pushPublisherSession - session holder
    • notifyHandshakeResult

      protected void notifyHandshakeResult(PushPublishRTMPNetConnectionSession pushPublisherSession, com.wowza.wms.request.RequestFunction function, AMFDataList params)
      Notify handshake result
      Parameters:
      pushPublisherSession - session holder
      function - function
      params - params
    • notifyAkamaiSetChallenge

      protected void notifyAkamaiSetChallenge(PushPublishRTMPNetConnectionSession pushPublisherSession, com.wowza.wms.request.RequestFunction function, AMFDataList params)
      Notify Akamai SetChallenge
      Parameters:
      pushPublisherSession - session holder
      function - function
      params - params
    • notifyAkamaiSetOriginConnectionInfo

      protected void notifyAkamaiSetOriginConnectionInfo(PushPublishRTMPNetConnectionSession pushPublisherSession, com.wowza.wms.request.RequestFunction function, AMFDataList params)
      Notify Akamai SetOriginConnectionInfo
      Parameters:
      pushPublisherSession - session holder
      function - function
      params - params
    • notifyAkamaiClientLogin

      protected void notifyAkamaiClientLogin(PushPublishRTMPNetConnectionSession pushPublisherSession, com.wowza.wms.request.RequestFunction function, AMFDataList params)
      Notify Akamai ClientLogin
      Parameters:
      pushPublisherSession - session holder
      function - function
      params - params
    • notifyFCPublish

      protected void notifyFCPublish(PushPublishRTMPNetConnectionSession pushPublisherSession, com.wowza.wms.request.RequestFunction function, AMFDataList params)
      Notify FCPublish
      Parameters:
      pushPublisherSession - session holder
      function - function
      params - params
    • notifyFCAnnounce

      protected void notifyFCAnnounce(PushPublishRTMPNetConnectionSession pushPublisherSession, com.wowza.wms.request.RequestFunction function, AMFDataList params)
      Notify FCAnnounce
      Parameters:
      pushPublisherSession - session holder
      function - function
      params - params
    • notifyConnect

      protected void notifyConnect(PushPublishRTMPNetConnectionSession pushPublisherSession, com.wowza.wms.request.RequestFunction function, AMFDataList params)
      Notify connect
      Parameters:
      pushPublisherSession - session holder
      function - function
      params - params
    • notifyStreamCreate

      protected void notifyStreamCreate(PushPublishRTMPNetConnectionSession pushPublisherSession, com.wowza.wms.request.RequestFunction function, AMFDataList params)
      Notify stream create
      Parameters:
      pushPublisherSession - session holder
      function - function
      params - params
    • notifyStreamOnPlayStatus

      protected void notifyStreamOnPlayStatus(PushPublishRTMPNetConnectionSession pushPublisherSession, com.wowza.wms.request.RequestFunction function, AMFDataList params)
      Notify OnPlayStatus
      Parameters:
      pushPublisherSession - session holder
      function - function
      params - params
    • notifyStreamOnStatus

      protected void notifyStreamOnStatus(PushPublishRTMPNetConnectionSession pushPublisherSession, com.wowza.wms.request.RequestFunction function, AMFDataList params)
      Notify StreamOnStatus
      Parameters:
      pushPublisherSession - session holder
      function - function
      params - params
    • notifyPublishHandlerPlay

      protected void notifyPublishHandlerPlay(PushPublishRTMPNetConnectionSession pushPublisherSession, OutputStream out, long[] playSizes)
      Notify publish handler play
      Parameters:
      pushPublisherSession - session holder
      out - output stream
      playSizes - play sizes
    • notifySessionIdle

      protected void notifySessionIdle(PushPublishRTMPNetConnectionSession pushPublisherSession)
      Notify session idle event
      Parameters:
      pushPublisherSession - session holder
    • notifySessionOpened

      protected void notifySessionOpened(PushPublishRTMPNetConnectionSession pushPublisherSession)
      Notify session opened
      Parameters:
      pushPublisherSession - session holder
    • notifySessionClosed

      protected void notifySessionClosed(PushPublishRTMPNetConnectionSession pushPublisherSession)
      Notify session closed
      Parameters:
      pushPublisherSession - session holder
    • notifyValidateSession

      protected void notifyValidateSession(PushPublishRTMPNetConnectionSession pushPublisherSession)
    • notifyValidateSessionResult

      protected void notifyValidateSessionResult(PushPublishRTMPNetConnectionSession pushPublisherSession, boolean result)
    • notifyPushPublisherSessionCreate

      protected void notifyPushPublisherSessionCreate(PushPublishRTMPNetConnectionSession pushPublisherSession)
      Notify session create
      Parameters:
      pushPublisherSession - session holder
    • notifyPushPublisherSessionDestroy

      protected void notifyPushPublisherSessionDestroy(PushPublishRTMPNetConnectionSession pushPublisherSession)
      Notify session destroy
      Parameters:
      pushPublisherSession - session holder
    • getConnectLastAttempt

      public long getConnectLastAttempt()
      Get timestamp of last connection attempt
      Returns:
      timestamp of last connection attempt
    • getConnectAttemptCount

      public long getConnectAttemptCount()
    • setConnectLastAttempt

      public void setConnectLastAttempt(long connectLastAttempt)
      Set timestamp of last connection attempt
      Parameters:
      connectLastAttempt - timestamp of last connection attempt
    • bumpReconnectWaitTime

      protected void bumpReconnectWaitTime()
      Bump the reconnect wait time
    • getReconnectDelay

      protected int getReconnectDelay(long currTime)
      Get the reconnect delay
      Parameters:
      currTime - current timestamp
      Returns:
      delay in milliseconds
    • getConnectLastSuccess

      public long getConnectLastSuccess()
      Get timestamp of last successful connection
      Returns:
      timestamp of last successful connection
    • setConnectLastSuccess

      public void setConnectLastSuccess(long connectLastSuccess)
      Set timestamp of last successful connection
      Parameters:
      connectLastSuccess - timestamp of last successful connection
    • isSendOriginalTimecodes

      public boolean isSendOriginalTimecodes()
      true if sending the original timecodes of source stream. false if starting at zero.
      Returns:
      true if sending the original timecodes of source stream
    • setSendOriginalTimecodes

      public void setSendOriginalTimecodes(boolean sendOriginalTimecodes)
      true if sending the original timecodes of source stream. false if starting at zero.
      Parameters:
      sendOriginalTimecodes - true if sending the original timecodes of source stream
    • getOriginalTimecodeThreshold

      public long getOriginalTimecodeThreshold()
      Get the original timecode threshold. This value will attempt to reduce the magnitude of absolute timecodes while keeping multiple-bitrate alignment. It is probably best to set this value quite high to a value such as 0x100000. The value is in milliseconds. The following forumla is used to calculate a timecode offset timecodeOffset = timecode - (timecode%originalTimecodeThreshold);
      Returns:
      original timecode threshold
    • setOriginalTimecodeThreshold

      public void setOriginalTimecodeThreshold(long originalTimecodeThreshold)
      Set the original timecode threshold. This value will attempt to reduce the magnitude of absolute timecodes while keeping multiple-bitrate alignment. It is probably best to set this value quite high to a value such as 0x100000. The value is in milliseconds. The following forumla is used to calculate a timecode offset timecodeOffset = timecode - (timecode%originalTimecodeThreshold);
      Parameters:
      originalTimecodeThreshold - original timecode threshold
    • setOriginalTimecodeThreshold

      public void setOriginalTimecodeThreshold(String i)
    • isDebugLog

      public boolean isDebugLog()
      Is debug logging turned on
      Specified by:
      isDebugLog in interface IPushPublish
      Overrides:
      isDebugLog in class PushPublishBase
      Returns:
      true if debug logging is turned on
    • setDebugLog

      public void setDebugLog(boolean debugLog)
      Set debug logging
      Specified by:
      setDebugLog in interface IPushPublish
      Overrides:
      setDebugLog in class PushPublishBase
      Parameters:
      debugLog - debug logging
    • setStreamDebugLog

      public void setStreamDebugLog(boolean debugLog)
    • getAppInstance

      public IApplicationInstance getAppInstance()
      Get appInstance interface
      Overrides:
      getAppInstance in class PushPublishBase
      Returns:
      appInstance interface
    • setAppInstance

      public void setAppInstance(IApplicationInstance appInstance)
      Set appInstance interface
      Overrides:
      setAppInstance in class PushPublishBase
      Parameters:
      appInstance - appInstance interface
    • getSrcStreamName

      public String getSrcStreamName()
      Get source stream name
      Specified by:
      getSrcStreamName in interface IPushPublish
      Overrides:
      getSrcStreamName in class PushPublishBase
      Returns:
      source stream name
    • setSrcStreamName

      public void setSrcStreamName(String srcStreamName)
      Set source stream name
      Specified by:
      setSrcStreamName in interface IPushPublish
      Overrides:
      setSrcStreamName in class PushPublishBase
      Parameters:
      srcStreamName - source stream name
    • getDstStreamName

      public String getDstStreamName()
      Get destination stream name
      Specified by:
      getDstStreamName in interface IPushPublish
      Overrides:
      getDstStreamName in class PushPublishBase
      Returns:
      destination stream name
    • setDstStreamName

      public void setDstStreamName(String dstStreamName)
      Set destination stream name
      Specified by:
      setDstStreamName in interface IPushPublish
      Overrides:
      setDstStreamName in class PushPublishBase
      Parameters:
      dstStreamName - destination stream name
    • getPort

      public int getPort()
      Get destination server port
      Specified by:
      getPort in interface IPushPublish
      Overrides:
      getPort in class PushPublishBase
      Returns:
      destination server port
    • setPort

      public void setPort(int port)
      Set destination server port
      Specified by:
      setPort in interface IPushPublish
      Overrides:
      setPort in class PushPublishBase
      Parameters:
      port - destination server port
    • getDstApplicationName

      public String getDstApplicationName()
      Get destination application name
      Returns:
      destination application name
    • setDstApplicationName

      public void setDstApplicationName(String dstApplicationName)
      Set destination application name
      Parameters:
      dstApplicationName - destination application name
    • getDstAppInstanceName

      public String getDstAppInstanceName()
      Get destination appInstance name
      Returns:
      destination appInstance name
    • setDstAppInstanceName

      public void setDstAppInstanceName(String dstAppInstanceName)
      Set destination appInstance name
      Parameters:
      dstAppInstanceName - destination appInstance name
    • getRTMPAuthProvider

      public IPushPublishRTMPAuthProvider getRTMPAuthProvider()
      Get RTMP authentication provider
      Returns:
      RTMP authentication provider
    • setRTMPAuthProvider

      public void setRTMPAuthProvider(IPushPublishRTMPAuthProvider rtmpAuthProvider)
      Set RTMP authentication provider
      Parameters:
      rtmpAuthProvider - RTMP authentication provider
    • isSendOnMetadata

      public boolean isSendOnMetadata()
      True if sending onMetadata event at start of stream
      Returns:
      True if sending onMetadata event at start of stream
    • setSendOnMetadata

      public void setSendOnMetadata(boolean sendOnMetadata)
      True if sending onMetadata event at start of stream
      Parameters:
      sendOnMetadata - True if sending onMetadata event at start of stream
    • isRemoveDefaultAppInstance

      public boolean isRemoveDefaultAppInstance()
      If true and destination application instance is _definst_ then the application instance name will not be sent to the remove server as part of the connection information.
      Returns:
      true if omitting _definst_
    • setRemoveDefaultAppInstance

      public void setRemoveDefaultAppInstance(boolean removeDefaultAppInstance)
      If true and destination application instance is _definst_ then the application instance name will not be sent to the remove server as part of the connection information.
      Parameters:
      removeDefaultAppInstance - true if omitting _definst_
    • isOnMetadataToSetDataFrame

      public boolean isOnMetadataToSetDataFrame()
      If true all onMetadata events are converted to @setDataFrame calls
      Returns:
      true all onMetadata events are converted to @setDataFrame calls
    • setOnMetadataToSetDataFrame

      public void setOnMetadataToSetDataFrame(boolean onMetadataToSetDataFrame)
      If true all onMetadata events are converted to @setDataFrame calls
      Parameters:
      onMetadataToSetDataFrame - true all onMetadata events are converted to @setDataFrame calls
    • isSendStreamCloseCommands

      public boolean isSendStreamCloseCommands()
      If true will send FCUnpublish, closeStream, deleteStream on disconnect
      Returns:
      true will send close commands
    • setSendStreamCloseCommands

      public void setSendStreamCloseCommands(boolean sendStreamCloseCommands)
      If true will send FCUnpublish, closeStream, deleteStream on disconnect
      Parameters:
      sendStreamCloseCommands - true will send close commands
    • convertDataEvenToAMFData

      public AMFDataList convertDataEvenToAMFData(AMFPacket packet)
    • convertOnMetadataToSetDataFrame

      public AMFPacket convertOnMetadataToSetDataFrame(AMFPacket packet)
    • filterOnMetadataEvent

      public AMFPacket filterOnMetadataEvent(AMFPacket packet, long flags, List<String> itemsToRemove, Map<String,AMFData> itemsToAdd)
    • getStreamCloseWaitTime

      public int getStreamCloseWaitTime()
      Get stream close timeout (milliseconds)
      Returns:
      stream close timeout (milliseconds)
    • setStreamCloseWaitTime

      public void setStreamCloseWaitTime(int streamCloseWaitTime)
      Set stream close timeout (milliseconds)
      Parameters:
      streamCloseWaitTime - stream close timeout (milliseconds)
    • disconnect

      public void disconnect()
      Disconnect from server
    • disconnect

      public void disconnect(boolean hard)
    • isFlashVerionFMLE

      public static boolean isFlashVerionFMLE(String flashVersion)
      Returns true if the Flash player version string is a Flash Media Live Encoder version (start with FMLE/ or FME/)
      Parameters:
      flashVersion - true if Flash Media Live Encoder version
      Returns:
      true if flash
    • isFlashVersionFMLE

      public static boolean isFlashVersionFMLE(String flashVersion)
      Returns true if the Flash player version string is a Flash Media Live Encoder version (start with FMLE/ or FME/)
      Parameters:
      flashVersion - true if Flash Media Live Encoder version
      Returns:
      true if flash
    • isDebugPackets

      public boolean isDebugPackets()
      Set to true to log every packet being sent
      Returns:
      true to log every packet being sent
    • setDebugPackets

      public void setDebugPackets(boolean debugPackets)
      Set to true to log every packet being sent
      Parameters:
      debugPackets - true to log every packet being sent
    • getTotalPacketsSent

      public long getTotalPacketsSent()
      Get total number of packets sent during push publishing session
      Returns:
      total number of packets sent during push publishing session
    • isResetOnTimecodeOutOfOrder

      public boolean isResetOnTimecodeOutOfOrder()
      Set to true if you wish push to reset if timecodes jump out of order.
      Returns:
      true if you wish push to reset if timecodes jump out of order
    • setResetOnTimecodeOutOfOrder

      public void setResetOnTimecodeOutOfOrder(boolean resetOnTimecodeOutOfOrder)
      Set to true if you wish push to reset if timecodes jump out of order.
      Parameters:
      resetOnTimecodeOutOfOrder - true if you wish push to reset if timecodes jump out of order
    • getTimecodesOutOfOrderThreshold

      public int getTimecodesOutOfOrderThreshold()
    • setTimecodesOutOfOrderThreshold

      public void setTimecodesOutOfOrderThreshold(int timecodesOutOfOrderThreshold)
    • getLastVideoTC

      public long getLastVideoTC()
      Get the absolute timecode of the last sent video packet (milliseconds)
      Returns:
      absolute timecode of the last sent video packet (milliseconds)
    • getLastVideoKeyFrameTC

      public long getLastVideoKeyFrameTC()
      Get the absolute timecode of the last sent video keyframe packet (milliseconds)
      Returns:
      absolute timecode of the last sent video keyframe packet (milliseconds)
    • getLastAudioTC

      public long getLastAudioTC()
      Get the absolute timecode of the last sent audio packet (milliseconds)
      Returns:
      absolute timecode of the last sent audio packet (milliseconds)
    • getLastDataTC

      public long getLastDataTC()
      Get the absolute timecode of the last sent data packet (milliseconds)
      Returns:
      absolute timecode of the last sent data packet (milliseconds)
    • isOnMetadataReady

      protected boolean isOnMetadataReady(IMediaStream stream, AMFPacket packet)
    • isWaitOnMetadataAvailable

      public boolean isWaitOnMetadataAvailable()
      Set to true to turn on system that will monitor onMetadata packet and wait for it to be populated before it starts sending the stream. Default is true. If stream is audio or video only, be sure to use setWaitOnMetadataVideo and setWaitOnMetadataAudio to properly turn off the channel you are not using or the system will always timeout.
      Returns:
      true to turn on system that will monitor onMetadata packet
    • setWaitOnMetadataAvailable

      public void setWaitOnMetadataAvailable(boolean waitOnMetadataAvailable)
      Set to true to turn on system that will monitor onMetadata packet and wait for it to be populated before it starts sending the stream. Default is true. If stream is audio or video only, be sure to use setWaitOnMetadataVideo and setWaitOnMetadataAudio to properly turn off the channel you are not using or the system will always timeout.
      Parameters:
      waitOnMetadataAvailable - true to turn on system that will monitor onMetadata packet
    • isWaitOnMetadataVideo

      public boolean isWaitOnMetadataVideo()
      If true and waitOnMetadataAvailable, publishing will not start until onMetadata packet is populated with video data.
      Returns:
      publishing will not start until onMetadata packet is populated with video data
    • setWaitOnMetadataVideo

      public void setWaitOnMetadataVideo(boolean waitOnMetadataVideo)
      If true and waitOnMetadataAvailable, publishing will not start until onMetadata packet is populated with video data.
      Parameters:
      waitOnMetadataVideo - publishing will not start until onMetadata packet is populated with video data
    • isWaitOnMetadataAudio

      public boolean isWaitOnMetadataAudio()
      If true and waitOnMetadataAvailable, publishing will not start until onMetadata packet is populated with audio data.
      Returns:
      publishing will not start until onMetadata packet is populated with audio data
    • setWaitOnMetadataAudio

      public void setWaitOnMetadataAudio(boolean waitOnMetadataAudio)
      If true and waitOnMetadataAvailable, publishing will not start until onMetadata packet is populated with audio data.
      Parameters:
      waitOnMetadataAudio - publishing will not start until onMetadata packet is populated with audio data
    • getWaitOnMetadataTimeout

      public long getWaitOnMetadataTimeout()
      Timeout (milliseconds) that the wait on onMetadata system will wait looking for video and audio data to be populated.
      Returns:
      timeout (milliseconds) that the wait on onMetadata system will wait looking for video and audio data to be populated
    • setWaitOnMetadataTimeout

      public void setWaitOnMetadataTimeout(long waitOnMetadataTimeout)
      Timeout (milliseconds) that the wait on onMetadata system will wait looking for video and audio data to be populated.
      Parameters:
      waitOnMetadataTimeout - timeout (milliseconds) that the wait on onMetadata system will wait looking for video and audio data to be populated
    • isWaitOnMetadataVideoDatarate

      public boolean isWaitOnMetadataVideoDatarate()
    • setWaitOnMetadataVideoDatarate

      public void setWaitOnMetadataVideoDatarate(boolean waitOnMetadataVideoDatarate)
    • isWaitOnMetadataAudioDatarate

      public boolean isWaitOnMetadataAudioDatarate()
    • setWaitOnMetadataAudioDatarate

      public void setWaitOnMetadataAudioDatarate(boolean waitOnMetadataAudioDatarate)
    • getSrcStreamBufferSize

      public long getSrcStreamBufferSize()
      The amount of audio/video in milliseconds that must be available in the source streams buffer before push publishing will being.
      Returns:
      amount of audio/video in milliseconds that must be available
    • setSrcStreamBufferSize

      public void setSrcStreamBufferSize(long srcStreamBufferSize)
      The amount of audio/video in milliseconds that must be available in the source streams buffer before push publishing will being.
      Parameters:
      srcStreamBufferSize - amount of audio/video in milliseconds that must be available
    • addConnectMetaData

      public void addConnectMetaData(String key, AMFData value)
      Added metadata values to the connect metadata object
      Parameters:
      key - key
      value - AMFDataObj value
    • createPushPublishSession

      public IPushPublishSession createPushPublishSession()
      Specified by:
      createPushPublishSession in interface IPushPublish
      Overrides:
      createPushPublishSession in class PushPublishBase
    • getPacketsSentAudio

      public long getPacketsSentAudio()
    • getPacketsSentVideo

      public long getPacketsSentVideo()
    • getPacketsSentVideoKeyFrame

      public long getPacketsSentVideoKeyFrame()
    • getPacketsSentData

      public long getPacketsSentData()
    • isSSL

      public boolean isSSL()
    • setSSL

      public void setSSL(boolean isSSL)
    • getBindAddress

      public String getBindAddress()
    • setBindAddress

      public void setBindAddress(String bindAddress)
    • getConnectedState

      public int getConnectedState()
    • getMessagesAttemptedCount

      public long getMessagesAttemptedCount()
    • getMessagesRetriedCount

      public long getMessagesRetriedCount()
    • getMessagesFailedCount

      public long getMessagesFailedCount()
    • getSyncTimecode

      public long getSyncTimecode()
    • setSyncTimecode

      public void setSyncTimecode(long syncTimecode)
    • getSyncPacketType

      public int getSyncPacketType()
    • setSyncPacketType

      public void setSyncPacketType(int syncPacketType)
    • getOnMetadataFilter

      public long getOnMetadataFilter()
    • setOnMetadataFilter

      public void setOnMetadataFilter(long onMetadataFilter)
    • addOnMetadataItemToRemove

      public void addOnMetadataItemToRemove(String name)
    • putOnMetadataItemToAdd

      public void putOnMetadataItemToAdd(String name, AMFData value)
    • getOriginalTimecodeOffset

      public long getOriginalTimecodeOffset()
    • setOriginalTimecodeOffset

      public void setOriginalTimecodeOffset(long originalTimecodeOffset)