I'm getting the foloowing error: Apr 11 15:21:56 ip-10-64-31-83 drupal: http://www.matriu.com|1302549715|php|67.188.135.24|http://www.matriu.com/content/wildlife-movie|http://www.matriu.com/|0||Notice: Undefined offset: 0 in template_preprocess_videojs() (line 78 of /home/matriu/html/modules/videojs/includes/videojs.theme.inc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

naterockhold’s picture

I tested and the $items_mp4 array is empty so the offset of 0 fails while calling the file_create_url function.

mrfree’s picture

subscribe

michael.k’s picture

I'm also seeing this when I run cron with drush (along with another error):

/var/www/vhosts/example.org$ drush -v cron
Initialized Drupal 7.0 root directory at /var/www/vhosts/example.org [notice]
Initialized Drupal site default at sites/default [notice]
WD php: Notice: Undefined offset: 0 in template_preprocess_videojs() (line 78 of /var/www/vhosts/example.org/sites/all/modules/videojs/includes/videojs.theme.inc). [notice]
WD cron: Cron run completed. [notice]
... # transcoder error here
Cron run successfully. [success]
Command dispatch complete [notice]
/var/www/vhosts/example.org$

In the node I'm seeing the video but not the thumbnail. There's an annoying overlay of a question mark graphic, even though I sometimes see the thumbnail flash below it when the page renders.

BTW, I'm unable to upload a thumbnail of any type, but the FFmpeg conversion successfully creates a list with radio buttons and the selected one shows up properly in views lists.

robertPrs7’s picture

Just got VideoJS installed along with Video module. Created a file field video. Following install and creation of first video content on my site (silvermessenger.com/gestalt using drupal 7) - content was test_trailer.ogg video from VideoJS - I encountered two different error notices

On the dashboard:
Received the same error, but also an additional error on run of CRON.

Notice: Undefined offset: 0 in template_preprocess_videojs() (line 78 of /home/silverms/public_html/gestalt/sites/all/modules/videojs/includes/videojs.theme.inc).

On content page:

Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /home/silverms/public_html/gestalt/includes/entity.inc).

On home page:

• Notice: Undefined offset: 0 in template_preprocess_videojs() (line 78 of /home/silverms/public_html/gestalt/sites/all/modules/videojs/includes/videojs.theme.inc).
• Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of /home/silverms/public_html/gestalt/includes/entity.inc).

Daemon_Byte’s picture

subscribe

Daemon_Byte’s picture

subscribe

karlold’s picture

Hi Daemon

I have the same error as above the player does not see the video file, I have used various file to no avail, but I do not understand why you write "subscribe" in your comments. I am new to Drupal and I am unsure what this means, as surely the person is subscribed to Drupal.org to leave comments in the first place?

Please would you explain.

Thank you, Karl

Daemon_Byte’s picture

By writing subscribe it means I will get marked in this thread and any replies will show up in my dashboard. I just want to keep track of this issue as it's something I have been getting as well but not yet had the time to look into.

karlold’s picture

Daemon thank you. It's obvious now you've told me. Thanks.

rizenine’s picture

subscribe

rizenine’s picture

Looks like you will need either an flv or an mp4 attached. Not sure about the fix, but I believe that's what the code is looking for on line 78.

Not sure, but doesn't this fix it. Again I have not look it over much.

if (!isset($vars['flash']) && isset($items_mp4[0])) {
$vars['flash'] = file_create_url($items_mp4[0]['uri']);
}

gagarine’s picture

I run in the error when the field is empty. I don't think it should be solve in the processors. Process should certainly not run if we don't have any file.

EDIT
Quick fix: If the field is empty do nothing (videojs.module):

function videojs_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
    //if the field is empty do nothing
    if(empty($items)){
        return;
    }
...

I'm more to keep field managing multi-field as it's explain on http://api.drupal.org/api/drupal/modules--field--field.api.php/function/...
But perhaps is useful for doing playlist stuff.. (one player for more than one video)

knalstaaf’s picture

Subscribing.

knalstaaf’s picture

From the read-me:

(...) only allow the video HTML5 extension

.

What is the "HTML5 extension"? I know about the FLV-extension, MP4-extension, MOV-extension, ... but what is the HTML5 extension?

goldlilys’s picture

Subscribing

Errors i'm getting are:

Notice: Undefined offset: 0 in template_preprocess_videojs() (line 78 of htdocs/sites/all/modules/videojs/includes/videojs.theme.inc).
Notice: Undefined index: filemime in template_preprocess_videojs() (line 38 of htdocs/sites/all/modules/videojs/includes/videojs.theme.inc).
Notice: Undefined property: stdClass::$uri in file_validate_is_image() (line 1737 of htdocs/includes/file.inc).

