chetna123
chetna123

Reputation: 47

jwplayer player not working if playlist is added

i have following jwplayer code without playlist which works just fine but i want to add playlist on the rightside of player.

working jwplayer without playlist.

              <script type=\'text/javascript\'>
              jwplayer(\'player5PdfeedXun0ZaBZpa\').setup({
     file: \'http://www.xyz.com/mvideo/mv/'.$row2['url'].'\',
    image: \''.$row2['thumb'].'\',
    title: \''.$row2['title'].'\',
    width: \'60%\',
    aspectratio: \'16:9\',
    fallback: \'false\',
    autostart: \'true\'
    });
</script>

for adding playlist i am trying this as per jwplayer documentation but its not working.

            <script type=\'text/javascript\'>
        jwplayer(\'player5PdfeedXun0ZaBZpa\').setup({
    file: \'http://www.xyz.com/mvideo/mv/'.$row2['url'].'\',
    image: \''.$row2['thumb'].'\',
    title: \''.$row2['title'].'\',
    width: \'60%\',
    aspectratio: \'16:9\',
    fallback: \'false\',
    autostart: \'true\'

  playlist: [{
    image: \'heart.jpg\',
    file: \'/assets/sintel.mp4\',
    title: \'Sintel Movie Trailer\'
   },{
    image: \'hate.png\',
    file: \'/assets/bunny.mp4\',
    title: \'Big Buck Bunny Movie Trailer\'
}],
playlist.position:\'bottom\',
paylist.size:\'90\',
plugin:hd
   });  
   </script>

where i am doing mistake any idea???? when i add playlist then even player dont appear

Upvotes: 1

Views: 947

Answers (1)

hargobind
hargobind

Reputation: 592

According to this documentation, you are pretty close in your code. But there's a couple of things needed to get this working.

  1. For a playlist, you don't need the file, image, or title parameters since those are loaded from each track in the playlist.
  2. Your JavaScript is missing a comma after autostart: \'true\'
  3. The playlist.position and playlist.size parameters are the old way of doing things. Instead, use listbar.
  4. I see that you tried specifying plugins:hd. You don't need that line unless you specify HD versions of the videos. But if you want to use HD, check out the plugins documentation which shows how to use that parameter.

Here's the final code:

<script type=\'text/javascript\'>
jwplayer(\'player5PdfeedXun0ZaBZpa\').setup({
  width: \'60%\',
  aspectratio: \'16:9\',
  fallback: \'false\',
  autostart: \'true\',
  \'playlist\': [{
    image: \'heart.jpg\',
    file: \'/assets/sintel.mp4\',
    title: \'Sintel Movie Trailer\'
   },{
    image: \'hate.png\',
    file: \'/assets/bunny.mp4\',
    title: \'Big Buck Bunny Movie Trailer\'
  }],
  listbar: {
      position: \'bottom\',
      size: 90
  }
});
</script>

Upvotes: 1

Related Questions