Skip to content

Commit

Permalink
Merge pull request #339 from 10up/develop
Browse files Browse the repository at this point in the history
Release 2.8.3
  • Loading branch information
oscarssanchez authored Aug 3, 2023
2 parents bd7ba98 + ac29bc8 commit b52c928
Show file tree
Hide file tree
Showing 17 changed files with 23,084 additions and 2,205 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: E2E test

env:
NODE_VERSION: "12"
NODE_VERSION: "16"

on:
push:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install node v12
- name: install node v16
uses: actions/setup-node@v2
with:
node-version: 12
node-version: 16
- name: npm install
run: npm install
- name: eslint
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file, per [the Ke

## [Unreleased] - TBD

## [2.8.3] - 2022-08-03

### Fixed
- Playlist experience not rendering correctly in frontend
- Prevent API calls when Brightcove has not been configured yet
- Customization options hidden when switching embed type in in-page experiences

## [2.8.2] - 2022-03-16

### Fixed
Expand Down Expand Up @@ -411,6 +418,7 @@ All notable changes to this project will be documented in this file, per [the Ke
- First release

[Unreleased]: https://github.com/10up/brightcove-video-connect/compare/master...develop
[2.8.3]: https://github.com/10up/brightcove-video-connect/compare/2.8.2...2.8.3
[2.8.2]: https://github.com/10up/brightcove-video-connect/compare/2.8.1...2.8.2
[2.8.1]: https://github.com/10up/brightcove-video-connect/compare/2.8.0...2.8.1
[2.8.0]: https://github.com/10up/brightcove-video-connect/compare/2.7.0...2.8.0
Expand Down
6 changes: 3 additions & 3 deletions assets/js/brightcove-admin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion assets/js/brightcove-admin.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion assets/js/brightcove-admin.min.js

Large diffs are not rendered by default.

132 changes: 68 additions & 64 deletions assets/js/src/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,24 +356,63 @@
},
];
}, []);
const muteField = (autoplay) => {
const field = el(components.CheckboxControl, {
label: __('Mute', 'brightcove'),
checked: mute !== '' || autoplay !== '',
onChange: function (value) {
props.setAttributes({
...props.attributes,
mute: value && 'muted',
});
},
});

if (autoplay === 'autoplay') {
return el(components.Disabled, { style: { marginBottom: '24px' } }, field);
}
return field;
};

const playsinlineField = (autoplay) => {
const field = el(components.CheckboxControl, {
label: __('Plays in line', 'brightcove'),
checked: playsinline !== '' || autoplay !== '',
onChange: function (value) {
props.setAttributes({
...props.attributes,
playsinline: value && 'playsinline',
});
},
});

if (autoplay === 'autoplay') {
return el(components.Disabled, { style: { marginBottom: '24px' } }, field);
}
return field;
};

const isExperience = inPageExperienceId || experienceId;

let embedStyleOptions = [{ label: __('iFrame', 'brightcove'), value: 'iframe' }];
embedStyleOptions = playlistId
? [
...embedStyleOptions,
{
label: __('JavaScript Horizontal', 'brightcove'),
value: 'in-page-horizontal',
},
{
label: __('JavaScript Vertical', 'brightcove'),
value: 'in-page-vertical',
},
]
: [
{ label: __('JavaScript', 'brightcove'), value: 'in-page' },
...embedStyleOptions,
];

embedStyleOptions =
playlistId && !isExperience
? [
...embedStyleOptions,
{
label: __('JavaScript Horizontal', 'brightcove'),
value: 'in-page-horizontal',
},
{
label: __('JavaScript Vertical', 'brightcove'),
value: 'in-page-vertical',
},
]
: [
{ label: __('JavaScript', 'brightcove'), value: 'in-page' },
...embedStyleOptions,
];

const sizingField = el(components.RadioControl, {
label: __('Sizing', 'brightcove'),
Expand All @@ -393,28 +432,6 @@
},
});

const muteField = el(components.CheckboxControl, {
label: __('Mute', 'brightcove'),
checked: mute !== '' || autoplay !== '',
onChange: function (value) {
props.setAttributes({
...props.attributes,
mute: value && 'muted',
});
},
});

const playsinlineField = el(components.CheckboxControl, {
label: __('Plays in line', 'brightcove'),
checked: playsinline !== '' || autoplay !== '',
onChange: function (value) {
props.setAttributes({
...props.attributes,
playsinline: value && 'playsinline',
});
},
});

const embedStyleField = el(components.RadioControl, {
label: __('Embed Style', 'brightcove'),
selected: embed,
Expand All @@ -427,8 +444,6 @@
},
});

const isExperience = inPageExperienceId || experienceId;

