Solved

Advanced embed code - allow (or prefer) async support?

  • 12 January 2024
  • 5 replies
  • 98 views

Badge +2

When publishing a video, the advanced option provides a snippet along the lines of this:

<script src="https://players.brightcove.net/ACCOUNT_ID/PLAYER_ID_default/index.min.js"></script>

 

Does this support the “async”  attribute? If so - Can that be the noted in the embed code? This would greatly help on page load performance.

 

icon

Best answer by Tim Funk 17 January 2024, 19:18

View original

5 replies

Userlevel 1
Badge

Hi, Tim,

 

Thanks for bringing this interesting question to our attention.

 

We will need to investigate a little more to provide the correct details with you and probably an example. Can you help me open a ticket with our support team, please? We must review with our Players Team so a ticket is the best option here.

 

You can open it by sending an email with the details to bc_support@brightcove.com


Thanks for your cooperation, and have a great weekend.

Badge +2

(for future folks curious on status) Tracking as Case Number: 01523058

I know that there was a Brightcove Player loader on Github that would load async, but not sure if it is still active:

 

https://github.com/brightcove/player-loader

Badge +2

Here’s the answer: Yes

 

Reply from the engineering team per my open case:

The engineering team has confirmed that you can indeed add the "async" attribute to the JavaScript line in the embed code.

 

We’ll test this internally first to confirm and regression check our additional customizations

Badge +2

On further review, if you want an additional performance boost.  I discovered we did something similar in concept. The `$` assumes jQuery is loaded. 


 

$.getScript("//players.brightcove.net/ACCOUNT_ID/PLAYER_ID_default/index.min.js" , function() {

    // Run Additional code after script was loaded to decorate the player

});

 

So by using getScript - The library loading can be deferred even longer for interactive events to prove interaction with the page such as scrolling. (Especially when the video is not in the viewable area on load)

Reply