Problem/Motivation

Want to have automatically updated JWplayer library.

Proposed resolution

Load the JWPlayer library directly from CDN when an account key is set.

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tonnosf’s picture

Status: Active » Needs review
FileSize
1.3 KB

Done follow changes:
- JWPlayer load first from CDN when account key is set
- Removed base setting when load from CDN

Status: Needs review » Needs work

The last submitted patch, 1: jw-player-2430231-1.patch, failed testing.

Berdir’s picture

+++ b/jw_player.module
@@ -129,8 +135,14 @@ function jw_player_library_info_alter(&$libraries, $extension) {
   if ($info['installed']) {
+    if ($account_token = $config->get('account_token')) {
+      // Cloud hosted player, use external JavaScript.
+      $libraries['jwplayer']['js']["//jwpsrv.com/library/{$account_token}.js"] = array(
+        'type' => 'external',
+      );
+    }

This condition already exists, below. Was confused a bit, but I see it now, it also use external when a local version is present when account token is set.

In that case, instead of adding it a second time, you should move the elseif below above if ($info['installed'] and make that the elseif.

Also, the test needs a slight adjustment now, the base part needs to be removed from the expected configuration.

tonnosf’s picture

Status: Needs work » Active
tonnosf’s picture

Assigned: tonnosf » Unassigned
Status: Active » Needs review
FileSize
2.8 KB

Done follow changes:
- Unset base setting when an account token is set
- Add CDN load as first condition before if ($info['installed'])
- Removed jwplayer base setting in test

  • Berdir committed 3b6c171 on 8.x-1.x authored by tonnosf
    Issue #2430231 by tonnosf: Load JWPlayer from CDN
    
Berdir’s picture

Status: Needs review » Fixed

Thanks, looks good now, committed.

Perignon’s picture

Very interesting. This did not exist about six months ago when I started on a new project to build a specialized JW Player. I was creating a custom module then I decided to start a sandbox here to see if anyone else would be interesting. I take the CDN loading to an extreme loading everything about the videos off CDN to include the videos themselves all using signed cloudfront URLS. It's an extreme use case. You can see what I am working on here:
https://www.drupal.org/sandbox/perignon/2396521

I will have development of the module completed within 30 days as I have a deadline to meet with a client that requires it.

Let me know what you think. My plan was to reach out to you guys to see if there are any synergies between us. I have borrowed a lot of code from your module.

Status: Fixed » Closed (fixed)

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