Got the media working with videojs, but had to create a separate video field for either youtube or upload since videojs doesn't display YT videos.

cangeceiro’s picture

FileSize
1.74 KB

attached is a patch that removes the warning.

anand_s’s picture

Subscribe.

anand_s’s picture

Status: Active » Needs review
FileSize
1.68 KB

cangeceiro, that didn't work for me, but I've made some changes myself (attached) that did work for me, and fixed the error for good.

ann_morris’s picture

Subscribe

tyrusmanuel’s picture

subscribe

BPSistema’s picture

Status: Needs review » Fixed

Hi, we have solved the problem with the flv format:

at line 13, change codecs array with this:

$codecs = array(
    'video/mp4' => array(
      array('width' => '720', 'height' => '576', 'type' => "video/mp4; codecs='avc1.42E01E, mp4a.40.2'"), // Profile: Baseline, Level: 3.0
      array('width' => '1280', 'height' => '720', 'type' => "video/mp4; codecs='avc1.4D401F, mp4a.40.2'"), // Profile: Main, Level: 3.1
      array('width' => '1920', 'height' => '1088', 'type' => "video/mp4; codecs='avc1.640029, mp4a.40.2'"), // Profile: High, Level: 4.1
      array('width' => '2048', 'height' => '2048', 'type' => "video/mp4; codecs='avc1.58A033, mp4a.40.2'") // Profile: Extended, Level: 5.1
    ),
    'video/webm' => 'video/webm; codec="vp8, vorbis"',
    'application/octet-stream' => 'video/webm; codec="vp8, vorbis"',
    'video/ogg' => 'video/ogg; codec="theora, vorbis"',
    'application/ogg' => 'video/ogg; codec="theora, vorbis"',
    'video/quicktime' => 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"',
    'video/x-flv' => 'video/x-flv;'
  );

and at line 74 change "if statement" with this code:

     if ($item['filemime'] == 'video/x-flv') {
        $vars['flash'] = file_create_url($item['uri']);
        break;
      }

Status: Fixed » Closed (fixed)

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

Gurgel69’s picture

I just tried this fix, but it did not do anything.

When I look at the old file and the new it seams to be the same.
I uses version 7.x-1.10.

mducharme’s picture

Status: Closed (fixed) » Active

Still getting this warning in release and dev branches.

bradjones1’s picture

Status: Active » Needs review

This ticket appears to have gone a little off the rails. The goal here is to get a patch that fixes the problem and can be marked RTBC/committed against the -dev branch of the project. There's a patch in #18 which abated the "undefined offset" error outlined in the ticket summary - let's focus there.

The code snippet in #21 (I don't think) gets at the cause of this specific issue, and regardless would need to be rolled as a patch so others can evaluate it.

In that spirit I think the correct status is "needs review" - and if one or two others can check out the -dev copy and apply #18 against it, we can get this properly committed and closed.

timd.mackey’s picture

Confirmed that the patch in #18 fixed the "Undefined offset" error. (Using Drupal 7.10)

bradjones1’s picture

Status: Needs review » Reviewed & tested by the community
michael.k’s picture

Patch in #18 fixed the "undefined offset" error for me, too.

Jorrit’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in 7.x-1.x.

Status: Fixed » Closed (fixed)

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

hendry.a’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev

subscribe

Hi Everyone,
I'm face problem at videojs version 7.x.2.x (patch #16, patch #18, and code at #21 seem doesn't work):

  • Notice: Undefined index: filemime in template_preprocess_videojs() (line 32 of C:\xampp-win32-1.7.7-VC9\xampp\htdocs\mydrupal\sites\all\modules\videojs\includes\videojs.theme.inc).
  • Notice: Undefined property: stdClass::$uri in file_validate_is_image() (line 1746 of C:\xampp-win32-1.7.7-VC9\xampp\htdocs\mydrupal\includes\file.inc).
  • Notice: Undefined index: filemime in template_preprocess_videojs() (line 32 of C:\xampp-win32-1.7.7-VC9\xampp\htdocs\mydrupal\sites\all\modules\videojs\includes\videojs.theme.inc).
  • Notice: Undefined property: stdClass::$uri in file_validate_is_image() (line 1746 of C:\xampp-win32-1.7.7-VC9\xampp\htdocs\mydrupal\includes\file.inc).

can anyone help me about this problem? thank you.

Jorrit’s picture

This was a bug in the Video module. Please try the next 7.x-2.x-dev version of the Video module.