From b8414442e06ac7af321343c5a568eac2574528ab Mon Sep 17 00:00:00 2001 From: Jon Gilkison Date: Thu, 7 Apr 2022 18:36:38 +0700 Subject: [PATCH] * **IMPORTANT**: This release has a breaking change if you are using the **Mux/Video Encoding** feature. If you are using the video.js or hls.js video player, you will need to enable the separate *Video Player* feature to continue using those players. There will be a notification in WordPress admin warning you about this, but only if it applies to you. * Upgraded video.js player to latest 7.19.0 * Upgraded hls.js player to latest 1.1.5 * Separated the video player into it's own feature from the video encoding feature. * Video player now supports playing any uploaded videos, not just Mux encoded videos. * You can now allow video downloads for logged in users only in *Video Player Settings* * The Video Player gutenberg block allows you to override the download setting for an individual video. * Filmstrip generation can now be enabled regardless of video player in use. --- classes/Tools/ToolsManager.php | 1 + classes/Tools/Video/Driver/Mux/MuxHooks.php | 55 --- classes/Tools/Video/Driver/Mux/MuxTool.php | 123 +----- .../VideoPlayerShortcode.php} | 64 ++- .../Tools/Video/Player/VideoPlayerTool.php | 265 ++++++++++++ .../Player/VideoPlayerToolProSettings.php | 52 +++ .../Video/Player/VideoPlayerToolSettings.php | 32 ++ config/video-encoding.config.php | 15 +- config/video-player.config.php | 40 ++ config/video-player.pro.config.php | 138 ++++++ ilab-media-tools.php | 5 +- .../blocks/mediacloud-mux.blocks.editor.css | 1 - public/blocks/mediacloud-mux.blocks.js | 1 - public/blocks/mediacloud-mux.blocks.style.css | 1 - .../blocks/mediacloud-video-block/block.json | 99 +++++ .../mediacloud-video-block/index.asset.php | 1 + .../blocks/mediacloud-video-block/index.css | 1 + public/blocks/mediacloud-video-block/index.js | 1 + .../mediacloud-video-block/style-index.css | 1 + public/img/icon-cloud-w-type.svg | 2 +- public/js/ilab-media-grid.js | 2 +- public/js/mcloud-admin.js | 2 +- public/js/mcloud-reports.js | 16 +- public/js/mux-admin.js | 2 +- public/js/mux-hls.js | 393 +++++++++++++++--- public/js/mux-player.js | 2 +- public/js/videojs-player-data.js | 22 +- public/js/videojs-player.js | 22 +- readme.txt | 15 +- ...e.php => video-shortcode-editor.blade.php} | 4 +- views/admin/video/filmstrip.blade.php | 0 views/admin/video/subtitles-manager.blade.php | 0 32 files changed, 1075 insertions(+), 303 deletions(-) rename classes/Tools/Video/{Driver/Mux/MuxShortcode.php => Player/VideoPlayerShortcode.php} (57%) create mode 100644 classes/Tools/Video/Player/VideoPlayerTool.php create mode 100644 classes/Tools/Video/Player/VideoPlayerToolProSettings.php create mode 100644 classes/Tools/Video/Player/VideoPlayerToolSettings.php create mode 100644 config/video-player.config.php create mode 100644 config/video-player.pro.config.php delete mode 100644 public/blocks/mediacloud-mux.blocks.editor.css delete mode 100644 public/blocks/mediacloud-mux.blocks.js delete mode 100644 public/blocks/mediacloud-mux.blocks.style.css create mode 100644 public/blocks/mediacloud-video-block/block.json create mode 100644 public/blocks/mediacloud-video-block/index.asset.php create mode 100644 public/blocks/mediacloud-video-block/index.css create mode 100644 public/blocks/mediacloud-video-block/index.js create mode 100644 public/blocks/mediacloud-video-block/style-index.css rename views/admin/{mux-video-shortcode-editor.blade.php => video-shortcode-editor.blade.php} (97%) create mode 100644 views/admin/video/filmstrip.blade.php create mode 100644 views/admin/video/subtitles-manager.blade.php diff --git a/classes/Tools/ToolsManager.php b/classes/Tools/ToolsManager.php index 99f1c08e..06c2e9c7 100644 --- a/classes/Tools/ToolsManager.php +++ b/classes/Tools/ToolsManager.php @@ -336,6 +336,7 @@ public static function Boot() ToolsManager::registerTool( "storage", include ILAB_CONFIG_DIR . '/storage.config.php' ); ToolsManager::registerTool( "imgix", include ILAB_CONFIG_DIR . '/imgix.config.php' ); ToolsManager::registerTool( "video-encoding", include ILAB_CONFIG_DIR . '/video-encoding.config.php' ); + ToolsManager::registerTool( "video-player", include ILAB_CONFIG_DIR . '/video-player.config.php' ); ToolsManager::registerTool( "vision", include ILAB_CONFIG_DIR . '/vision.config.php' ); ToolsManager::registerTool( "crop", include ILAB_CONFIG_DIR . '/crop.config.php' ); ToolsManager::registerTool( "debugging", include ILAB_CONFIG_DIR . '/debugging.config.php' ); diff --git a/classes/Tools/Video/Driver/Mux/MuxHooks.php b/classes/Tools/Video/Driver/Mux/MuxHooks.php index 4c8087f8..9656cd67 100644 --- a/classes/Tools/Video/Driver/Mux/MuxHooks.php +++ b/classes/Tools/Video/Driver/Mux/MuxHooks.php @@ -60,12 +60,6 @@ public function __construct() } add_filter( 'template_include', [ $this, 'handleWebhook' ] ); - add_filter( - 'render_block', - [ $this, 'filterBlocks' ], - PHP_INT_MAX - 1, - 2 - ); } //endregion @@ -717,54 +711,5 @@ public function handleUpload( $attachmentId, $file, $meta ) { $this->handleDirectUpload( $attachmentId, $meta ); } - - //endregion - //region Content Filters - /** - * Filters the File block to include the goddamn attachment ID - * - * @param $block_content - * @param $block - * - * @return mixed - * @throws \Exception - */ - function filterBlocks( $block_content, $block ) - { - if ( isset( $block['blockName'] ) ) { - if ( $block['blockName'] === 'media-cloud/mux-video-block' ) { - return $this->filterVideoBlock( $block_content, $block ); - } - } - return $block_content; - } - - protected function filterVideoBlock( $block_content, $block ) - { - $muxId = arrayPath( $block, 'attrs/muxId', null ); - $asset = MuxAsset::asset( $muxId ); - - if ( $asset !== null ) { - $classes = "mux-player"; - $extras = ""; - $metadata = []; - $metadataKey = sanitize_title( gen_uuid( 12 ) ); - if ( !empty($this->settings->playerCSSClasses) ) { - $classes .= " {$this->settings->playerCSSClasses}"; - } - $block_content = str_replace( '