Plugin Directory

Changeset 3167577


Ignore:
Timestamp:
10/12/2024 01:41:07 PM (18 months ago)
Author:
r00tsector
Message:

Update to version 1.0.10 from GitHub

Location:
hls-player
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • hls-player/tags/1.0.10/Readme.txt

    r3121654 r3167577  
    66Tested up to: 6.6
    77Requires PHP: 8.1
    8 Stable tag: 1.0.9
     8Stable tag: 1.0.10
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0
     
    8383`[hls_player url="https://example.com/path/to/video_playlist.m3u8" muted="true"]`
    8484
    85 **captions**: Add captions or subtitles to the video in multiple languages. Provide the captions in the format: `"path/to/captions1.vtt|lang1|label1|default,path/to/captions2.vtt|lang2|label2"`.
    86 provide the lang in two character language code format. For example de-de, en-us
     85**captions**: Add captions or subtitles to the video in multiple languages. Provide the captions in the format:
    8786
    88 `[hls_player url="https://example.com/path/to/video_playlist.m3u8" captions="path/to/captions-en.vtt|en-EN|English,path/to/captions-es.vtt|en-us|English|default"]`
     87`"path/to/captions1.vtt|lang1|label1|default,path/to/captions2.vtt|lang2|label2"`
     88
     89path/to/captions: The URL or path to the VTT file containing the subtitles.
     90lang: The two-character language code, followed by a hyphen and an optional country code (e.g., en, de, en-US, de-DE).
     91label: A user-friendly label for the caption (e.g., "English", "German").
     92default: (Optional) Use this keyword to specify which caption should be enabled by default when the video is loaded.
     93
     94`[hls_player url="https://example.com/path/to/video_playlist.m3u8" captions="https://example.com/path/to/captions-en.vtt|en-EN|English|default,https://example.com/path/topath/to/captions-de.vtt|de-de|German"]`
    8995
    9096**videojs_custom_options_json**: JSON format string for custom options (https://videojs.com/guides/options/) for the video.js player.
     
    129135
    130136== Changelog ==
     137= 1.0.10 =
     138* Fixed: Improved captions functionality in the shortcode to clarify language codes and default settings for better user experience.
     139
    131140= 1.0.9 =
    132141* Added: Wordpress v6.6 compatibility
  • hls-player/tags/1.0.10/hls-player.php

    r3121654 r3167577  
    44 * Plugin URI: https://github.com/root-sector/wordpress-plugin-hls-player-free
    55 * Description: HLS Player is a simple, lightweight HTTP Live Streaming player for WordPress. Leveraging video.js, the leading open-source HTML5 player, it enables effortless embedding of both responsive and fixed-width .m3u8 or .mpd HLS videos into posts and pages.
    6  * Version: 1.0.9
     6 * Version: 1.0.10
    77 * Requires at least: 6.4
    88 * Requires PHP: 8.1
     
    1717}
    1818
    19 define('HLS_PLAYER_VERSION', '1.0.9');
     19define('HLS_PLAYER_VERSION', '1.0.10');
    2020
    2121class HLSPlayer
     
    108108        $captions = isset($atts['captions']) ? $atts['captions'] : '';
    109109
    110         // Parse the captions attribute to support multiple languages
     110        // Parse the captions attribute to support multiple languages and detect the default
    111111        $captions_data = array();
    112112        if (!empty($captions)) {
     
    114114            foreach ($captions_arr as $caption) {
    115115                $caption_parts = explode('|', $caption);
    116                 if (count($caption_parts) === 3) {
     116                if (count($caption_parts) >= 3) {
    117117                    $captions_data[] = array(
    118118                        'src' => trim($caption_parts[0]),
  • hls-player/tags/1.0.10/public/js/hls-player.js

    r3109826 r3167577  
    3232        });
    3333
     34        // Track if a default caption exists
     35        let defaultCaptionExists = false;
     36
    3437        playerData.captions_data.forEach((caption) => {
    3538          player.addRemoteTextTrack(
     
    3942              srclang: caption.srclang,
    4043              label: caption.label,
    41               default: caption.default,
     44              default: caption.default === 'true',
    4245            },
    4346            false
    4447          );
     48          if (caption.default === 'true') {
     49            defaultCaptionExists = true;
     50          }
    4551        });
     52
     53        // If no default caption, disable captions by default
     54        if (!defaultCaptionExists) {
     55          const tracks = player.textTracks();
     56          for (let i = 0; i < tracks.length; i++) {
     57            tracks[i].mode = 'disabled';
     58          }
     59        }
    4660
    4761        player.load();
  • hls-player/tags/1.0.10/public/js/hls-player.min.js

    r3109826 r3167577  
    1 !function(){"use strict";var callback;callback=()=>{document.querySelectorAll("video.video-js").forEach((video=>{const localizedName="hlsPlayerData_"+video.getAttribute("id");if(void 0!==window[localizedName]){const playerData=JSON.parse(atob(window[localizedName])),options={...JSON.parse(playerData.videojs_custom_options_json)},player=videojs(playerData.video_id,options);player.src({src:playerData.src,type:playerData.type}),playerData.captions_data.forEach((caption=>{player.addRemoteTextTrack({kind:"subtitles",src:caption.src,srclang:caption.srclang,label:caption.label,default:caption.default},!1)})),player.load()}else console.log("No localized data found for "+localizedName)}))},"loading"!==document.readyState?callback():document.addEventListener("DOMContentLoaded",callback)}();
     1!function(){"use strict";var callback;callback=()=>{document.querySelectorAll("video.video-js").forEach((video=>{const localizedName="hlsPlayerData_"+video.getAttribute("id");if(void 0!==window[localizedName]){const playerData=JSON.parse(atob(window[localizedName])),options={...JSON.parse(playerData.videojs_custom_options_json)},player=videojs(playerData.video_id,options);player.src({src:playerData.src,type:playerData.type});let defaultCaptionExists=!1;if(playerData.captions_data.forEach((caption=>{player.addRemoteTextTrack({kind:"subtitles",src:caption.src,srclang:caption.srclang,label:caption.label,default:"true"===caption.default},!1),"true"===caption.default&&(defaultCaptionExists=!0)})),!defaultCaptionExists){const tracks=player.textTracks();for(let i=0;i<tracks.length;i++)tracks[i].mode="disabled"}player.load()}else console.log("No localized data found for "+localizedName)}))},"loading"!==document.readyState?callback():document.addEventListener("DOMContentLoaded",callback)}();
  • hls-player/trunk/Readme.txt

    r3121654 r3167577  
    66Tested up to: 6.6
    77Requires PHP: 8.1
    8 Stable tag: 1.0.9
     8Stable tag: 1.0.10
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0
     
    8383`[hls_player url="https://example.com/path/to/video_playlist.m3u8" muted="true"]`
    8484
    85 **captions**: Add captions or subtitles to the video in multiple languages. Provide the captions in the format: `"path/to/captions1.vtt|lang1|label1|default,path/to/captions2.vtt|lang2|label2"`.
    86 provide the lang in two character language code format. For example de-de, en-us
     85**captions**: Add captions or subtitles to the video in multiple languages. Provide the captions in the format:
    8786
    88 `[hls_player url="https://example.com/path/to/video_playlist.m3u8" captions="path/to/captions-en.vtt|en-EN|English,path/to/captions-es.vtt|en-us|English|default"]`
     87`"path/to/captions1.vtt|lang1|label1|default,path/to/captions2.vtt|lang2|label2"`
     88
     89path/to/captions: The URL or path to the VTT file containing the subtitles.
     90lang: The two-character language code, followed by a hyphen and an optional country code (e.g., en, de, en-US, de-DE).
     91label: A user-friendly label for the caption (e.g., "English", "German").
     92default: (Optional) Use this keyword to specify which caption should be enabled by default when the video is loaded.
     93
     94`[hls_player url="https://example.com/path/to/video_playlist.m3u8" captions="https://example.com/path/to/captions-en.vtt|en-EN|English|default,https://example.com/path/topath/to/captions-de.vtt|de-de|German"]`
    8995
    9096**videojs_custom_options_json**: JSON format string for custom options (https://videojs.com/guides/options/) for the video.js player.
     
    129135
    130136== Changelog ==
     137= 1.0.10 =
     138* Fixed: Improved captions functionality in the shortcode to clarify language codes and default settings for better user experience.
     139
    131140= 1.0.9 =
    132141* Added: Wordpress v6.6 compatibility
  • hls-player/trunk/hls-player.php

    r3121654 r3167577  
    44 * Plugin URI: https://github.com/root-sector/wordpress-plugin-hls-player-free
    55 * Description: HLS Player is a simple, lightweight HTTP Live Streaming player for WordPress. Leveraging video.js, the leading open-source HTML5 player, it enables effortless embedding of both responsive and fixed-width .m3u8 or .mpd HLS videos into posts and pages.
    6  * Version: 1.0.9
     6 * Version: 1.0.10
    77 * Requires at least: 6.4
    88 * Requires PHP: 8.1
     
    1717}
    1818
    19 define('HLS_PLAYER_VERSION', '1.0.9');
     19define('HLS_PLAYER_VERSION', '1.0.10');
    2020
    2121class HLSPlayer
     
    108108        $captions = isset($atts['captions']) ? $atts['captions'] : '';
    109109
    110         // Parse the captions attribute to support multiple languages
     110        // Parse the captions attribute to support multiple languages and detect the default
    111111        $captions_data = array();
    112112        if (!empty($captions)) {
     
    114114            foreach ($captions_arr as $caption) {
    115115                $caption_parts = explode('|', $caption);
    116                 if (count($caption_parts) === 3) {
     116                if (count($caption_parts) >= 3) {
    117117                    $captions_data[] = array(
    118118                        'src' => trim($caption_parts[0]),
  • hls-player/trunk/public/js/hls-player.js

    r3109826 r3167577  
    3232        });
    3333
     34        // Track if a default caption exists
     35        let defaultCaptionExists = false;
     36
    3437        playerData.captions_data.forEach((caption) => {
    3538          player.addRemoteTextTrack(
     
    3942              srclang: caption.srclang,
    4043              label: caption.label,
    41               default: caption.default,
     44              default: caption.default === 'true',
    4245            },
    4346            false
    4447          );
     48          if (caption.default === 'true') {
     49            defaultCaptionExists = true;
     50          }
    4551        });
     52
     53        // If no default caption, disable captions by default
     54        if (!defaultCaptionExists) {
     55          const tracks = player.textTracks();
     56          for (let i = 0; i < tracks.length; i++) {
     57            tracks[i].mode = 'disabled';
     58          }
     59        }
    4660
    4761        player.load();
  • hls-player/trunk/public/js/hls-player.min.js

    r3109826 r3167577  
    1 !function(){"use strict";var callback;callback=()=>{document.querySelectorAll("video.video-js").forEach((video=>{const localizedName="hlsPlayerData_"+video.getAttribute("id");if(void 0!==window[localizedName]){const playerData=JSON.parse(atob(window[localizedName])),options={...JSON.parse(playerData.videojs_custom_options_json)},player=videojs(playerData.video_id,options);player.src({src:playerData.src,type:playerData.type}),playerData.captions_data.forEach((caption=>{player.addRemoteTextTrack({kind:"subtitles",src:caption.src,srclang:caption.srclang,label:caption.label,default:caption.default},!1)})),player.load()}else console.log("No localized data found for "+localizedName)}))},"loading"!==document.readyState?callback():document.addEventListener("DOMContentLoaded",callback)}();
     1!function(){"use strict";var callback;callback=()=>{document.querySelectorAll("video.video-js").forEach((video=>{const localizedName="hlsPlayerData_"+video.getAttribute("id");if(void 0!==window[localizedName]){const playerData=JSON.parse(atob(window[localizedName])),options={...JSON.parse(playerData.videojs_custom_options_json)},player=videojs(playerData.video_id,options);player.src({src:playerData.src,type:playerData.type});let defaultCaptionExists=!1;if(playerData.captions_data.forEach((caption=>{player.addRemoteTextTrack({kind:"subtitles",src:caption.src,srclang:caption.srclang,label:caption.label,default:"true"===caption.default},!1),"true"===caption.default&&(defaultCaptionExists=!0)})),!defaultCaptionExists){const tracks=player.textTracks();for(let i=0;i<tracks.length;i++)tracks[i].mode="disabled"}player.load()}else console.log("No localized data found for "+localizedName)}))},"loading"!==document.readyState?callback():document.addEventListener("DOMContentLoaded",callback)}();
Note: See TracChangeset for help on using the changeset viewer.