return [
userPermission ? controls : '',
el('iframe', {
Expand Down Expand Up @@ -489,20 +504,8 @@
});
},
}),
!isExperience && autoplay === 'autoplay'
? el(
components.Disabled,
{ style: { marginBottom: '24px' } },
muteField,
)
: muteField,
!isExperience && autoplay === 'autoplay'
? el(
components.Disabled,
{ style: { marginBottom: '24px' } },
playsinlineField,
)
: playsinlineField,
!isExperience && muteField(autoplay),
!isExperience && playsinlineField(autoplay),
!playlistId &&
!isExperience &&
el(components.CheckboxControl, {
Expand All @@ -515,16 +518,17 @@
});
},
}),
el(components.CheckboxControl, {
label: __('Enable Language Detection', 'brightcove'),
checked: languageDetection,
onChange: function (value) {
props.setAttributes({
...props.attributes,
language_detection: value && 'languagedetection',
});
},
}),
!isExperience &&
el(components.CheckboxControl, {
label: __('Enable Language Detection', 'brightcove'),
checked: languageDetection,
onChange: function (value) {
props.setAttributes({
...props.attributes,
language_detection: value && 'languagedetection',
});
},
}),
languageDetection === 'languagedetection' ||
pictureinpicture === 'pictureinpicture'
? el(
Expand Down
2 changes: 1 addition & 1 deletion assets/js/src/models/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ var UploadModel = Backbone.Model.extend({
var k = 1000;
var sizes = ['Bytes', 'KB', 'MB', 'GB'];
var i = Math.floor(Math.log(bytes) / Math.log(k));
return (bytes / Math.pow(k, i)).toPrecision(3) + ' ' + sizes[i];
return (bytes / k ** i).toPrecision(3) + ' ' + sizes[i];
},
});
4 changes: 2 additions & 2 deletions assets/js/src/views/media-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ var MediaDetailsView = BrightcoveView.extend({
$sizingField.show();
$sizingDiv.show();

if ($sizing === 'responsive' && $embedStyle === 'javascript') {
if ($sizing === 'responsive' && $embedStyle === 'in-page') {
$height.attr('readonly', true);
} else if ($sizing === 'fixed' && $embedStyle === 'javascript') {
} else if ($sizing === 'fixed' && $embedStyle === 'in-page') {
$height.removeAttr('readonly');
$width.removeAttr('readonly');
} else {
Expand Down
5 changes: 2 additions & 3 deletions brightcove-video-connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Brightcove Video Connect
* Plugin URI: https://wordpress.org/plugins/brightcove-video-connect/
* Description: A Brightcove™ Connector for WordPress that leverages enhanced APIs and Brightcove™ Capabilities
* Version: 2.8.2
* Version: 2.8.3
* Author: 10up
* Author URI: http://10up.com
* License: GPLv2+
Expand Down Expand Up @@ -31,7 +31,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 021.0.2301 USA
*/

define( 'BRIGHTCOVE_VERSION', '2.8.2' );
define( 'BRIGHTCOVE_VERSION', '2.8.3' );
define( 'BRIGHTCOVE_URL', plugin_dir_url( __FILE__ ) );
define( 'BRIGHTCOVE_PATH', dirname( __FILE__ ) . '/' );
define( 'BRIGHTCOVE_BASENAME', plugin_basename( __FILE__ ) );
Expand All @@ -52,7 +52,6 @@ function brightcove_activate() {
* Uninstall routines should be in uninstall.php
*/
function brightcove_deactivate() {

BC_Utility::deactivate();
}

Expand Down
4 changes: 2 additions & 2 deletions includes/admin/class-bc-templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ class="brightcove-datetime brightcove-end-date"
<?php esc_html_e( 'Embed Style: ', 'brightcove' ); ?>
</label>
<div class="right-col">
<input type="radio" value="javascript" id="embed-style-in-page" checked name="embed-style"><?php esc_html_e( 'JavaScript', 'brightcove' ); ?>
<input type="radio" value="in-page" id="embed-style-in-page" checked name="embed-style"><?php esc_html_e( 'JavaScript', 'brightcove' ); ?>
<input type="radio" value="iframe" id="embed-style-iframe" name="embed-style"><?php esc_html_e( 'iFrame', 'brightcove' ); ?>
</div>

Expand Down Expand Up @@ -986,7 +986,7 @@ class="brightcove-datetime brightcove-end-date"
<?php esc_html_e( 'Embed Style: ', 'brightcove' ); ?>
</label>
<div class="right-col">
<input type="radio" value="javascript" id="embed-style-in-page" checked name="embed-style"><?php esc_html_e( 'JavaScript', 'brightcove' ); ?>
<input type="radio" value="in-page" id="embed-style-in-page" checked name="embed-style"><?php esc_html_e( 'JavaScript', 'brightcove' ); ?>
<input type="radio" value="iframe" id="embed-style-iframe" name="embed-style"><?php esc_html_e( 'iFrame', 'brightcove' ); ?>
</div>

Expand Down
57 changes: 34 additions & 23 deletions includes/class-bc-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,28 @@ public static function action_init() {

// Load Administrative Resources.
if ( BC_Utility::current_user_can_brightcove() ) {

require_once BRIGHTCOVE_PATH . 'includes/admin/api/class-bc-admin-media-api.php';
require_once BRIGHTCOVE_PATH . 'includes/admin/class-bc-admin-settings-page.php';
require_once BRIGHTCOVE_PATH . 'includes/admin/class-bc-admin-labels-page.php';
require_once BRIGHTCOVE_PATH . 'includes/admin/class-bc-admin-playlists-page.php';
require_once BRIGHTCOVE_PATH . 'includes/admin/class-bc-admin-videos-page.php';
require_once BRIGHTCOVE_PATH . 'includes/admin/class-bc-admin-sources.php';
require_once BRIGHTCOVE_PATH . 'includes/admin/class-bc-admin-user-profile.php';
require_once BRIGHTCOVE_PATH . 'includes/admin/class-bc-templates.php';

// Load Brightcove API resources.
new BC_Admin_Media_API();
new BC_Admin_Settings_Page();
new BC_Admin_Labels_Page();
new BC_Admin_Playlists_Page();
new BC_Admin_Videos_Page();
new BC_Admin_Sources();
new BC_Admin_Templates();
new BC_Admin_User_Profile();

if ( get_option( '_brightcove_accounts' ) ) {
require_once BRIGHTCOVE_PATH . 'includes/admin/class-bc-admin-labels-page.php';
require_once BRIGHTCOVE_PATH . 'includes/admin/class-bc-admin-playlists-page.php';
require_once BRIGHTCOVE_PATH . 'includes/admin/class-bc-admin-videos-page.php';

require_once BRIGHTCOVE_PATH . 'includes/admin/class-bc-admin-user-profile.php';
require_once BRIGHTCOVE_PATH . 'includes/admin/class-bc-templates.php';
require_once BRIGHTCOVE_PATH . 'includes/admin/api/class-bc-admin-media-api.php';
add_action( 'admin_enqueue_scripts', array( 'BC_Setup', 'brightcove_enqueue_assets' ) );
// Load Brightcove API resources.
new BC_Admin_Media_API();
new BC_Admin_Labels_Page();
new BC_Admin_Playlists_Page();
new BC_Admin_Videos_Page();
new BC_Admin_Templates();
new BC_Admin_User_Profile();
}
}

new BC_Playlists();
Expand Down Expand Up @@ -334,22 +337,22 @@ public static function preload_params() {
$params['mimeTypes'] = BC_Utility::get_all_brightcove_mimetypes();

$default_account = $bc_accounts->get_account_details_for_user();
$params['defaultAccount'] = $default_account['hash'];
$params['defaultAccountId'] = $default_account['account_id'];
$params['defaultAccount'] = ! empty( $default_account['hash'] ) ? $default_account['hash'] : '';
$params['defaultAccountId'] = ! empty( $default_account['account_id'] ) ? $default_account['account_id'] : '';

return $params;

}

/**
* Enqueue the admin scripts and styles.
* Enqueue brightcove functionality dependent assets.
*
* @return void
*/
public static function admin_enqueue_scripts() {

public static function brightcove_enqueue_assets() {
global $wp_version;

// Use minified libraries if SCRIPT_DEBUG is turned off.
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
$suffix = BC_Utility::get_suffix();

$player_api = new BC_Player_Management_API2();
$players = $player_api->get_all_players();
Expand Down Expand Up @@ -412,6 +415,14 @@ public static function admin_enqueue_scripts() {
} else {
wp_enqueue_media();
}
}

/**
* Enqueue the admin scripts and styles.
*/
public static function admin_enqueue_scripts() {
// Use minified libraries if SCRIPT_DEBUG is turned off.
$suffix = BC_Utility::get_suffix();

wp_register_style( 'brightcove-video-connect', esc_url( BRIGHTCOVE_URL . 'assets/css/brightcove_video_connect' . $suffix . '.css' ), array(), BRIGHTCOVE_VERSION );
wp_enqueue_style( 'brightcove-video-connect' );
Expand All @@ -424,7 +435,7 @@ public static function admin_enqueue_scripts() {
*/
public static function frontend_enqueue_scripts() {
// Use minified libraries if SCRIPT_DEBUG is turned off.
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
$suffix = BC_Utility::get_suffix();

wp_enqueue_style( 'brightcove-pip-css', 'https://players.brightcove.net/videojs-pip/1/videojs-pip.css', [], BRIGHTCOVE_VERSION );
wp_register_style( 'brightcove-playlist', BRIGHTCOVE_URL . 'assets/css/brightcove_playlist' . $suffix . '.css', array(), BRIGHTCOVE_VERSION );
Expand Down
Loading

0 comments on commit b52c928

Please sign in to comment.