It would be nice to be able to control the preload attribute for audio and video tags in the field formatters.

Comments

Anonymous’s picture

Issue summary: View changes
recrit’s picture

Status: Active » Needs review
StatusFileSize
new1.7 KB

The attached patch adds support for the preload attribute to audio and video themes.

recrit’s picture

Updated patch: adds settings to the audio and video field formatters.

madhaze’s picture

Status: Needs review » Active

Thanks for the patch, I will be testing this one soon.

jurgenhaas’s picture

I have tested the patch from #3 which is working just fine.

recrit’s picture

Status: Active » Reviewed & tested by the community

switch back to the current status.

dave reid’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/file_entity.theme.inc
@@ -96,6 +96,12 @@ function theme_file_entity_file_audio($variables) {
+  if ($variables['preload']) {
+    $preload_value = drupal_strtolower($variables['preload']);
+    if (in_array($preload_value, array('none', 'auto', 'metadata'), FALSE)) {
+      $audio_attributes['preload'] = $preload_value;
+    }
+  }

Because the possible options are limited, I say let's remove this "validation" since it just adds extra effort when it's not necessary.

dave reid’s picture

Status: Needs work » Needs review
StatusFileSize
new4.8 KB

Simplified theme versions.

dave reid’s picture

StatusFileSize
new4.87 KB

Patch which makes 'unspecified' the default option, as to not change existing implementations. I think this is fairly safe considering that mobile browsers do not pre-fetch by default if the attribute is not defined.

dave reid’s picture

Status: Needs review » Fixed

Committed #9 to 7.x-2.x.

  • Dave Reid committed b6f4951 on 7.x-2.x
    Issue #2150679 by recrit, Dave Reid: Added the ability to for change the...

Status: Fixed » Closed (fixed)

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