• 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™ 4.0 and later.

    • 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 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 for the changes to take effect.

      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:
      Code:
      <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:
      Code:
      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:
      Code:
      <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:
      Code:
      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:
      Code:
      <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:
    Code:
    http://[wowza-ip-address]:1935/vod/smil:sample.smil/jwplayer.smil
    generates this SMIL file:
    Code:
    <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>

    Note: The technique described in this article can also be used if you have a defined Stream Name Group in a Wowza Transcoder template (ngrp: stream name prefix) or a MediaList (amlst: stream name prefix).

    Examples:
    Code:
    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 the Wowza Transcoder Tutorial.

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

    Updated: For Wowza Streaming Engine 4.0 on 03-28-2014

    Comments 33 Comments
    1. prasad -
      Hi, I'm trying to use this technique but it does not seem to work...
      I set-up a ec2 wowza instance for test, version 3.0.3 and jw player 5.8.
      the url
      Code:
      http://[wowza-address]:1935/vod/smil:sample.smil/jwplayer.rss
      does return expected xml file in a web browser, but if I use this url as playlistfile source in jw player, the player does not load the playlist and remains black, with no error returned...
      If I copy/paste url xml result in a new xml file and I set this xml as playlist in jwplayer, it works.
      So my smil file is correct...
      Have someone else encountered this kind of problem?

      Best regards,
      PrÔsad.
    1. rrlanham -
      Did you restart Wowza after change to VHost.xml? Check for typos?

      You can test in a browser, you should see the RSS file:

      Code:
      http://[wowza-address]:1935/vod/smil:streams.smil/jwplayer.rss
      Richard
    1. prasad -
      Hi Richard,

      as I said, the url works fine in web browser, and if I copy/paste xml returned by the url in a xml file hosted on web server, jw player launches playlist and plays videos...
      But if I use url directly in jw player setup code, the screen remains black and nothing happens... Code I use for jw player is exactly the same as your article...

      PrÔsad.
    1. rrlanham -
      PrÔsad,

      Are you getting sandbox security error? Are you using debug player so you see messages?

      Richard
    1. prasad -
      Richard,

      when using debug player with output to console, I can see a call to crossdomain.xml which return HTTP 200, then a call to vod/smil:sample.smil/jwplayer.rss which never returns...
      I can reproduce this with a browser, a call to vod/smil:sample.smil/jwplayer.rss just after a call to crossdomain.xml don't return...

      PrÔsad.
    1. rrlanham -
      PrÔsad,

      Zip up conf and logs and this player and send to support@wowza.com.

      Include a link to this thread for reference.

      Richard
    1. meneceur -
      Quote Originally Posted by rrlanham View Post
      PrÔsad,

      Zip up conf and logs and this player and send to support@wowza.com.

      Include a link to this thread for reference.

      Richard

      Hi, we have the same problem. Is it resolved?
      thank you
      Nicolas.
    1. prasad -
      Hi Nicolas,

      I still have an opened ticket about this issue.
      I'm awaiting an answer from Richard.
      As soon as I have it, I will let you know.

      Best regards,
      PrÔsad.
    1. rrlanham -
      I was going to replicate, try to improve the documentation, however it did work for me in all my tests, including running a player locally that referenced the RSS output of HTTPProvider on your server, ruling out sandbox error.

      Richard
    1. prasad -
      Hi Nicolas, could you please describe your problem?
      Do you have a test url to share?

      Best regards,
      PrÔsad.
      PS: I tried to contact you with private message, but it seems that you have not activated it on the forum.
    1. najibx -
      Hye,

      I have got the VOD Dynamic Streaming playback working using a sample.smil file I created manually (mysiteurl:1935/vod/smil:sample.smil/jwplayer.rss)
      For Live Streaming I use, auto-generated SMIL by transcoderAddon to create the mRSS (mysiteurl:1935/live/ngrp:myStream_all/jwplayer.rss). It look like a valid mRSS format. Similar to the VOD (sample.smil).

      however, simply replacing 'playlistfile' in the code is no good, only show me a black screen.

      'playlistfile': 'mysiteurl:1935/live/ngrp:myStream_all/jwplayer.rss',

      Tips and comment please. Thanks.
    1. rrlanham -
      Do you see the RSS file in a browser?:

      Code:
      http://mysiteurl:1935/live/ngrp:myStream_all/jwplayer.rss
      If so, try copying that to a file alongside player.swf

      Richard
    1. najibx -
      The mRSS output from Chrome browser,

      Code:
      This XML file does not appear to have any style information associated with it. The document tree is shown below.
      <rss xmlns:media="http://search.yahoo.com/mrss/" xmlns:jwplayer="http://developer.longtailvideo.com/" version="2.0">
      <channel>
      <item>
      <title>myStream_all</title>
      <description>myStream_all</description>
      <jwplayer:streamer>rtmp://mysiteurl:1935/live/_definst_</jwplayer:streamer>
      <media:group>
      <media:content url="mp4:myStream_source" bitrate="333" width="320" height="240"/>
      <media:content url="mp4:myStream_360p" bitrate="882" width="480" height="360"/>
      <media:content url="mp4:myStream_160p" bitrate="232" width="214" height="160"/>
      </media:group>
      </item>
      </channel>
      </rss>
      html { padding-top: 34px !important;}
      Then I use this code (the same for VOD is working, only change playlistfile) :

      Code:
      <script type="text/javascript">
        jwplayer('mediaplayer').setup({
          'flashplayer': '/jwplayer/player.swf',
          'id': 'playerID',
          'width': '720',
          'height': '406',
          'playlistfile': 'http://mysiteurl:1935/live/ngrp:myStream_all/jwplayer.rss',
          'plugins': {
             'qualitymonitor-2': {}
          }
        });
      </script>
    1. rrlanham -
      I'm not sure how myStream_source is included in the rss, and the settings seems wrong for it. Is the source h.264 and AAC or MP3 audio?

      Send a working url so that I can test to support@wowza.com

      Include a link to this thread for reference.

      Richard
    1. najibx -
      Thanks for the reply.
      The source h.264 and AAC (Mono) from Wirecast

      This morning, without doing anything, I broadcast again, with the same mRSS output, the JWplayer is loading/playing the live video! But seems something not right. (my laptop is slowing down or internet is slow).

      Anyway, send further info to support@wowza.com.
    1. daveuofu -
      Using JW's adaptive.swf provider, JW can connect to and play an individual stream live stream from a transcoder name group. However, attempting to connect JW to the name group itself results in an error.

      This works fine:
      http://[server]/livetc/livetc.mp4_360p/playlist.m3u8

      This results in JW error "Cannot load M3U8: crossdomain access denied":
      http://&#91;server]/livetc/ngrp:livetc.m.../playlist.m3u8

      Any idea why this is happening? The crossdomain.xml is set to allow access from domain "*". Thanks!

      ... adding more information here:

      the ngrp provider returns this:
      #EXTM3U
      #EXT-X-VERSION:2
      #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1255969,CODECS="avc1.77.31,mp4a.40.2",RESOLUTION=896x504
      /livetc/_definst_/mp4:livetc.mp4_source/playlist.m3u8?wowzasessionid=626634819
      #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=548873,CODECS="avc1.77.30,mp4a.40.2",RESOLUTION=640x360
      /livetc/_definst_/mp4:livetc.mp4_360p/playlist.m3u8?wowzasessionid=626634819
      #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=248873,CODECS="avc1.66.12,mp4a.40.2",RESOLUTION=284x160
      /livetc/_definst_/mp4:livetc.mp4_160p/playlist.m3u8?wowzasessionid=626634819


      and the single stream returns this:
      #EXTM3U
      #EXT-X-VERSION:2
      #EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=909315,CODECS="avc1.77.31, mp4a.40.2",RESOLUTION=896x504
      playlist.m3u8?wowzasessionid=18471989

      I can see some obvious differences in the paths but am not sure how to investigate further. Thanks!
    1. maven2 -
      I've set this up as instructed.

      http://itv.sg:1935/prerecord/smil:st...l/jwplayer.rss in my browser gives:

      <rss xmlns:media="http://search.yahoo.com/mrss/" xmlns:jwplayer="http://developer.longtailvideo.com/" version="2.0">
      <channel>
      <item>
      <title>streamschedule.smil</title>
      <description>streamschedule.smil</description>
      <jwplayer:streamer>rtmp://itv.sg:1935/prerecord/_definst_</jwplayer:streamer>
      <media:group></media:group>
      </item>
      </channel>
      </rss>

      But my JW Player gives a "Playlist not found" error.

      the JW Player is in the main public_html folder.
      the video files and streamschedule.smil file are in a folder /mv folder which is the <StorageDir> of the "prerecord" application.

      I've set the playlistfile on my site as http://itv.sg:1935/prerecord/smil:st...l/jwplayer.rss.

      Why am I still receiving this error?
    1. rrlanham -
      The .smil file used for the scheduler is not the same as the .smil used for multi-bitrate, or what is used to generate rss for JW Player RTMP Dynamic streaming.

      Take a look at this example:
      http://www.wowza.com/forums/content....-Multi-bitrate

      You will use the .smil in step #4 to generate the rss for JW Player.

      Richard
    1. 64vision -
      For VODS3.. Will I also place the smil file on amazon S3?
    1. rrlanham -
      Yes, right, in the same folder with the videos.

      Richard