Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

width setting is not working for jwplayer


I am embedding jwplayer on a liferay portal page. Below is the html and js part:

<div id="videoDisplay">Loading the player...</div>
<script type="text/javascript">
jwplayer("videoDisplay").setup({
playlist: [{
sources: [
{ file: "rtmp://IP:1935/live/test1.stream" },
{ file: "http://IP1935/live/test1.stream/playlist.m3u8" },
{ file: "rtsp://IP:1935/live/test1.stream" }
],
width: "380",
aspectratio: "16:9"
}]
}); </script>

The issue is the width does not have any affect. Below is the resulting html source:

<div id="videoDisplay-aspen1_wrapper" style="position: relative; display: block; width: 480px; height: 270px;">...</div>

video plays fine. just the width is working. my goal is to make it responsive by setting with to 100%, but it does not seem to have an affect no matter what i put in for the width.

I am using licensed locally hosted jwplayer.js version 6.12

thanks,

chuck

2 Community Answers

chuck

User  
0 rated :

answered my own question. just a typo in the javascript. the width property was set inside playlist, instead of after playlist. Should have been the following:

<script type="text/javascript">
jwplayer("videoDisplay").setup({
playlist: [{
sources: [
{ file: "rtmp://IP:1935/live/test1.stream" },
{ file: "http://IP1935/live/test1.stream/playlist.m3u8" },
{ file: "rtsp://IP:1935/live/test1.stream" }
]
}],
width: "380",
aspectratio: "16:9"
}); </script>

Todd

JW Player Support Agent  
0 rated :

Glad to see you caught that. I usually suggest to configure the player before defining the playlist or sources blocks, because yes, all the curly brackets and square brackets can get confusing. Indenting your code also helps, but I realize our forum might have removed those indents.

This question has received the maximum number of answers.