I just tried to embed videojs with the help of the sample provided on the module page - for non techies it's hard to understand. I got it working, because i looked in theme files and found out the right structure - maybe we should provide a more complete example.

I just created a gist for it - https://gist.github.com/1234342

SteffenR

Comments

kris_mcl’s picture

Thanks SteffenR, that's really helpful to see a clear example of how to use this great module. Schönen Dank!

Jorrit’s picture

Assigned: Unassigned » Jorrit

I'll try to improve the docs, also because I added more settings.

scarvajal’s picture

Edit: oops sorry posted on wrong version, it happen to me un drupal 7.

With this code:

// You can use theme function from other modules.
// $items are list of files (You can add your image file there too)
$file_mp4['filename'] ='test.mp4';
$file_mp4['filemime'] = 'video/mp4';
$file_mp4['filepath'] = 'sites/default/files/videos/test.mp4';

$items['mp4'] = $file_mp4;
$attributes['width'] = 640;
$attributes['height'] = 380;
print theme('videojs', $items, 'videojs-header', $attributes);

I got:

Warning: Invalid argument supplied for foreach() in template_preprocess_videojs() (line 36 of /home/inteline/public_html/mytube/sites/all/modules/videojs/includes/videojs.theme.inc).
Notice: Undefined offset: 0 in template_preprocess_videojs() (line 79 of /home/inteline/public_html/mytube/sites/all/modules/videojs/includes/videojs.theme.inc).

Is my "print theme" line correct?

Jorrit’s picture

Status: Active » Postponed (maintainer needs more info)

Your code seems correct. Do you still experience those errors?

Jorrit’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Closed because of lack of response.

sqeph’s picture

For D7, I believe it should be...

// You can use theme function from other modules.
// $items are list of files (You can add your image file there too)
$file_mp4['filename'] ='test.mp4';
$file_mp4['filemime'] = 'video/mp4';
$file_mp4['filepath'] = 'sites/default/files/videos/test.mp4';

$items['mp4'] = $file_mp4;
$attributes['width'] = 640;
$attributes['height'] = 380;

print theme('videojs', array('items' => $items, 'player_id' => 'videojs-header', 'attributes' => $attributes);