JWplayer won't change source

2.8k views Asked by At

Background

I have a JWplayer setup which uses an SMIL file to list multiple sources for a RTMP stream. The list of sources for HTML5 playback (where RTMP is not supported) is not contained in the SMIL file.

The problem

When playing in Flash mode the video starts and automatically chooses a source and it works. But when you change the source manually the loading icon appears permanently and playback never starts. I have made sure that each source works by running the player with each source set as the only option and this is fine.

This problem does not happen during HTML5 playback.

Link http://www.streaming.co.uk/sam/homepagevids/coventry.htm

Source code

Javascript setup

<script type="text/javascript">

$(document).ready(JSetup());

function JSetup() 
{
    jwplayer("player").setup
        ({
            image: "http://hml.helixmedialibrary.net/thumbnails/71654317.jpg",
            sources:
            [
                { file: "SMIL/Coventry.smil"},

                { file: "http://helix.helixmedialibrary.net/flash/71654317_hi.mp4", label: "high" },
                { file: "http://helix.helixmedialibrary.net/flash/71654317_lo.mp4", label: "low" },
                { file: "http://helix.helixmedialibrary.net/flash/71654317_hi.mp4", label: "256k"}
            ],

            abouttext: "Andy Syson Interview",
            primary: "flash",
            width: "573",
            height: "410"
        });
}

</script>

SMIL setup

<smil>
  <head>
    <meta base="rtmp://helix.helixmedialibrary.net/flash"/>
  </head>
  <body>
    <switch>
      <video src="mp4:71654317_hd.mp4" system-bitrate="128" width="960" height="720" />
      <video src="mp4:71654317_hi.mp4" system-bitrate="128" width="480" height="480" />
      <video src="mp4:71654317_lo.mp4" system-bitrate="48" width="240" height="240" />
    </switch>
  </body>
</smil>

What is going on and how to fix this?

1

There are 1 answers

0
emaxsaun On

When using multiple sources, you need to have them in a playlist block.

For example - http://www.longtailvideo.com/support/jw-player/29394/hls-with-mp4-fallback

Sample code:

<div id="myElement"></div>

<script>
    jwplayer("myElement").setup({
      playlist: [{
        image: "/uploads/myPoster.jpg",
        sources: [{
          file: "/uploads/myManifest.m3u8"
        },{
          file: "/uploads/myFallback.mp4"
        }]
      }],
      primary: "flash"
    });
</script>

Just use SMIL, with a fallback to your MP4 files. It just needs to be in a singular playlist block.