• How to use JW Player with adaptive bitrate streaming from Wowza Streaming Engine

    This article describes a technique for generating a client-side SMIL file that's used by JW Player's RTMP Dynamic Streaming implementation. JW Player supports loading dynamic streams from a server-side SMIL (Synchronized Multimedia Integration Language) file.

    Notes:
    • For use with JW Player 6 and Wowza Streaming Engine™ media server software.
    • JW Player is a Works with Wowza™ partner.

    Configuration

    1. The proper request filter is built-in with Wowza Streaming Engine software and Wowza Media Server software (version 3.5 and later) and no further configuration is required for the Wowza media server. For Wowza Media Server versions prior to 3.5, you must add an HTTP Provider to [install-dir]/conf/VHost.xml and then restart the server to apply the changes.

      Note: Be sure to add the HTTP Provider to the Default Streaming <HostPort> container. It must be added just above the Server Version HTTP Provider as shown in the following example:
      <HTTPProvider>
           <BaseClass>com.wowza.wms.http.HTTPProviderMediaList</BaseClass>
           <RequestFilters>*jwplayer.smil</RequestFilters>
           <AuthenticationMethod>none</AuthenticationMethod>
      </HTTPProvider>
      <HTTPProvider>
           <BaseClass>com.wowza.wms.http.HTTPServerVersion</BaseClass>
           <RequestFilters>*</RequestFilters>
           <AuthenticationMethod>none</AuthenticationMethod>
      </HTTPProvider>
    2. Create a client-side URL for JW player in the following format:

      http://[wowza-ip-address]:1935/[application]/[prefix]:[stream-name]/jwplayer.smil

      For example, if the content folder has a file named sample.smil and video files named sample.mp4 and sample_250.mp4:
      <smil>
           <head>
           </head>
           <body>
                <switch>
                     <video src="mp4:sample_250.mp4" system-bitrate="250000"/>
                     <video src="mp4:sample.mp4" system-bitrate="450000"/>
                </switch>
           </body>
      </smil>
      You can use the following URL:

      http://[wowza-ip-address]:1935/vod/smil:sample.smil/jwplayer.smil

    3. In your webpage, insert the following embed code at the location you want the player to appear:
      <script type='text/javascript' src='/jwplayer/jwplayer.js'></script>
      
      <div id='mediaplayer'></div>
      
      <script type="text/javascript">
        jwplayer('mediaplayer').setup({
          'flashplayer': 'player.swf',
          'id': 'playerID',
          'width': '720',
          'height': '306',
          'playlistfile': 'http://[wowza-ip-address]:1935/vod/smil:sample.smil/jwplayer.smil',
          'plugins': {
             'qualitymonitor-2': {}
          }
        });
      </script>

    This URL:

    http://[wowza-ip-address]:1935/vod/smil:sample.smil/jwplayer.smil

    Generates this SMIL file:
    <smil>
    <head>
    <meta base="rtmp://localhost:1935/vod/_definst_"/>
    </head>
    <body>
    <switch>
    <video src="mp4:sample_250.mp4" system-bitrate="250"/>
    <video src="mp4:sample.mp4" system-bitrate="450"/>
    </switch>
    </body>
    </smil>

    Notes:
    • If you use a streaming port number other than 1935, you must specify the ?domain query parameter and port number at the end of the URL. For example:

      http://[wowza-ip-address]/live/smil:sample.smil/jwplayer.smil?domain=my.example.com:80

    • You can also use the technique described in this article if you have a Stream Name Group defined in a Wowza Transcoder template (ngrp: stream name prefix) or a MediaList (amlst: stream name prefix). For example:

      http://[wowza-ip-address]:1935/vod/ngrp:myStream_all/jwplayer.smil

      http://[wowza-ip-address]:1935/vod/amlst:sample/jwplayer.smil

      For more information about Transcoder Stream Name Groups (NGRP), see How to set up and run Wowza Transcoder for live streaming.

      For more information about how to generate a MediaList (AMLST), see How to use Java API calls to resolve SMIL file requests.

    Originally Published: 10-28-2011.
    Updated: For Wowza Streaming Engine on 03-28-2014.

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