To recreate: in a custom module pass videos to the theme function to render a proper HTML5 video with fallthrough to flash.

$items = array(
'mp4' => $node->field_video_h264[0],
'ogg' => $node->field_video_ogg[0],
'thumbnail' => $node->field_video_thumbnail[0],
);
$attributes = array(
'width' => 420,
'height' => 290,
'playlist' => TRUE,
);
$content = theme('videojs', $items, 'videojs-playerid', $attributes);

The resulting code rendered on the page will have something like this following:

<video>
  <source src="/path/to/file/on/server/video.mp4" type="video/mp4; codecs='avc1.42E01E, mp4a.40.2'">
  <source src="/path/to/file/on/server/video.ogv" type="video/ogg; codec='theora, vorbis'">
            <!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. -->
              <object width="420" height="290" type="application/x-shockwave-flash" data="http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf">
          <param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf">
          <param name="allowfullscreen" value="true">
          <param name="flashvars" value="config={'playlist': [ 'http://sitename.com/image.jpg', {'url': 'http://sitename.com/system/files/videos/video.mp4', 'autoPlay':false, 'autoBuffering':true} ]}">
          <embed id="flash-videojs-videojs-playerid" name="flash-videojs-videojs-playerid" src="http://releases.flowplayer.org/swf/flowplayer-3.2.5.swf" width="420" height="290" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" flashvars="config={'playlist': [ 'http://sitename.com/system/files/video-thumbnail.jpg', {'url': 'http://sitename.com/system/files/videos/video.mp4', 'autoPlay':false, 'autoBuffering':true} ]}">
          <!-- Image Fallback. Typically the same as the poster image. -->
          <img src="http://sitename.com/system/files/video-thumbnail.jpg" width="420" height="290" alt="Poster Image" title="No video playback capabilities.">
        </object>
      </video>
CommentFileSizeAuthor
#1 bad-urls-1162846-1.patch1008 byteslliss
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

lliss’s picture

FileSize
1008 bytes

The following patch seems to fix it. Looks like it was partially in place in the module but somehow got commented out.

tim.plunkett’s picture

Status: Active » Reviewed & tested by the community

Yeah, it definitely was strange with that commented out line. This patch looks good, and works well.

smira’s picture

i'm getting the following error
"warning: array_merge() [function.array-merge]: Argument #2 is not an array in /usr/share/nginx/icyou/sites/all/modules/videojs/includes/videojs.theme.inc on line 145."
on the video node with no video player present.
it looks like the error message points to the same line you patched but it doesn't seem to fix the issue.
Is this the same issue or am i way off?
thank you,
-miro

VM’s picture

Title: Bad URLs when using videojs_theme function in videojs.theme.inc » Bad URLs when using videojs_theme function in videojs.theme.inc - patch attached

title alter

VM’s picture

Version: 6.x-1.6 » 6.x-1.x-dev

moving to -dev as well

aethr’s picture

Might want to consider checking for absolute URLs when using file_create_url().

See #1282232: Use of file_create_path($path) breaks serving videos from external sites

Jorrit’s picture

Status: Reviewed & tested by the community » 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.