Is there a way to apply a custom resolution to an Embedded Media Field: Video at the time of building a View? Alternatively, a way to define more than the just the Full / Preview presets?

1 Answer 1


You can set it in the template_preprocess_node()

depending on your view mode you can set the first element :

if ($vars['view_mode'] == "full") {

   $node->video_field_name[0]['#settings']['width'] = '300';
   $node->video_field_name[0]['#settings']['height'] = '150';


dont forget to set all elements, not just the first one

other settings you can set:

  controls (Boolean) TRUE
  width (String) 300
  height (String) 150
  download_link (Boolean) FALSE
  download_text (String) Download


template_preprocess_views_view_field is what you need for views probably. there you can access to the $vars['row'] with all data you need. maybe you will need to rerender the field.

If this does not work there is a workaround: the embedded-media-field sets its settings in the drupal js-settings. get the js settings with drupal_add_js(), find the element mediaelement and set the settings manually.

  • I'm outputting it from a View with Fields display, not a Node display, so if there's a preprocess function to handle this I'm not aware of it.
    – DanH
    Oct 2, 2011 at 14:19
  • template_preprocess_views_view_field, see edit... Oct 2, 2011 at 15:18
  • Well unfortunately I was unable to find the field object from within the variables provided to template_preprocess_views_view_field, no how to invoke a rerendering of the field. In the end I went real dirty and use preg_replace to alter the width/height.
    – DanH
    Oct 9, 2011 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.