• How to use server-side modules and HTTP Providers

    Much of the functionality delivered by the Wowza Streaming Engine™ software is done through server-side modules and HTTP Providers. Server-side modules are Java classes that are configured on a per-application basis and are loaded at application instance startup. They provide much of the functionality needed to control the streaming process. HTTP Providers are Java classes that are configured on a per-virtual host basis. They are lightweight HTTP servers that can be used to query or interact with the Wowza server. This article reviews these methods for extending Wowza Streaming Engine software and the built-in Java classes that are available for use.

    Note: For more information about the programming model you can use to create your own server-side extension, see How to extend Wowza Streaming Engine using Java.

    Contents


    Server-side modules
    HTTP Providers

    Server-side modules


    Server-side modules are Java classes that are configured on a per-application basis and are dynamically loaded at application startup. One use of server-side modules is to provide remote methods that can be called from Adobe Flash Player. It's these methods that provide the play, publish, seek, pause, and resume functionality needed to control the streaming process in Flash Player. Another use of server-side modules is to control Adobe HDS, Apple HLS, Microsoft Smooth Streaming, MPEG-DASH, and RTSP/RTP streaming. For more information about how the API works, see How to extend Wowza Streaming Engine using Java.

    Server-side modules are configured by adding entries to the Modules list for an application in Wowza Streaming Engine Manager. The default Modules list for an application looks like this:



    Each of these modules is described in detail in Built-in server-side modules below. For more information about how to create custom server-side modules, see How to extend Wowza Streaming Engine using Java.

    Built-in server-side modules

    This section briefly describes the server-side modules that are built-in with Wowza Streaming Engine software. For more information about the methods that are provided in a module, see the Wowza Streaming Engine Server-side API.

    ModuleCore - (com.wowza.wms.module.ModuleCore)

    The ModuleCore module represents the server-side implementation of the Adobe Flash NetConnection, NetStream, and SharedObject objects. This module must be included by all applications for the server to operate properly. This module contains several additional server-side methods that are described in the following table.

    Function call Description
    setStreamType(streamType:String);
    getStreamType();
    Returns and sets the default stream type for this client connection.
    setRepeaterOriginUrl(originUrl:String);
    getRepeaterOriginUrl();
    Returns and sets the live stream repeater origin URL to use for this connection in an origin/edge configuration.
    getStreamLength(streamName:String);
    getStreamLength(streamNames:Array);
    For video on demand streaming, returns the stream duration, in seconds. If an array of stream names is passed in, an array of durations is returned.
    getClientID(); Returns the client ID for this client connection.
    getReferrer(); Gets the referrer from the onConnect method.
    getPageUrl(); Gets the page URL from the onConnect method.
    getVersion(); Returns the server name and version.
    getLastStreamId(); Returns the ID number of the last NetStream object that was created by this client.
    FCSubscribe(streamName, [mediaCasterType]);
    FCUnSubscribe(streamName);
    When using a live stream repeater (origin/edge), this method is useful for locking all bitrate renditions of an adaptive bitrate live stream on an edge server. This ensures that all streams are available when a switch is made between bitrate renditions.
    FCPublish(streamName);
    FCUnpublish(streamName);
    Called to tell the Wowza Streaming Engine server that a new stream is being published.

    ModuleClientLogging - (com.wowza.wms.module.ModuleClientLogging)

    The ModuleClientLogging module enables client-side logging to the server.
    logDebug(logStr:String);
    logInfo(logStr:String);
    logWarn(logStr:String);
    logError(logStr:String);
    The following call from a Flash Player client:
    nc.call("logDebug", null, "log this string");
    Is the same as a server-side call to:
    getLogger().debug("log this string");

    ModuleFLVPlayback - (com.wowza.wms.module.ModuleFLVPlayback)

    The ModuleFLVPlayback module is required by the FLVPlayback component. This module must be added to any application that uses the FLVPlayback component.

    ModuleCoreSecurity - (com.wowza.wms.security.ModuleCoreSecurity)

    The ModuleCoreSecurity module provides publishing and playback security. In Wowza Streaming Engine software, it replaces many of the security modules that are included in the Module Collection for earlier versions of the server software. The security functionality provided by this module includes:

    Publishing

    • Enable/Disable RTMP publishing

    • Require RTMP publishing password

    • Allow duplicate stream names to be published or prevent them from being published

    • Whitelist/Blacklist publishers by IP address


    Playback

    • Limit number of player connections

    • Require secure RTMP connection for playback

    • Require a security token for playback on Flash-based players

    • Whitelist/Blacklist players by IP address

    See the How to configure security using Wowza Streaming Engine Manager.

    HTTP Providers


    HTTP Providers are mini HTTP servers that can be used to extend Wowza Streaming Engine software functionality. They are configured on a per-port basis in [install-dir]/conf/VHost.xml. An individual HTTP Provider can be protected by a user name and password. Multiple HTTP Providers can be attached to one port and a specific HTTP Provider can be selected based on a request filter. An example HTTP Provider configuration looks like this:
    <HTTPProvider>
        <BaseClass>com.wowza.wms.http.HTTPServerInfoXML</BaseClass>
        <RequestFilters>serverinfo*</RequestFilters>
        <AuthenticationMethod>admin-digest</AuthenticationMethod>
    </HTTPProvider>
    The BaseClass property is the fully qualified path of the class that overrides the HTTPProvider2Base class and implements the IHTTPProvider interface.

    The RequestFilters property is list of filters, separated by a pipe (|) character, that control when the provider is invoked, based on the HTTP request path. In the above example, the request filter is only invoked if the path part of the HTTP request URL starts with serverinfo (for example, http://[wowza-ip-address]:8086/serverinfo).

    The AuthenticationMethod property specifies the authentication method that's used to control access to the HTTP Provider. Valid values are admin-digest and none. The admin-digest authentication method uses digest authentication (a challenge/response system to authenticate users--credentials are never sent in clear text) to control access to the HTTP Provider. User names and passwords for admin-digest authentication are stored in the [install-dir]/conf/admin.password file by default. The none method allows all access.

    Note: In Wowza Streaming Engine 4.5.0 and later, you can specify a custom location to store user names and passwords for admin-digest authentication. To do this, open the [install-dir]/conf/VHost.xml file in a text editor and then add the passwordFile property to the HTTP Provider configuration. For example:
    <HTTPProvider>
        <BaseClass>com.wowza.wms.http.HTTPServerInfoXML</BaseClass>
        <RequestFilters>serverinfo*</RequestFilters>
        <AuthenticationMethod>admin-digest</AuthenticationMethod>
        <Properties>
            <Property>
                <Name>passwordFile</Name>
                <Value>${com.wowza.wms.context.VHostConfigHome}/conf/myPasswordFile.txt</Value>
            </Property>
        </Properties>
    </HTTPProvider>
    For more information about how to create custom HTTP Providers, see How to create an HTTP Provider. Additionally, more complex and interesting HTTP Provider examples can be found in the HTTP Provider Code Examples articles.

    Built-in HTTP Providers

    The following list describes the built-in HTTP Providers that are found in VHost.xml:

    • HTTPClientAccessPolicy - (com.wowza.wms.http.HTTPClientAccessPolicy)
      Delivers the Microsoft Silverlight clientaccesspolicy.xml file when present in the [install-dir]/conf folder.

    • HTTPConnectionCountsXML - (com.wowza.wms.http.HTTPConnectionCountsXML)
      Returns connection information in XML format and is available through administrative port 8086 (http://[wowza-ip-address]:8086/connectioncounts).

    • HTTPConnectionInfo - (com.wowza.wms.http.HTTPConnectionInfo)
      Returns detailed connection information in XML format and is available through administrative port 8086 (http://[wowza-ip-address]:8086/connectioninfo).

    • HTTPCrossdomain - (com.wowza.wms.http.HTTPCrossdomain)
      Delivers the Adobe Flash crossdomain.xml file when present in [install-dir]/conf.

    • HTTPProviderCaptionFile - (com.wowza.wms.http.HTTPProviderCaptionFile)
      Delivers caption files from [install-dir]/content when requested by players.

    • HTTPProviderMediaList - (com.wowza.wms.http.HTTPProviderMediaList)
      Dynamic method for generating adaptive bitrate manifests and playlists from SMIL data.

    • HTTPServerInfoXML - (com.wowza.wms.http.HTTPServerInfoXML)
      Returns detailed server and connection information in XML format and is available through administrative port 8086 (http://[wowza-ip-address]:8086/serverinfo).

    • HTTPServerVersion - (com.wowza.wms.http.HTTPServerVersion)
      Returns the Wowza Streaming Engine version and build number. It's the default HTTP Provider on port 1935.

    • HTTPTranscoderThumbnail - (com.wowza.wms.http.HTTPTranscoderThumbnail)
      Returns a bitmap image from the source stream being transcoded. Available through administrative port 8086 (http://[wowza-ipaddress]:8086/transcoderthumbnail?application=[applicationname]&streamname=[stream-name]&format=[jpeg or png]&size=[widthxheight]).


    Originally Published: For Wowza Streaming Engine on 11-20-2015.
    Updated: For Wowza Streaming Engine 4.5.0 on 06-23-2016.

    If you're having problems or want to discuss this article, post in our forum.