Changeset 2255308
- Timestamp:
- 03/05/2020 10:25:10 PM (6 years ago)
- Location:
- switch-video-quality/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (3 diffs)
-
switch_video_quality.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
switch-video-quality/trunk/readme.txt
r2093280 r2255308 4 4 Tags: change, choose, select, quality, resolution, self-hosted, video, stream, player, wordpress, media, library, playlist, responsive, embed, iframe, bitrate, HD, 4K, html5, mediaelement, mejs, svq 5 5 Requires at least: 3.6 6 Tested up to: 5. 2.17 Stable tag: 1.5. 16 Tested up to: 5.3.2 7 Stable tag: 1.5.2 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 28 28 29 29 = How to use: = 30 * In the post editor, use the normal video shortcode (width and height set to your needs) to place the video player in your content area, like this: 30 * In the post editor, use the normal video shortcode (width and height set to your needs) to place the video player in your content area, like this: 31 31 `[video width="1024" height="576"]` 32 32 * There are no other shortcode attributes necessary (actually even width and height aren't necessary as they default to 640 x 480 px when they are omitted), but you may add a src and a poster attribute to ensure normal shortcode functionality when Switch Video Quality is not used or deactivated. … … 187 187 * Fixed subtitle error related to WP 5.0 saving empty required input fields 188 188 * CSS fixes (HD and 4K labels) 189 = 1.5.2 = 190 * Fixed the "A non-numeric value encountered"-warning (only PHP >= 7.1) that was displayed when using shortcode attributes with non-numeric values where numeric values were expected. -
switch-video-quality/trunk/switch_video_quality.php
r2003622 r2255308 3 3 Plugin Name: Switch Video Quality 4 4 Description: Switch Video Quality adds quality switch functionality to the wordpress video player to let you choose between different resolutions of a (self-hosted) html5-compatible video. 5 Version: 1.5. 15 Version: 1.5.2 6 6 Author: Timo Klemm (team-ok) 7 7 Text Domain: switch-video-quality … … 26 26 } 27 27 //Switch Video Quality Version Number 28 define( 'SVQ_VERSION', '1.5. 1' );28 define( 'SVQ_VERSION', '1.5.2' ); 29 29 30 30 add_action( 'load-post.php', 'switch_video_quality_settings' ); … … 437 437 // if the height attribute is missing, set it automatically (assuming the video has a 16:9 aspect ratio) 438 438 if ( empty($atts['height']) ){ 439 $atts['height'] = round( $atts['width'] * 0.5625);439 $atts['height'] = round( (int) $atts['width'] * 0.5625); 440 440 } 441 441 442 442 // if the video is bigger than the theme 443 if ( !$is_svq_embed && !empty( $content_width ) && $atts['width'] >$content_width ) {444 $atts['height'] = round( ( $atts['height'] * $content_width ) /$atts['width'] );445 $atts['width'] = $content_width;443 if ( !$is_svq_embed && !empty( $content_width ) && (int) $atts['width'] > (int) $content_width ) { 444 $atts['height'] = round( ( (int) $atts['height'] * (int) $content_width ) / (int) $atts['width'] ); 445 $atts['width'] = (int) $content_width; 446 446 } 447 447 // find the quality that is closest to the player's height, but not smaller than it (to avoid upscaling) 448 448 // and set it as default 449 449 foreach ($svq_stored_metadata as &$svq){ 450 $reference = ($def_qual !== null ? absint( $def_qual) : $atts['height']);450 $reference = ($def_qual !== null ? absint( $def_qual ) : $atts['height']); 451 451 $init_qual = null; 452 452 $init_index = 0; … … 461 461 if ($init_qual === null 462 462 // or if the initial file's is smaller than the player's height and the next file is greater than it, set the next file as initial quality 463 || ( $init_qual < $reference && $reference <=$quality['svq_order'] )463 || ( (int) $init_qual < (int) $reference && (int) $reference <= (int) $quality['svq_order'] ) 464 464 // or if the next file's height is closer to and not smaller than the player's height, set it as initial quality 465 || ( abs( $reference - $init_qual ) > abs( $quality['svq_order'] - $reference ) && $quality['svq_order'] >=$reference )465 || ( abs( (int) $reference - (int) $init_qual ) > abs( (int) $quality['svq_order'] - (int) $reference ) && (int) $quality['svq_order'] >= (int) $reference ) 466 466 ) { 467 $init_qual = $quality['svq_order'];467 $init_qual = (int) $quality['svq_order']; 468 468 $init_index = $key; 469 469 }
Note: See TracChangeset
for help on using the changeset viewer.