Render-blocking resources
The <script>
for brightcove gets loaded inline within the body of the page content. The loading and execution of scripts that are not necessary for the initial page render may be deferred until after the initial render or other critical parts of the page have finished loading.
Currently the script
is loaded from: https://git.drupalcode.org/project/brightcove/-/blob/7.x-7.x/brightcove-...
The goal is to reduce the impact of the render-blocking JS by deferring the resources by adding async
attribute
Script loading can be updated as below
<script async src="//players.brightcove.net/<?php print $account_id; ?>/<?php print $player_id; ?>_<?php print $embed; ?>/index.min.js"></script>
Another option would be to load the JS using drupal_add_js
, which can be done in the template_preprocess_brightcove_field_embed
function brightcove_preprocess_brightcove_field_embed(&$variables) {
$variables['data_usage'] = 'cms:drupal:' . VERSION . ':' . system_get_info('module', 'brightcove')['version'] . ':javascript';
$script_url = '//players.brightcove.net/' . $variables['account_id'] . '/' . $variables['player_id'] . '_' . $variables['embed'] . '/index.min.js';
drupal_add_js($script_url, 'external');
}
Closed: outdated
6.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.