Skip to content

Commit

Permalink
Merge pull request #1132 from live-composer/iphone_video
Browse files Browse the repository at this point in the history
Video rendering issues in iPhone
  • Loading branch information
nitin-blueastral authored Apr 27, 2024
2 parents dcb83b5 + e6886ff commit c272246
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 15 deletions.
4 changes: 2 additions & 2 deletions ds-live-composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://www.livecomposerplugin.com
* Description: Page builder for WordPress with drag and drop header/footer editing.
* Author: Live Composer Team
* Version: 1.5.41
* Version: 1.5.42
* Author URI: https://livecomposerplugin.com
* License: GPL3
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -41,7 +41,7 @@
* Constants
*/

define( 'DS_LIVE_COMPOSER_VER', '1.5.41' );
define( 'DS_LIVE_COMPOSER_VER', '1.5.42' );

define( 'DS_LIVE_COMPOSER_SHORTNAME', __( 'Live Composer', 'live-composer-page-builder' ) );
define( 'DS_LIVE_COMPOSER_BASENAME', plugin_basename( __FILE__ ) );
Expand Down
81 changes: 68 additions & 13 deletions includes/display-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1488,21 +1488,76 @@ function dslc_modules_section_front( $atts, $content = null, $version = 1, $is_h
$atts['bg_video'] = wp_get_attachment_url( $atts['bg_video'] );
}

// Remove the file type extension.
$atts['bg_video'] = str_replace( '.mp4', '', $atts['bg_video'] );
$atts['bg_video'] = str_replace( '.webm', '', $atts['bg_video'] );

// The HTML.
$bg_video = '
<div class="dslc-bg-video">



$current_site_url = home_url();

// Get the URL to check
$url_to_check = $atts['bg_video'];

// Parse the URLs to get their host/domain
$current_site_host = parse_url($current_site_url, PHP_URL_HOST);
$url_to_check_host = parse_url($url_to_check, PHP_URL_HOST);

// Check if the hosts are the same
if ($current_site_host === $url_to_check_host) {
// $atts['bg_video'] = str_replace( '.mp4', '', $atts['bg_video'] );
// $atts['bg_video'] = str_replace( '.webm', '', $atts['bg_video'] );
$bg_video = '
<div class="dslc-bg-video">
<div class="dslc-bg-video-inner">
<video muted="muted">
<source type="video/mp4" src="' . $atts['bg_video'] . '.mp4" />
<source type="video/webm" src="' . $atts['bg_video'] . '.webm" />
</video>
</div>
<video autoplay loop muted playsinline id="video-background">
<source src="'.$atts['bg_video'].'" type="video/mp4">
<source type="video/webm" src="' . $atts['bg_video'] . '.webm" />
</video>
</div>
<div class="dslc-bg-video-overlay" style="' . $overlay_style . '"></div>
</div>';
</div>
';
//

} else {
$atts['bg_video'] = 'https://www.youtube.com/watch?v=3GsmXHPCo_w';

// The HTML.
$bg_video = '
<div class="dslc-bg-video">
<div class="dslc-bg-video-inner">
<div class="hp-hero" style="backgroundz-index: 0; "></div>
</div>
<div class="dslc-bg-video-overlay" style="' . $overlay_style . '"></div>
</div>
<div class="bgndVideo player mb_YTPlayer isMuted" data-property="{videoURL:\'' . $atts['bg_video'] . '\',containment:\'.hp-hero\',autoPlay:true,mobileFallbackImage:\'https://demo.flawlessthemes.com/hotelinn-pro2/wp-content/uploads/2021/04/la-pota-4096087_1280.jpg\' ,showControls:false, mute:true, startAt:0, opacity:1}"></div>
<script src="https://code.jquery.com/jquery-3.6.0.miny.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mb.YTPlayer/3.3.9/jquery.mb.YTPlayer.js" integrity="sha512-QEsEUG6vCJ4YMCLGNXn9zScVK2FYKyMSntIS5s3P8h1c5kz5320OE5nij835WZqfTt3JrfyyoOTm0JhVWoqJPA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
jQuery(document).ready(function(){
jQuery(".bgndVideo").YTPlayer();
});
</script>
<style>
.hp-hero {
position: initial !important;
}
</style>
';

}




}

Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ In most of the cases, this is because the homepage is not a real WordPress page,
* 🦊 [Check out our WooCommerce Page Builder Extension](https://livecomposerplugin.com/downloads/woocommerce-page-builder/?utm_source=wp-admin&utm_medium=changelog&utm_campaign=woo-integration)
* 👀 [We keep updating and improving our extensions pack](https://livecomposerplugin.com/downloads/extensions/?utm_source=wp-admin&utm_medium=changelog&utm_campaign=add-ons) ACF + CPT + MegaMenu + 9 more add-ons.

= 1.5.42 - Apr 27 2024 =
* Bug fixed: Background video rendering issue in iPhone

= 1.5.41 - Mar 28 2024 =
* Compatibility testing with Wordpress 6.5

Expand Down

0 comments on commit c272246

Please sign in to comment.