1

Following up this question on SO, I am looking to change the default DIV container name that JWplayer provides to JWPlayer Div. The problem is that it starts with a numeric and that creates loading problems.

Is there a way, I can customize this JWPlayer ID ?

This is how it looks btw,

jwplayer('141ef7fe77391234fc105767808cc0a5').setup({"file":"my_video.mp4",
      "width":"838","height":"383","controlbar":"none",
      "modes":[{"type":"html5"},{"type":"flash","src":"http://path/jwplayer/player.swf"}]});
Community
  • 1
  • 1
Steve
  • 2,546
  • 8
  • 49
  • 94

1 Answers1

0

While you're at it, here is a quick solution to it.

Since this is a fix for Drupal JWPlayer Module, do the following:-

  • Go to jw_player module folder and open theme folder.
  • Open jw_player.tpl.php and add the following line on top (probably where PHP declaration starts).
$html_id = "myvideo". $html_id;

It kinda does the job but I am sure you guys have better solutions than this. Please feel free to comment.

Found a better solution

Don't do upper suggestion. Paste the following code in jw_player.module instead.

Find this line $variables['html_id'] = md5(rand()); (I guess line 308) and uncomment it before pasting the following code instead.

while(1) {

      $variables['html_id'] = md5(rand());
      if (ctype_alpha(substr($variables['html_id'], 0, 1))) {
        //echo "First Digit is Alphabet";
        break;
      }

  }

Thanks.

Steve
  • 2,546
  • 8
  • 49
  • 94
  • Ah, great, glad you got it! – emaxsaun Jun 20 '14 at 16:05
  • Both solution are terrible. You suggest hacking the JW Player module. Any changes will be reverted when the module is updated. Latest version of the module don't use `md5(rand()` as `html_id` so I assume the problem is now fixed. – Pierre Buyle Nov 17 '16 at 12:11
  • Do you have a better solution? If yes, please post it here. We all would love to know – Steve Nov 17 '16 at 22:39