The use of file_create_url($path) in videojs.theme.inc breaks video URLs if the filepath is an absolute URL to the current Drupal site or to an external server. This is an issue when manually invoking the theme('videojs', etc) and passing it a manually constructed array containing an absolute URL in the filepath.

When file_create_url is invoked, it checks whether the provided path doesn't start with the system file path on line 72 of file.inc:

  if (strpos($path, file_directory_path() . '/') !== 0) {
    return base_path() . $path;
  }

Absolute URLs will always return true for this check as they will never start with the file_directory_path(), and so this function appends the result of base_path() to the absolute URL. The result is something like: /http://example.com/path/to/video.mp4 (note the slash prepended to the URL)

This is currently breaking flash player fallback for videos loaded with absolute URLs due to the use of file_create_url() on line 151 of videojs.theme.inc. I'd suggest placing a check here for absolute URLs, and only call file_create_url if the path is relative:

  $vars['flash'] = (preg_match('/^(http|https):\/\//', $items_mp4[0]['filepath']))
    ? $items_mp4[0]['filepath']                   // absolute path
    : file_create_url($items_mp4[0]['filepath']); // relative path

Comments

Jorrit’s picture

Status: Active » Fixed

Fixed in 6.x-1.x, please test this in tomorrows -dev release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.