# jetpack/16.3-a.7/modules/shortcodes/js/brightcove.js

Jetpack – WP Security, Backup, Speed, &amp; Growth, version 16.3-a.7. 30 lines.

- Page: https://pluginprobe.com/plugins/jetpack/16.3-a.7/code/modules/shortcodes/js/brightcove.js
- Raw: https://pluginprobe.com/plugins/jetpack/16.3-a.7/raw/modules/shortcodes/js/brightcove.js
- Modified: 2020-07-28T17:06:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/jetpack/16.3-a.7/code/modules/shortcodes/js/brightcove.js#L10-L20`.

```javascript
/* global brightcove, brightcoveData */
( function ( $ ) {
	var script = document.createElement( 'script' ),
		tld = 'co.jp' === brightcoveData.tld ? 'co.jp' : 'com',
		timer = false;

	// Load Brightcove script
	script.src = 'https://sadmin.brightcove.' + tld + '/js/BrightcoveExperiences.js';
	script.type = 'text/javascript';
	script.language = 'JavaScript';
	document.head.appendChild( script );

	// Start detection for Brightcove script loading in its object
	try_brightcove();

	// Detect if Brightcove script has loaded and bind some events once loaded
	function try_brightcove() {
		clearTimeout( timer );

		if ( 'object' === typeof brightcove ) {
			$( document ).ready( brightcove.createExperiences );
			$( 'body' ).on( 'post-load', brightcove.createExperiences );

			brightcove.createExperiences();
		} else {
			timer = setTimeout( try_brightcove, 100 );
		}
	}
} )( jQuery );

```
