' => 'total_progress_border', 'selector' => '{{WRAPPER}} ' . $css_scheme['mejs_total_progress'], ), 75 ); $this->_add_control( 'total_progress_border_radius', array( 'label' => esc_html__( 'Border Radius', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%', 'custom' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_total_progress'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ), 75 ); $this->_add_responsive_control( 'rail_progress_margin', array( 'label' => esc_html__( 'Margin', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%', 'custom' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_rail_progress'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ), 25 ); $this->_add_control( 'current_progress_heading', array( 'label' => esc_html__( 'Current Progress Bar', 'jet-elements' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ), 25 ); $this->_add_group_control( Group_Control_Background::get_type(), array( 'name' => 'current_progress_background', 'selector' => '{{WRAPPER}} ' . $css_scheme['mejs_current_progress'], ), 25 ); $this->_add_control( 'current_progress_border_radius', array( 'label' => esc_html__( 'Border Radius', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%', 'custom' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_current_progress'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ), 75 ); $this->_end_controls_section(); /** * `Player Volume` Style Section */ $this->_start_controls_section( 'section_volume_style', array( 'label' => esc_html__( 'Player Volume', 'jet-elements' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => array( 'video_type' => 'self_hosted', 'self_hosted_player' => 'mejs', 'controls' => 'yes', ), ) ); $this->_add_control( 'volume_button_style_heading', array( 'label' => esc_html__( 'Volume Button', 'jet-elements' ), 'type' => Controls_Manager::HEADING, ), 25 ); $this->_add_control( 'volume_button_font_size', array( 'label' => esc_html__( 'Font size', 'jet-elements' ), 'type' => Controls_Manager::SLIDER, 'size_units' => array( 'px', 'em', 'rem', 'custom' ), 'range' => array( 'px' => array( 'min' => 1, 'max' => 100, ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_volume_btn'] . ':before' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', ), ), 50 ); $this->_start_controls_tabs( 'volume_button_style' ); $this->_start_controls_tab( 'volume_button_normal_style', array( 'label' => esc_html__( 'Normal', 'jet-elements' ), ) ); $this->_add_control( 'volume_button_color', array( 'label' => esc_html__( 'Color', 'jet-elements' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_volume_btn'] . ':before'=> 'background-color: {{VALUE}};', ), ), 25 ); $this->_add_control( 'volume_button_bg_color', array( 'label' => esc_html__( 'Background color', 'jet-elements' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_volume_btn'] => 'background-color: {{VALUE}};', ), ), 25 ); $this->_end_controls_tab(); $this->_start_controls_tab( 'volume_button_hover_style', array( 'label' => esc_html__( 'Hover', 'jet-elements' ), ) ); $this->_add_control( 'volume_button_hover_color', array( 'label' => esc_html__( 'Color', 'jet-elements' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_volume_btn'] . ':hover:before' => 'background-color: {{VALUE}};', ), ), 25 ); $this->_add_control( 'volume_button_hover_bg_color', array( 'label' => esc_html__( 'Background color', 'jet-elements' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_volume_btn'] . ':hover' => 'background-color: {{VALUE}};', ), ), 25 ); $this->_add_control( 'volume_button_hover_border_color', array( 'label' => esc_html__( 'Border Color', 'jet-elements' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_volume_btn'] . ':hover' => 'border-color: {{VALUE}};', ), 'condition' => array( 'volume_button_border_border!' => '', ), ), 75 ); $this->_end_controls_tab(); $this->_end_controls_tabs(); $this->_add_responsive_control( 'volume_button_padding', array( 'label' => esc_html__( 'Padding', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%', 'custom' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_volume_btn'] => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), 'separator' => 'before', ), 25 ); $this->_add_responsive_control( 'volume_button_margin', array( 'label' => esc_html__( 'Margin', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%', 'custom' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_volume_btn_wrap'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ), 25 ); $this->_add_control( 'volume_button_border_radius', array( 'label' => esc_html__( 'Border Radius', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%', 'custom' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_volume_btn'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ), 75 ); $this->_add_group_control( Group_Control_Border::get_type(), array( 'name' => 'volume_button_border', 'selector' => '{{WRAPPER}} ' . $css_scheme['mejs_volume_btn'], ), 75 ); $this->_add_group_control( Group_Control_Box_Shadow::get_type(), array( 'name' => 'volume_button_box_shadow', 'selector' => '{{WRAPPER}} ' . $css_scheme['mejs_volume_btn'], ), 100 ); $this->_add_control( 'volume_slider_style_heading', array( 'label' => esc_html__( 'Volume Slider', 'jet-elements' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ), 25 ); $this->_add_responsive_control( 'volume_slider_margin', array( 'label' => esc_html__( 'Margin', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%', 'custom' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_volume_slider_hor'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ), 25 ); $this->_add_control( 'total_volume_bar_style_heading', array( 'label' => esc_html__( 'Total Volume Bar', 'jet-elements' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ), 25 ); $this->_add_control( 'total_volume_hor_width', array( 'label' => esc_html__( 'Width', 'jet-elements' ), 'type' => Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 0, 'max' => 100, ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_total_volume_hor'] => 'width: {{SIZE}}{{UNIT}};', ), ), 25 ); $this->_add_control( 'total_volume_hor_height', array( 'label' => esc_html__( 'Height', 'jet-elements' ), 'type' => Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 0, 'max' => 50, ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_total_volume_hor'] => 'height: {{SIZE}}{{UNIT}};', ), ), 25 ); $this->_add_group_control( Group_Control_Background::get_type(), array( 'name' => 'total_volume_background', 'selector' => '{{WRAPPER}} ' . $css_scheme['mejs_total_volume_hor'], ), 25 ); $this->_add_group_control( Group_Control_Border::get_type(), array( 'name' => 'total_volume_border', 'selector' => '{{WRAPPER}} ' . $css_scheme['mejs_total_volume_hor'], ), 75 ); $this->_add_control( 'total_volume_border_radius', array( 'label' => esc_html__( 'Border Radius', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%', 'custom' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_total_volume_hor'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ), 75 ); $this->_add_control( 'current_volume_heading', array( 'label' => esc_html__( 'Current Volume Bar', 'jet-elements' ), 'type' => Controls_Manager::HEADING, 'separator' => 'before', ), 25 ); $this->_add_group_control( Group_Control_Background::get_type(), array( 'name' => 'current_volume_background', 'selector' => '{{WRAPPER}} ' . $css_scheme['mejs_current_volume_hor'], ), 25 ); $this->_add_control( 'current_volume_border_radius', array( 'label' => esc_html__( 'Border Radius', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%', 'custom' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_current_volume_hor'] => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ), 75 ); $this->_end_controls_section(); /** * `Player Fullscreen` Style Section */ $this->_start_controls_section( 'section_fullscreen_button_style', array( 'label' => esc_html__( 'Player Fullscreen Button', 'jet-elements' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => array( 'video_type' => 'self_hosted', 'self_hosted_player' => 'mejs', 'controls' => 'yes', ), ) ); $this->_add_control( 'fullscreen_button_font_size', array( 'label' => esc_html__( 'Font size', 'jet-elements' ), 'type' => Controls_Manager::SLIDER, 'size_units' => array( 'px', 'em', 'rem', 'custom' ), 'range' => array( 'px' => array( 'min' => 1, 'max' => 100, ), ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_fullscreen_btn'] => 'font-size: {{SIZE}}{{UNIT}};', ), ), 50 ); $this->_start_controls_tabs( 'fullscreen_button_style' ); $this->_start_controls_tab( 'fullscreen_button_normal_style', array( 'label' => esc_html__( 'Normal', 'jet-elements' ), ) ); $this->_add_control( 'fullscreen_button_color', array( 'label' => esc_html__( 'Color', 'jet-elements' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_fullscreen_btn'] => 'color: {{VALUE}};', ), ), 25 ); $this->_end_controls_tab(); $this->_start_controls_tab( 'fullscreen_button_hover_style', array( 'label' => esc_html__( 'Hover', 'jet-elements' ), ) ); $this->_add_control( 'fullscreen_button_hover_color', array( 'label' => esc_html__( 'Color', 'jet-elements' ), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_fullscreen_btn'] . ':hover' => 'color: {{VALUE}};', ), ), 25 ); $this->_end_controls_tab(); $this->_end_controls_tabs(); $this->_add_responsive_control( 'fullscreen_button_margin', array( 'label' => esc_html__( 'Margin', 'jet-elements' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%', 'custom' ), 'selectors' => array( '{{WRAPPER}} ' . $css_scheme['mejs_fullscreen_btn_wrap'] => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), 'separator' => 'before', ), 25 ); $this->_end_controls_section(); } protected function render() { $this->_open_wrap(); include $this->_get_global_template( 'index' ); $this->_close_wrap(); } public function get_video_url() { $settings = $this->get_settings_for_display(); $video_url = ''; if ( 'self_hosted' === $settings['video_type'] ) { if ( 'self' === $settings['video_source'] ) { $video_url = is_array( $settings['self_hosted_url'] ) ? $settings['self_hosted_url']['url'] : $settings['self_hosted_url']; } else { $video_url = $settings['external_url']; } if ( is_numeric( $video_url ) ) { $video_url = wp_get_attachment_url( $video_url ); } if ( ! $video_url ) { return ''; } if ( empty( $settings['start_time'] ) && empty( $settings['end_time'] ) ) { return esc_url( $video_url ); } $video_url .= '#t='; if ( $settings['start_time'] ) { $video_url .= $settings['start_time']; } if ( $settings['end_time'] ) { $video_url .= ',' . $settings['end_time']; } } else { $video_url = $settings[ $settings['video_type'] . '_url' ]; } return esc_url( $video_url ); } public function get_video_html() { $settings = $this->get_settings_for_display(); $video_url = $this->get_video_url(); $video_html = ''; if ( empty( $video_url ) ) { return; } if ( 'self_hosted' === $settings['video_type'] ) { $self_hosted_params = $this->get_self_hosted_params(); $this->add_render_attribute( 'video_player', 'class', 'jet-video-player' ); $this->add_render_attribute( 'video_player', 'class', sprintf( 'jet-video-%s-player', esc_attr( $settings['self_hosted_player'] ) ) ); $this->add_render_attribute( 'video_player', 'src', $video_url ); $this->add_render_attribute( 'video_player', $self_hosted_params ); if ( filter_var( $settings['show_play_button'], FILTER_VALIDATE_BOOLEAN ) ) { $this->add_render_attribute( 'video_player', 'class', 'jet-video-custom-play-button' ); } $subtitle_html = ''; if ( ! empty( $settings['video_subtitles']['url'] ) ) { $label = esc_attr( $settings['video_subtitles_label'] ); $lang = esc_attr( $settings['video_subtitles_lang'] ); $subtitle_html = sprintf( '