Changeset 3167577
- Timestamp:
- 10/12/2024 01:41:07 PM (18 months ago)
- Location:
- hls-player
- Files:
-
- 8 edited
- 1 copied
-
tags/1.0.10 (copied) (copied from hls-player/trunk)
-
tags/1.0.10/Readme.txt (modified) (3 diffs)
-
tags/1.0.10/hls-player.php (modified) (4 diffs)
-
tags/1.0.10/public/js/hls-player.js (modified) (2 diffs)
-
tags/1.0.10/public/js/hls-player.min.js (modified) (1 diff)
-
trunk/Readme.txt (modified) (3 diffs)
-
trunk/hls-player.php (modified) (4 diffs)
-
trunk/public/js/hls-player.js (modified) (2 diffs)
-
trunk/public/js/hls-player.min.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
hls-player/tags/1.0.10/Readme.txt
r3121654 r3167577 6 6 Tested up to: 6.6 7 7 Requires PHP: 8.1 8 Stable tag: 1.0. 98 Stable tag: 1.0.10 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0 … … 83 83 `[hls_player url="https://example.com/path/to/video_playlist.m3u8" muted="true"]` 84 84 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: 87 86 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 89 path/to/captions: The URL or path to the VTT file containing the subtitles. 90 lang: The two-character language code, followed by a hyphen and an optional country code (e.g., en, de, en-US, de-DE). 91 label: A user-friendly label for the caption (e.g., "English", "German"). 92 default: (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"]` 89 95 90 96 **videojs_custom_options_json**: JSON format string for custom options (https://videojs.com/guides/options/) for the video.js player. … … 129 135 130 136 == 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 131 140 = 1.0.9 = 132 141 * Added: Wordpress v6.6 compatibility -
hls-player/tags/1.0.10/hls-player.php
r3121654 r3167577 4 4 * Plugin URI: https://github.com/root-sector/wordpress-plugin-hls-player-free 5 5 * 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. 96 * Version: 1.0.10 7 7 * Requires at least: 6.4 8 8 * Requires PHP: 8.1 … … 17 17 } 18 18 19 define('HLS_PLAYER_VERSION', '1.0. 9');19 define('HLS_PLAYER_VERSION', '1.0.10'); 20 20 21 21 class HLSPlayer … … 108 108 $captions = isset($atts['captions']) ? $atts['captions'] : ''; 109 109 110 // Parse the captions attribute to support multiple languages 110 // Parse the captions attribute to support multiple languages and detect the default 111 111 $captions_data = array(); 112 112 if (!empty($captions)) { … … 114 114 foreach ($captions_arr as $caption) { 115 115 $caption_parts = explode('|', $caption); 116 if (count($caption_parts) === 3) {116 if (count($caption_parts) >= 3) { 117 117 $captions_data[] = array( 118 118 'src' => trim($caption_parts[0]), -
hls-player/tags/1.0.10/public/js/hls-player.js
r3109826 r3167577 32 32 }); 33 33 34 // Track if a default caption exists 35 let defaultCaptionExists = false; 36 34 37 playerData.captions_data.forEach((caption) => { 35 38 player.addRemoteTextTrack( … … 39 42 srclang: caption.srclang, 40 43 label: caption.label, 41 default: caption.default ,44 default: caption.default === 'true', 42 45 }, 43 46 false 44 47 ); 48 if (caption.default === 'true') { 49 defaultCaptionExists = true; 50 } 45 51 }); 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 } 46 60 47 61 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 6 6 Tested up to: 6.6 7 7 Requires PHP: 8.1 8 Stable tag: 1.0. 98 Stable tag: 1.0.10 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0 … … 83 83 `[hls_player url="https://example.com/path/to/video_playlist.m3u8" muted="true"]` 84 84 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: 87 86 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 89 path/to/captions: The URL or path to the VTT file containing the subtitles. 90 lang: The two-character language code, followed by a hyphen and an optional country code (e.g., en, de, en-US, de-DE). 91 label: A user-friendly label for the caption (e.g., "English", "German"). 92 default: (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"]` 89 95 90 96 **videojs_custom_options_json**: JSON format string for custom options (https://videojs.com/guides/options/) for the video.js player. … … 129 135 130 136 == 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 131 140 = 1.0.9 = 132 141 * Added: Wordpress v6.6 compatibility -
hls-player/trunk/hls-player.php
r3121654 r3167577 4 4 * Plugin URI: https://github.com/root-sector/wordpress-plugin-hls-player-free 5 5 * 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. 96 * Version: 1.0.10 7 7 * Requires at least: 6.4 8 8 * Requires PHP: 8.1 … … 17 17 } 18 18 19 define('HLS_PLAYER_VERSION', '1.0. 9');19 define('HLS_PLAYER_VERSION', '1.0.10'); 20 20 21 21 class HLSPlayer … … 108 108 $captions = isset($atts['captions']) ? $atts['captions'] : ''; 109 109 110 // Parse the captions attribute to support multiple languages 110 // Parse the captions attribute to support multiple languages and detect the default 111 111 $captions_data = array(); 112 112 if (!empty($captions)) { … … 114 114 foreach ($captions_arr as $caption) { 115 115 $caption_parts = explode('|', $caption); 116 if (count($caption_parts) === 3) {116 if (count($caption_parts) >= 3) { 117 117 $captions_data[] = array( 118 118 'src' => trim($caption_parts[0]), -
hls-player/trunk/public/js/hls-player.js
r3109826 r3167577 32 32 }); 33 33 34 // Track if a default caption exists 35 let defaultCaptionExists = false; 36 34 37 playerData.captions_data.forEach((caption) => { 35 38 player.addRemoteTextTrack( … … 39 42 srclang: caption.srclang, 40 43 label: caption.label, 41 default: caption.default ,44 default: caption.default === 'true', 42 45 }, 43 46 false 44 47 ); 48 if (caption.default === 'true') { 49 defaultCaptionExists = true; 50 } 45 51 }); 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 } 46 60 47 61 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.