Plugin Directory

Changeset 3312871


Ignore:
Timestamp:
06/17/2025 04:44:40 AM (8 months ago)
Author:
wpstream
Message:

Update to version 4.6.7.4 from GitHub

Location:
wpstream
Files:
28 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wpstream/tags/4.6.7.4/admin/class-wpstream-admin.php

    r3296345 r3312871  
    148148         */
    149149        wp_enqueue_style( 'wpstream-roboto', "https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700,900&display=swap&subset=latin-ext" ); 
    150         wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpstream-admin.css', array(), WPSTREAM_PLUGIN_VERSION, 'all' );
     150        wp_enqueue_style(
     151                $this->plugin_name,
     152                plugin_dir_url( __FILE__ ) . 'css/wpstream-admin.css',
     153                array(),
     154                filemtime(plugin_dir_path(__FILE__) . 'css/wpstream-admin.css' ),
     155                'all'
     156            );
    151157   
    152158        wp_enqueue_style(
     
    266272                wp_localize_script('wpstream-settings', 'wpstream_settings_vars', array(
    267273                        'error_message' => esc_html__( 'Failed to save settings. Please try again.', 'wpstream'),
     274                        'choose_image_text' => esc_html__( 'Choose Logo Image', 'wpstream'),
     275                        'select_image_text' => esc_html__( 'Select Image', 'wpstream'),
    268276                ));
    269277
     
    14121420                ),
    14131421
    1414              
     1422                14 =>  array(
     1423                            'tab'       =>  'general_options',
     1424                            'label'     =>  esc_html__('Video player theme','wpstream'),
     1425                            'name'      =>  'video_player_theme',
     1426                            'type'      =>  'select',
     1427                            'select_values'=>array(
     1428                                'default'  =>  esc_html__('Default','wpstream'),
     1429                                'city'  =>  esc_html__('City','wpstream'),
     1430                                'forest'  =>  esc_html__('Forest','wpstream'),
     1431                                'fantasy'  =>  esc_html__('Fantasy','wpstream'),
     1432                                'sea' => esc_html__('Sea','wpstream'),
     1433                            ),
     1434                            'details'   =>  esc_html__('Choose the video player theme to have a different look.','wpstream'),
     1435                        ),
     1436                'wpstream_player_logo' => array(
     1437                        'tab' => 'general_options',
     1438                        'name' => 'player_logo',
     1439                        'label' => esc_html__('Logo for the video player','wpstream'),
     1440                        'type' => 'image',
     1441                        'details' => esc_html__('This logo will be displayed on the the video player.','wpstream'),
     1442                        'default' => '',
     1443                        'image_size' => 'thumbnail',
     1444                ),
     1445                // hide the video player logo opacity for now
     1446//                'wpstream_player_logo_opacity' => array(
     1447//                        'tab' => 'general_options',
     1448//                        'name' => 'player_logo_opacity',
     1449//                        'label' => esc_html__('Opacity of the player logo','wpstream'),
     1450//                        'type' => 'range',
     1451//                        'details' => esc_html__('Set the opacity of the logo','wpstream'),
     1452//                        'default' => '',
     1453//                        'image_size' => 'thumbnail',
     1454//                ),
     1455                'wpsteram_player_logo_position' => array(
     1456                        'tab' => 'general_options',
     1457                        'name' => 'player_logo_position',
     1458                        'label' => esc_html__('Position of the video player logo','wpstream'),
     1459                        'type' => 'select',
     1460                        'select_values'=>array(
     1461                            'top-left'     =>  esc_html__('Top Left','wpstream'),
     1462                            'top-right'    =>  esc_html__('Top Right','wpstream'),
     1463                            'bottom-left'  =>  esc_html__('Bottom Left','wpstream'),
     1464                            'bottom-right' =>  esc_html__('Bottom Right','wpstream'),
     1465                        ),
     1466                        'details' => esc_html__('Choose the position of the logo on the video player.','wpstream'),
     1467                        'default' => '',
     1468                ),
     1469
    14151470
    14161471               
     
    15281583                                     
    15291584                                       
    1530                                             if($option['type']=='user_roles'){
    1531                                            
     1585                                           switch( $option['type'] ) {
     1586                                            case 'user_roles':
    15321587                                                print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
    15331588                                                print $this->wpstream_select_user_roles($option['name'],$options_value);
    15341589                                                print '<div class="settings_details">'.$option['details'].'</div>';
    1535 
    1536                                             }else if($option['type']=='user_streaming_global_channel_options'){
    1537                                              
     1590                                                break;
     1591                                            case 'user_streaming_global_channel_options':
    15381592                                                $exclude_array=array();
    15391593                                                $this->user_streaming_global_channel_options($option['name'],$options_value,$exclude_array);
    1540                                              
    1541                                                
    1542                                             }else if($option['type']=='text'){
    1543 
     1594                                                break;
     1595                                            case 'text':
    15441596                                                if($options_value==''){
    15451597                                                    $options_value='';
     
    15481600                                                    }
    15491601                                                }
    1550                                                
     1602
    15511603                                                print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
    15521604                                                print '<input class="wpstream-text-input-setting" id="'.$option['name'].'" type="'.$option['type'].'" size="36"  name="'.$option['name'].'" value="'.esc_attr($options_value).'" />';
    15531605                                                print '<div class="settings_details">'.$option['details'].'</div>';
    1554                                                
    1555                                             }  else if($option['type']=='select'){
    1556                                                
     1606                                                break;
     1607                                            case 'select':
    15571608                                                print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
    15581609                                                print '<select id="'.$option['name'].'"  name="'.$option['name'].'"  >';
     
    15671618                                                print '<input type="hidden" name="'.$option['name'].'_hidden" value="1" >';
    15681619                                                print '<div class="settings_details">'.$option['details'].'</div>';
    1569                                                
    1570                                             } else if($option['type']=='slidertoogle'){
     1620                                                break;
     1621                                            case 'slidertoogle':
    15711622                                                print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
    15721623                                                print '<label class="wpstream_switch">
     
    15791630                                                print '</label>';
    15801631                                                print '<div class="settings_details">'.$option['details'].'</div>';
    1581                                             }
     1632                                                break;
     1633                                            case 'image':
     1634                                                $image_url = $options_value ? esc_url($options_value) : '';
     1635                                                $has_image = !empty($image_url);
     1636
     1637                                                print '<label for="' . $option['name'] . '">' . $option['label'] . '</label>';
     1638                                                print '<div class="wpstream-image-upload-wrapper">';
     1639                                                print '<input type="hidden" id="' . $option['name'] . '" name="' . $option['name'] . '" value="' . $image_url . '" />';
     1640
     1641                                                // Preview area
     1642                                                print '<div class="wpstream-image-preview" style="' . (!$has_image ? 'display:none;' : '') . '">';
     1643                                                print '<img src="' . $image_url . '" alt="Preview" />';
     1644                                                print '</div>';
     1645
     1646                                                // Upload/remove buttons
     1647                                                print '<div class="wpstream-image-upload-buttons">';
     1648                                                print '<button type="button" class="wpstream-upload-image button">' . esc_html__('Upload Image', 'wpstream') . '</button>';
     1649                                                print '<button type="button" class="wpstream-remove-image button" style="' . (!$has_image ? 'display:none;' : '') . '">' . esc_html__('Remove Image', 'wpstream') . '</button>';
     1650                                                print '</div>';
     1651
     1652                                                print '</div>';
     1653                                                print '<div class="settings_details">' . $option['details'] . '</div>';
     1654                                                break;
     1655                                            case 'range':
     1656                                                print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
     1657                                                print '<input class="wpstream-range-input" type="range" id="'.$option['name'].'" name="'.$option['name'].'" min="0" max="100" step="10" value="'.esc_attr($options_value).'" />';
     1658                                                print '<div class="settings_details">'.$option['details'].'</div>';
     1659                                                break;
     1660                                        }
    15821661                                   print '</div>';
    15831662                               }
     
    17501829
    17511830                                }else if($token==''){
    1752                                     $text = get_option('wpstream_curl_failed') === false ?
     1831                                    $text = get_option('wpstream_curl_failed') === "0" ?
    17531832                                        ' Incorrect username or password. Please check your credentials or go <a href="https://wpstream.net/my-account/edit-account/" target="_blank">here</a> to reset your password.' :
    17541833                                        'Not connected to WpStream. Please note the errors above and contact support.';
     
    19492028        public function wpstream_present_file_management(){
    19502029                $video_list_raw = $this->main->wpstream_live_connection->wpstream_get_videos_from_api();
     2030
     2031                if ( $video_list_raw === false ) {
     2032                    return '<div class="wpstream_upload_container">'.esc_html__('Not connected. Please connect to WpStream to upload videos.','wpstream').'</div>';
     2033                }
    19512034
    19522035                $video_list_raw_array = [];
     
    34503533                }
    34513534                else {
    3452                     $text = get_option('wpstream_curl_failed') ? 
     3535                    $text = get_option('wpstream_curl_failed') ?
    34533536                        'Login failed with critical error: ' . get_option('wpstream_curl_failed') :
    34543537                        'Wrong username or password!';
     
    34863569            if(current_user_can('administrator')){
    34873570                $wpstream_register_email            = sanitize_text_field($_POST['wpstream_register_email']);
    3488                 $wpstream_register_password         = sanitize_text_field($_POST['wpstream_register_password']);
     3571                $wpstream_register_password         = $_POST['wpstream_register_password'];
    34893572                $wpstream_register_captcha          = sanitize_text_field($_POST['wpstream_register_captcha']);
    34903573                $wpstream_register_captcha_id       = sanitize_text_field($_POST['wpstream_register_captcha_id']);
     
    36043687                $return= array(
    36053688                    'success'=>  false,
    3606                     'message'  =>  esc_html('The email doesn\'t look right !','wpstream')
     3689                    'message'  =>  esc_html__("The email doesn't look right !",'wpstream')
    36073690                );
    36083691                return $return;die();
     
    36143697                $return= array(
    36153698                    'success'=>  false,
    3616                     'message'  =>  esc_html('The email doesn\'t look right !','wpstream')
     3699                    'message'  =>  esc_html__("The email doesn't look right !",'wpstream')
    36173700                );
    36183701                return $return;die();
  • wpstream/tags/4.6.7.4/admin/css/wpstream-admin.css

    r3296345 r3312871  
    8787    margin-top: 5px;
    8888    max-width: 365px;
     89}
     90
     91.wpstream_option .wpstream-image-upload-wrapper {
     92    margin-bottom: 10px;
     93}
     94
     95.wpstream_option .wpstream-image-upload-wrapper .wpstream-image-preview {
     96    margin: 10px 0;
     97    max-width: 300px;
     98}
     99
     100.wpstream_option .wpstream-image-upload-wrapper .wpstream-image-preview img {
     101    max-width: 100%;
     102    height: auto;
     103    border: 1px solid #ddd;
     104    padding: 5px;
     105    background: #fff;
     106}
     107
     108.wpstream_option .wpstream-image-upload-wrapper .wpstream-image-upload-buttons .button {
     109    margin-right: 5px;
    89110}
    90111
  • wpstream/tags/4.6.7.4/admin/js/admin_control.js

    r3261076 r3312871  
    1515    wpstream_handle_video_selection();   
    1616    wpstream_upload_images_in_wpadmin();
     17
     18    wpstream_upload_player_logo();
    1719 
    1820   
     
    612614}
    613615
     616function wpstream_upload_player_logo(){
     617    var mediaUploader;
     618
     619    // Handle upload button click
     620    jQuery('.wpstream-upload-image').on('click', function(e) {
     621        e.preventDefault();
     622
     623        var button = jQuery(this);
     624        var wrapper = button.closest('.wpstream-image-upload-wrapper');
     625        var inputField = wrapper.find('input[type="hidden"]');
     626        var previewArea = wrapper.find('.wpstream-image-preview');
     627        var removeButton = wrapper.find('.wpstream-remove-image');
     628
     629        // Create media uploader instance if not already created
     630        if (!mediaUploader) {
     631            mediaUploader = wp.media({
     632                title: wpstream_settings_vars.choose_image_text || 'Choose Image',
     633                button: {
     634                    text: wpstream_settings_vars.select_image_text || 'Select Image'
     635                },
     636                multiple: false
     637            });
     638
     639            // When image is selected in the media uploader
     640            mediaUploader.on('select', function() {
     641                var attachment = mediaUploader.state().get('selection').first().toJSON();
     642                inputField.val(attachment.url);
     643
     644                previewArea.find('img').attr('src', attachment.url);
     645                previewArea.show();
     646                removeButton.show();
     647            });
     648        }
     649
     650        // Open the media uploader
     651        mediaUploader.open();
     652    });
     653
     654    // Handle remove button click
     655    jQuery('.wpstream-remove-image').on('click', function(e) {
     656        e.preventDefault();
     657
     658        var button = jQuery(this);
     659        var wrapper = button.closest('.wpstream-image-upload-wrapper');
     660        var inputField = wrapper.find('input[type="hidden"]');
     661        var previewArea = wrapper.find('.wpstream-image-preview');
     662
     663        inputField.val('');
     664        previewArea.hide();
     665        button.hide();
     666    });
     667}
  • wpstream/tags/4.6.7.4/admin/js/wpstream_settings.js

    r3296345 r3312871  
    133133        })
    134134    })
     135
     136    jQuery('.wpstream_option_wrapper .wpstream-range-input').on('change',function(e){
     137        var option_name = jQuery(this).attr('id');
     138        var option_value = jQuery(this).val();
     139        var option_type = jQuery(this).attr('type');
     140
     141        jQuery('.theme_options_tab_wpstream .wpstream-save-settings').find('.spinner').css('visibility','visible');
     142        jQuery.ajax({
     143            type: 'POST',
     144            url: ajaxurl,
     145            timeout: 300000,
     146            data: {
     147                'action'        : 'wpstream_update_settings',
     148                'option_name'   : option_name,
     149                'option_type'   : option_type,
     150                'option_value'  : option_value,
     151                'security'      : nonce
     152            },
     153            success: function (data) {
     154                jQuery('.theme_options_tab_wpstream .wpstream-save-settings').find('.spinner').css('visibility','hidden');
     155            },
     156            error: function (jqXHR,textStatus,errorThrown) {
     157                wpstream_show_error_message(jQuery('.theme_options_tab_wpstream .wpstream-save-settings'));
     158            }
     159        })
     160    })
    135161}
    136162
  • wpstream/tags/4.6.7.4/includes/class-wpstream-live-api-connection.php

    r3296345 r3312871  
    6161        if($token=='' and $page!='wpstream_plugin_options'){
    6262            // echo 'wpstream_curl_failed: ' . get_option('wpstream_curl_failed');
    63             $text = get_option('wpstream_curl_failed') == false ?
     63            $text = get_option('wpstream_curl_failed') === "0" ?
    6464                'Not connected to WpStream. Please check your credentials <a href="/wp-admin/admin.php?page=wpstream_credentials">here</a>.' :
    6565                'Not connected to WpStream. Please note the errors above and contact support.';
     
    102102        curl_close($curl);
    103103
    104         $curl_failed = false;
     104        $curl_failed = 0;
    105105
    106106        if ($err) {
     
    142142            $curl_response_decoded  =   json_decode($response,JSON_OBJECT_AS_ARRAY);
    143143            if (JSON_ERROR_NONE !== json_last_error()) {
    144                 if (!$quiet){
    145                     echo '<div class="api_not_conected wpstream_error_curl">Critical: Malformed API response #: ' . json_last_error() . '</div>';
    146                 }
    147 
    148                 $curl_failed = json_last_error();
    149 
    150                 $response = json_encode(   array(
    151                     'success'      => false,
    152                     'error'        => json_last_error(),
    153                 ));
    154             }
    155         }
    156 
    157         update_option("wpstream_curl_failed", $curl_failed);
     144                if (!$quiet) {
     145                    echo '<div class="api_not_conected wpstream_error_curl">Critical: Malformed API response #: ' . json_last_error() . '</div>';
     146                }
     147
     148                $curl_failed = json_last_error();
     149
     150                $response = json_encode(array(
     151                    'success' => false,
     152                    'error' => json_last_error(),
     153                ));
     154            }
     155        }
     156
     157        update_option( "wpstream_curl_failed", $curl_failed );
    158158
    159159        return $response;
  • wpstream/tags/4.6.7.4/includes/class-wpstream-player.php

    r3283102 r3312871  
    2525        add_action('wp_ajax_nopriv_wpstream_player_check_status', array($this,'wpstream_player_check_status'));
    2626     
    27        
    28    
    29        
    30        
    3127    }
    3228   
     
    352348
    353349
     350        $player_theme = $this->wpstream_get_player_theme();
    354351        $now                =   time().rand(0,1000000);
    355352        $overlay_video_div_id = "random_id_".$now;
     
    478475
    479476
     477            $player_logo_position = get_option('wpstream_player_logo_position');
     478            $player_logo_position_class = '';
     479            if( $player_logo_position && $player_logo_position != '' ){
     480                $player_logo_position_class = 'logo-' . explode( '-', $player_logo_position )[0];
     481            }
    480482                echo'
    481                 <video id="wpstream-video'.$now.'"     '.$poster_data.'  class="video-js vjs-default-skin  vjs-fluid vjs-wpstream '.esc_attr($has_trailer_class).'" playsinline="true" '.$is_muted_str." ".$autoplay_str.'>
     483                <video id="wpstream-video'.$now.'"     '.$poster_data.'  class="video-js vjs-default-skin  vjs-fluid vjs-wpstream ' . esc_attr($has_trailer_class) . ' ' . $player_theme . ' ' . $player_logo_position_class .'" playsinline="true" '.$is_muted_str." ".$autoplay_str.'>
    482484               
    483485                </video>';
     
    750752        }
    751753
    752        
     754        function wpstream_get_player_theme() {
     755            $player_theme = get_option('wpstream_video_player_theme');
     756            $is_streamify_user = $this->wpstream_is_streamify_user();
     757            if ( !empty($player_theme) && !$is_streamify_user ) {
     758                $this->wpstream_enqueue_player_theme_style( $player_theme );
     759                return 'vjs-theme-' . $player_theme;
     760            }
     761
     762            return '';
     763        }
     764
     765        function wpstream_enqueue_player_theme_style( $player_theme ) {
     766            if ( $player_theme != 'default' ) {
     767                wp_enqueue_style('videojs-theme-' . $player_theme, 'https://cdn.jsdelivr.net/npm/@videojs/themes@1/dist/' . $player_theme . '/index.min.css', array(), '1.0.0');
     768
     769            }
     770        }
     771
    753772       
    754773       
     
    816835            wp_enqueue_script('video.min');
    817836            wp_enqueue_script('wpstream-player');
    818            
    819            
    820                     $uri_details        =   $this->wpstream_video_on_demand_player_uri_request($product_id);
    821                     $video_path_final   =   $uri_details['video_path_final'];
    822                     $wpstream_data_setup =  $uri_details['wpstream_data_setup'];
    823                     $video_type          =  $uri_details['video_type'];
    824                     $now                =   time().rand(0,1000000);
    825                    
    826                     $overlay_video_div_id = "random_id_".$now;
    827                     print '<div id="'.esc_attr($overlay_video_div_id).'" class="vjs-title-overlay wpstream-video-title-overlay">'.esc_html__('Playing:','wpstream').' '.get_the_title($product_id).'</div>';
    828 
    829                     $thumb_id               =   get_post_thumbnail_id($product_id);
    830                     $thumb                  =   wp_get_attachment_image_src($thumb_id,'small');
    831                     $usernamestream         =   esc_html ( get_option('wpstream_api_username','') );
    832                    
    833                     $poster_thumb           =   '';
    834                     if(isset($thumb[0])){
    835                         $poster_thumb=$thumb[0];
    836                     }
    837 
    838                     $hlsDecryptionKey       =   get_post_meta($product_id,'hlsDecryptionKey',true);
    839                     $hlsDecryptionKeyIndex  =   get_post_meta($product_id,'hlsDecryptionKeyIndex',true);
    840                    
    841 
    842                     $pack = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
    843                    
    844                
    845 
    846                     $trailer_attachment_id    =  intval (get_post_meta( $product_id, 'video_trailer', true ));
    847                     $video_trailer            = '';
    848                     $video_trailer_type       = '';
    849                     if($trailer_attachment_id!=0) {
    850                         $video_trailer                 =   wp_get_attachment_url( $trailer_attachment_id );
    851                         $attachment_metadata           =   wp_get_attachment_metadata($trailer_attachment_id);
    852                         $video_trailer_type            =   $attachment_metadata['mime_type'];
    853                     }
     837
     838            $player_theme = $this->wpstream_get_player_theme();
     839           
     840            $uri_details        =   $this->wpstream_video_on_demand_player_uri_request($product_id);
     841            $video_path_final   =   $uri_details['video_path_final'];
     842            $wpstream_data_setup =  $uri_details['wpstream_data_setup'];
     843            $video_type          =  $uri_details['video_type'];
     844            $now                =   time().rand(0,1000000);
     845
     846            $overlay_video_div_id = "random_id_".$now;
     847            print '<div id="'.esc_attr($overlay_video_div_id).'" class="vjs-title-overlay wpstream-video-title-overlay">'.esc_html__('Playing:','wpstream').' '.get_the_title($product_id).'</div>';
     848
     849            $thumb_id               =   get_post_thumbnail_id($product_id);
     850            $thumb                  =   wp_get_attachment_image_src($thumb_id,'small');
     851            $usernamestream         =   esc_html ( get_option('wpstream_api_username','') );
     852
     853            $poster_thumb           =   '';
     854            if(isset($thumb[0])){
     855                $poster_thumb=$thumb[0];
     856            }
     857
     858            $hlsDecryptionKey       =   get_post_meta($product_id,'hlsDecryptionKey',true);
     859            $hlsDecryptionKeyIndex  =   get_post_meta($product_id,'hlsDecryptionKeyIndex',true);
     860
     861
     862            $pack = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
     863
     864
     865
     866            $trailer_attachment_id    =  intval (get_post_meta( $product_id, 'video_trailer', true ));
     867            $video_trailer            = '';
     868            $video_trailer_type       = '';
     869            if($trailer_attachment_id!=0) {
     870                $video_trailer                 =   wp_get_attachment_url( $trailer_attachment_id );
     871                $attachment_metadata           =   wp_get_attachment_metadata($trailer_attachment_id);
     872                $video_trailer_type            =   $attachment_metadata['mime_type'];
     873            }
     874
     875            // override trailer setup here (for testing)
     876            // $trailer_attachment_id = 1;
     877            // $video_trailer = '/wp-content/uploads/2023/10/production-ID_4608975.mp4';
     878            // $video_trailer = '/wp-content/uploads/2023/10/ultrawide.mp4';
     879
     880            // If the video is self hosted or external, we should let the user see it
     881            $video_type = intval( get_post_meta($product_id, 'wpstream_product_type', true));
     882
     883
     884            if ( (isset($pack['available_data_mb']) && $pack['available_data_mb']>0) || $video_type === 3 ) {
     885
     886                if($video_path_final==''){
     887                    if( $uri_details['post_type']=='wpstream_product_vod'  && $uri_details['free_video_type']==3 ){
     888                    }else{
     889                        print '<div class="wpstream_vod_notice">This video does not exist or it has been deleted!</div>';
     890                    }
     891
     892                }
     893
     894                // TODO (crerem) populate these from VOD settings
     895                $autoplay = false;
     896                $muted = false;
     897
     898                $wpstream_vod_start_muted   =   intval ( get_option('wpstream_vod_start_muted','') );
     899                if($wpstream_vod_start_muted===1){
     900                    $muted=true;
     901                }
     902                $wpstream_vod_autoplay      =   intval  ( get_option('wpstream_vod_autoplay','') );
     903                if($wpstream_vod_autoplay===1){
     904                    $autoplay=true;
     905                }
     906
     907                $poster_data = 'poster="'.esc_url($poster_thumb).'"';
     908                $has_trailer_class='';
     909                if($trailer_attachment_id !=0){
     910                    $poster_data=''; // cancel poster for theme
     911                    $has_trailer_class='wpstream_theme_player_has_trailer';
     912                }
     913
     914                $player_logo_position       = get_option('wpstream_player_logo_position');
     915                $player_logo_position_class = '';
     916                if( $player_logo_position && $player_logo_position!='' ){
     917                    $player_logo_position_class = 'logo-' . explode( '-', $player_logo_position )[0];
     918                }
     919
     920                echo '<video id="wpstream-video-vod-'.$now.'" class="'.esc_attr($has_trailer_class).' video-js vjs-default-skin  vjs-fluid kuk wpstream_video_on_demand vjs-wpstream ' . $player_theme .' ' . $player_logo_position_class . '"  data-me="'.esc_attr($usernamestream).'" data-product-id="'.$product_id.'"  playsinline preload="auto"
     921                  '. $poster_data.' '.$wpstream_data_setup.'>
     922                        <p class="vjs-no-js">
     923                          To view this video please enable JavaScript, and consider upgrading to a web browser that
     924                          <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
     925                        </p>
     926                    </video>';
     927
     928                if($trailer_attachment_id !=0){
     929                    print '<div class="wpstream_theme_trailer_wrapper">';
     930                    print '<div id="wpstream_video_on_demand_play_trailer_btn_' . $now . '" class="wpstream_video_on_demand_play_trailer">
     931                    <svg width="30" height="24" viewBox="0 0 30 24" fill="none" xmlns="http://www.w3.org/2000/svg">
     932                        <path fill-rule="evenodd" clip-rule="evenodd" d="M26.6667 1.5H3.33337C2.50495 1.5 1.83337 2.17157 1.83337 3V21C1.83337 21.8284 2.50495 22.5 3.33338 22.5H26.6667C27.4951 22.5 28.1667 21.8284 28.1667 21V3C28.1667 2.17157 27.4951 1.5 26.6667 1.5ZM3.33337 0C1.67652 0 0.333374 1.34315 0.333374 3V21C0.333374 22.6569 1.67652 24 3.33338 24H26.6667C28.3236 24 29.6667 22.6569 29.6667 21V3C29.6667 1.34315 28.3236 0 26.6667 0H3.33337ZM4.83337 4C4.55723 4 4.33337 4.22386 4.33337 4.5V6.16667C4.33337 6.44281 4.55723 6.66667 4.83337 6.66667H6.50004C6.77618 6.66667 7.00004 6.44281 7.00004 6.16667V4.5C7.00004 4.22386 6.77618 4 6.50004 4H4.83337ZM23.5 4C23.2239 4 23 4.22386 23 4.5V6.16667C23 6.44281 23.2239 6.66667 23.5 6.66667H25.1667C25.4428 6.66667 25.6667 6.44281 25.6667 6.16667V4.5C25.6667 4.22386 25.4428 4 25.1667 4H23.5ZM4.33337 11.167C4.33337 10.8909 4.55723 10.667 4.83337 10.667H6.50004C6.77618 10.667 7.00004 10.8909 7.00004 11.167V12.8337C7.00004 13.1098 6.77618 13.3337 6.50004 13.3337H4.83337C4.55723 13.3337 4.33337 13.1098 4.33337 12.8337V11.167ZM23.5001 10.667C23.224 10.667 23.0001 10.8909 23.0001 11.167V12.8337C23.0001 13.1098 23.224 13.3337 23.5001 13.3337H25.1668C25.4429 13.3337 25.6668 13.1098 25.6668 12.8337V11.167C25.6668 10.8909 25.4429 10.667 25.1668 10.667H23.5001ZM4.33337 17.833C4.33337 17.5569 4.55723 17.333 4.83337 17.333H6.50004C6.77618 17.333 7.00004 17.5569 7.00004 17.833V19.4997C7.00004 19.7758 6.77618 19.9997 6.50004 19.9997H4.83337C4.55723 19.9997 4.33337 19.7758 4.33337 19.4997V17.833ZM23.5001 17.333C23.224 17.333 23.0001 17.5569 23.0001 17.833V19.4997C23.0001 19.7758 23.224 19.9997 23.5001 19.9997H25.1668C25.4429 19.9997 25.6668 19.7758 25.6668 19.4997V17.833C25.6668 17.5569 25.4429 17.333 25.1668 17.333H23.5001ZM19.0677 13.0997L13.4077 16.5087C13.0434 16.7281 12.6092 16.7094 12.2661 16.5091C11.9218 16.3081 11.6666 15.9224 11.6666 15.4086V8.59072C11.6666 8.07698 11.9218 7.69125 12.2661 7.49026C12.6092 7.28999 13.0434 7.27126 13.4077 7.49064L19.0677 10.8996C19.8663 11.3805 19.8663 12.6188 19.0677 13.0997Z"/>
     933                    </svg>
     934                    '.esc_html__('Play Trailer','wpstream').'</div>';
     935
     936                    print '<div class="wpstream_video_on_demand_play_video_wrapper" id="wpstream_video_on_demand_play_video_btn_' . $now . '" >
     937                    <div class="wpstream_video_on_demand_play_video">
     938                        <svg width="29" height="30" viewBox="0 0 29 30" fill="none" xmlns="http://www.w3.org/2000/svg">
     939                            <path fill-rule="evenodd" clip-rule="evenodd" d="M6.1808 28.9035L26.274 18.1652C29.1087 16.6503 29.1087 12.7497 26.274 11.2348L6.1808 0.496557C4.88769 -0.194506 3.34623 -0.1355 2.1283 0.495357C0.906043 1.12846 1.0095e-06 2.34351 9.38766e-07 3.96179L0 25.4382C-7.07369e-08 27.0565 0.906042 28.2715 2.1283 28.9046C3.34622 29.5355 4.88769 29.5945 6.1808 28.9035ZM24.8221 13.8026C25.5742 14.2045 25.5742 15.1955 24.8221 15.5974L4.72891 26.3356C3.94628 26.7539 3.01386 26.2165 3.01386 25.4382L3.01386 3.96179C3.01386 3.18347 3.94628 2.6461 4.72891 3.06436L24.8221 13.8026Z" fill="#F1F1F1"/>
     940                        </svg>
     941                    </div>
     942                    '.esc_html__('Play Video','wpstream').'
     943                    </div>';
     944
     945
     946
     947                    print '<div id="wpstream_video_on_demand_mute_trailer_btn_' . $now . '" class="wpstream_video_on_demand_mute_trailer">
    854948                 
    855                     // override trailer setup here (for testing)
    856                     // $trailer_attachment_id = 1;
    857                     // $video_trailer = '/wp-content/uploads/2023/10/production-ID_4608975.mp4';
    858                     // $video_trailer = '/wp-content/uploads/2023/10/ultrawide.mp4';
    859 
    860                     // If the video is self hosted or external, we should let the user see it
    861                     $video_type = intval( get_post_meta($product_id, 'wpstream_product_type', true));
    862 
    863 
    864                     if ( (isset($pack['available_data_mb']) && $pack['available_data_mb']>0) || $video_type === 3 ) {
    865                        
    866                         if($video_path_final==''){
    867                             if( $uri_details['post_type']=='wpstream_product_vod'  && $uri_details['free_video_type']==3 ){
    868                             }else{
    869                                 print '<div class="wpstream_vod_notice">This video does not exist or it has been deleted!</div>';
    870                             }
    871                            
    872                         }
    873                        
    874                         // TODO (crerem) populate these from VOD settings
    875                         $autoplay = false;
    876                         $muted = false;
    877 
    878                         $wpstream_vod_start_muted   =   intval ( get_option('wpstream_vod_start_muted','') );
    879                         if($wpstream_vod_start_muted===1){
    880                             $muted=true;
    881                         }
    882                         $wpstream_vod_autoplay      =   intval  ( get_option('wpstream_vod_autoplay','') );
    883                         if($wpstream_vod_autoplay===1){
    884                             $autoplay=true;
    885                         }
    886 
    887                         $poster_data = 'poster="'.esc_url($poster_thumb).'"';
    888                         $has_trailer_class='';
    889                         if($trailer_attachment_id !=0){
    890                             $poster_data=''; // cancel poster for theme
    891                             $has_trailer_class='wpstream_theme_player_has_trailer';
    892                         }
    893 
    894                         echo '<video id="wpstream-video-vod-'.$now.'" class="'.esc_attr($has_trailer_class).' video-js vjs-default-skin  vjs-fluid kuk wpstream_video_on_demand vjs-wpstream"  data-me="'.esc_attr($usernamestream).'" data-product-id="'.$product_id.'"  playsinline preload="auto"
    895                           '. $poster_data.' '.$wpstream_data_setup.'>
    896                                 <p class="vjs-no-js">
    897                                   To view this video please enable JavaScript, and consider upgrading to a web browser that
    898                                   <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
    899                                 </p>
    900                             </video>';
    901                            
    902                         if($trailer_attachment_id !=0){
    903                             print '<div class="wpstream_theme_trailer_wrapper">';
    904                             print '<div id="wpstream_video_on_demand_play_trailer_btn_' . $now . '" class="wpstream_video_on_demand_play_trailer">
    905                             <svg width="30" height="24" viewBox="0 0 30 24" fill="none" xmlns="http://www.w3.org/2000/svg">
    906                                 <path fill-rule="evenodd" clip-rule="evenodd" d="M26.6667 1.5H3.33337C2.50495 1.5 1.83337 2.17157 1.83337 3V21C1.83337 21.8284 2.50495 22.5 3.33338 22.5H26.6667C27.4951 22.5 28.1667 21.8284 28.1667 21V3C28.1667 2.17157 27.4951 1.5 26.6667 1.5ZM3.33337 0C1.67652 0 0.333374 1.34315 0.333374 3V21C0.333374 22.6569 1.67652 24 3.33338 24H26.6667C28.3236 24 29.6667 22.6569 29.6667 21V3C29.6667 1.34315 28.3236 0 26.6667 0H3.33337ZM4.83337 4C4.55723 4 4.33337 4.22386 4.33337 4.5V6.16667C4.33337 6.44281 4.55723 6.66667 4.83337 6.66667H6.50004C6.77618 6.66667 7.00004 6.44281 7.00004 6.16667V4.5C7.00004 4.22386 6.77618 4 6.50004 4H4.83337ZM23.5 4C23.2239 4 23 4.22386 23 4.5V6.16667C23 6.44281 23.2239 6.66667 23.5 6.66667H25.1667C25.4428 6.66667 25.6667 6.44281 25.6667 6.16667V4.5C25.6667 4.22386 25.4428 4 25.1667 4H23.5ZM4.33337 11.167C4.33337 10.8909 4.55723 10.667 4.83337 10.667H6.50004C6.77618 10.667 7.00004 10.8909 7.00004 11.167V12.8337C7.00004 13.1098 6.77618 13.3337 6.50004 13.3337H4.83337C4.55723 13.3337 4.33337 13.1098 4.33337 12.8337V11.167ZM23.5001 10.667C23.224 10.667 23.0001 10.8909 23.0001 11.167V12.8337C23.0001 13.1098 23.224 13.3337 23.5001 13.3337H25.1668C25.4429 13.3337 25.6668 13.1098 25.6668 12.8337V11.167C25.6668 10.8909 25.4429 10.667 25.1668 10.667H23.5001ZM4.33337 17.833C4.33337 17.5569 4.55723 17.333 4.83337 17.333H6.50004C6.77618 17.333 7.00004 17.5569 7.00004 17.833V19.4997C7.00004 19.7758 6.77618 19.9997 6.50004 19.9997H4.83337C4.55723 19.9997 4.33337 19.7758 4.33337 19.4997V17.833ZM23.5001 17.333C23.224 17.333 23.0001 17.5569 23.0001 17.833V19.4997C23.0001 19.7758 23.224 19.9997 23.5001 19.9997H25.1668C25.4429 19.9997 25.6668 19.7758 25.6668 19.4997V17.833C25.6668 17.5569 25.4429 17.333 25.1668 17.333H23.5001ZM19.0677 13.0997L13.4077 16.5087C13.0434 16.7281 12.6092 16.7094 12.2661 16.5091C11.9218 16.3081 11.6666 15.9224 11.6666 15.4086V8.59072C11.6666 8.07698 11.9218 7.69125 12.2661 7.49026C12.6092 7.28999 13.0434 7.27126 13.4077 7.49064L19.0677 10.8996C19.8663 11.3805 19.8663 12.6188 19.0677 13.0997Z"/>
    907                             </svg>
    908                             '.esc_html__('Play Trailer','wpstream').'</div>';
    909 
    910                             print '<div class="wpstream_video_on_demand_play_video_wrapper" id="wpstream_video_on_demand_play_video_btn_' . $now . '" >
    911                             <div class="wpstream_video_on_demand_play_video">
    912                                 <svg width="29" height="30" viewBox="0 0 29 30" fill="none" xmlns="http://www.w3.org/2000/svg">
    913                                     <path fill-rule="evenodd" clip-rule="evenodd" d="M6.1808 28.9035L26.274 18.1652C29.1087 16.6503 29.1087 12.7497 26.274 11.2348L6.1808 0.496557C4.88769 -0.194506 3.34623 -0.1355 2.1283 0.495357C0.906043 1.12846 1.0095e-06 2.34351 9.38766e-07 3.96179L0 25.4382C-7.07369e-08 27.0565 0.906042 28.2715 2.1283 28.9046C3.34622 29.5355 4.88769 29.5945 6.1808 28.9035ZM24.8221 13.8026C25.5742 14.2045 25.5742 15.1955 24.8221 15.5974L4.72891 26.3356C3.94628 26.7539 3.01386 26.2165 3.01386 25.4382L3.01386 3.96179C3.01386 3.18347 3.94628 2.6461 4.72891 3.06436L24.8221 13.8026Z" fill="#F1F1F1"/>
    914                                 </svg>
    915                             </div>
    916                             '.esc_html__('Play Video','wpstream').'
    917                             </div>';
    918 
    919 
    920 
    921                             print '<div id="wpstream_video_on_demand_mute_trailer_btn_' . $now . '" class="wpstream_video_on_demand_mute_trailer">
     949                    <svg width="37" height="36" viewBox="0 0 37 36" fill="none" xmlns="http://www.w3.org/2000/svg">
     950                    <path fill-rule="evenodd" clip-rule="evenodd" d="M1.32143 10.0789H8.69499L18.8964 0L21.1428 0.921053V35.1316L18.8964 36L8.69499 25.8684H1.32143L0 24.5526V11.3947L1.32143 10.0789ZM10.175 23.6842L18.5 31.9474V4.10526L10.175 12.3158L9.24999 12.7105H2.64286V23.2368H9.24999L10.175 23.6842ZM37 17.9737C37.0069 22.2216 35.5329 26.3401 32.8295 29.6263L30.9478 27.7579C33.1613 24.9734 34.3629 21.5249 34.3571 17.9737C34.3571 14.2895 33.0885 10.8974 30.9637 8.21053L32.8454 6.34211C35.5382 9.62494 37.0062 13.735 37 17.9737ZM31.7143 17.9737C31.7193 20.8255 30.7895 23.6011 29.0661 25.8789L27.1738 23.9947C28.4127 22.2295 29.0752 20.1272 29.0714 17.9737C29.0751 15.8287 28.4174 13.7344 27.1871 11.9737L29.0793 10.0895C30.7338 12.2868 31.7143 15.0158 31.7143 17.9737ZM26.4286 17.9737C26.4286 19.4842 26.0057 20.8947 25.2657 22.0947L23.3126 20.1526C23.6249 19.4729 23.7876 18.7345 23.7899 17.9869C23.7922 17.2394 23.634 16.5001 23.3258 15.8184L25.2789 13.8737C26.0083 15.0684 26.4286 16.4737 26.4286 17.9737Z" fill="white"/>
     951                    </svg>
     952                    </div>';
     953                    print '<div id="wpstream_video_on_demand_unmute_trailer_btn_' . $now . '" class="wpstream_video_on_demand_unmute_trailer">
     954                    <svg width="33" height="32" viewBox="0 0 33 32" fill="none" xmlns="http://www.w3.org/2000/svg">
     955                    <path fill-rule="evenodd" clip-rule="evenodd" d="M1.15625 8.85688H7.60813L16.5344 0L18.5 0.809375V30.8719L16.5344 31.635L7.60813 22.7319H1.15625L0 21.5756V10.0131L1.15625 8.85688ZM8.90313 20.8125L16.1875 28.0738V3.6075L8.90313 10.8225L8.09375 11.1694H2.3125V20.4194H8.09375L8.90313 20.8125ZM30.5967 11.3127L32.2316 12.9477L28.2287 16.9506L32.2316 20.9559L30.5967 22.5908L26.5938 18.5856L22.5885 22.5908L20.9536 20.9559L24.9588 16.9506L20.9513 12.95L22.5862 11.3151L26.5938 15.3157L30.5967 11.3127Z" fill="white"/>
     956                    </svg>
     957
     958                    </div>';
     959                    print '<script type="text/javascript">
     960                    //<![CDATA[
     961                        jQuery(document).ready(function(){
     962                            console.log("wpstream_video_on_demand_player 886");
     963                            wpstream_player_initialize_vod({
     964                                titleOverlayElementId:"'.$overlay_video_div_id.'",
     965                                videoElementId: "wpstream-video-vod-'.$now.'",
     966                                trailerUrl: "'.$video_trailer.'",
     967                                videoUrl: "'.$video_path_final.'",
     968                                autoplay: '.var_export($autoplay, true).',
     969                                muted: '.var_export($muted, true).',
     970                                playTrailerButtonElementId: "wpstream_video_on_demand_play_trailer_btn_'.$now.'",
     971                                muteTrailerButtonElementId: "wpstream_video_on_demand_mute_trailer_btn_'.$now.'",
     972                                unmuteTrailerButtonElementId: "wpstream_video_on_demand_unmute_trailer_btn_'.$now.'",
     973                                playVideoButtonElementId: "wpstream_video_on_demand_play_video_btn_'.$now.'",
     974                                playerLogoSettings: {
     975                                    image: "'. $this->wpstream_get_video_player_logo() . '",
     976                                    position: "' . esc_html( get_option('wpstream_player_logo_position','top-right') ) . '",
     977                                    opacity: ' . ( intval ( esc_html( get_option('wpstream_player_logo_opacity','100') ) ) / 100 ) . ',
     978                                    width: 100,
     979                                    height: "auto",
     980                                    padding: 10,
     981                                },
     982                            });
     983                        });
     984                    //]]>
     985                    </script>';
     986                    print '</div>';
     987                }
     988                else {
     989                    print '<script type="text/javascript">
     990                    //<![CDATA[
     991                        jQuery(document).ready(function(){
    922992                         
    923                             <svg width="37" height="36" viewBox="0 0 37 36" fill="none" xmlns="http://www.w3.org/2000/svg">
    924                             <path fill-rule="evenodd" clip-rule="evenodd" d="M1.32143 10.0789H8.69499L18.8964 0L21.1428 0.921053V35.1316L18.8964 36L8.69499 25.8684H1.32143L0 24.5526V11.3947L1.32143 10.0789ZM10.175 23.6842L18.5 31.9474V4.10526L10.175 12.3158L9.24999 12.7105H2.64286V23.2368H9.24999L10.175 23.6842ZM37 17.9737C37.0069 22.2216 35.5329 26.3401 32.8295 29.6263L30.9478 27.7579C33.1613 24.9734 34.3629 21.5249 34.3571 17.9737C34.3571 14.2895 33.0885 10.8974 30.9637 8.21053L32.8454 6.34211C35.5382 9.62494 37.0062 13.735 37 17.9737ZM31.7143 17.9737C31.7193 20.8255 30.7895 23.6011 29.0661 25.8789L27.1738 23.9947C28.4127 22.2295 29.0752 20.1272 29.0714 17.9737C29.0751 15.8287 28.4174 13.7344 27.1871 11.9737L29.0793 10.0895C30.7338 12.2868 31.7143 15.0158 31.7143 17.9737ZM26.4286 17.9737C26.4286 19.4842 26.0057 20.8947 25.2657 22.0947L23.3126 20.1526C23.6249 19.4729 23.7876 18.7345 23.7899 17.9869C23.7922 17.2394 23.634 16.5001 23.3258 15.8184L25.2789 13.8737C26.0083 15.0684 26.4286 16.4737 26.4286 17.9737Z" fill="white"/>
    925                             </svg>
    926                             </div>';
    927                             print '<div id="wpstream_video_on_demand_unmute_trailer_btn_' . $now . '" class="wpstream_video_on_demand_unmute_trailer">
    928                             <svg width="33" height="32" viewBox="0 0 33 32" fill="none" xmlns="http://www.w3.org/2000/svg">
    929                             <path fill-rule="evenodd" clip-rule="evenodd" d="M1.15625 8.85688H7.60813L16.5344 0L18.5 0.809375V30.8719L16.5344 31.635L7.60813 22.7319H1.15625L0 21.5756V10.0131L1.15625 8.85688ZM8.90313 20.8125L16.1875 28.0738V3.6075L8.90313 10.8225L8.09375 11.1694H2.3125V20.4194H8.09375L8.90313 20.8125ZM30.5967 11.3127L32.2316 12.9477L28.2287 16.9506L32.2316 20.9559L30.5967 22.5908L26.5938 18.5856L22.5885 22.5908L20.9536 20.9559L24.9588 16.9506L20.9513 12.95L22.5862 11.3151L26.5938 15.3157L30.5967 11.3127Z" fill="white"/>
    930                             </svg>
    931 
    932                             </div>';
    933                             print '<script type="text/javascript">
    934                             //<![CDATA[
    935                                 jQuery(document).ready(function(){
    936                                     console.log("wpstream_video_on_demand_player 886");
    937                                     wpstream_player_initialize_vod({
    938                                         titleOverlayElementId:"'.$overlay_video_div_id.'",
    939                                         videoElementId: "wpstream-video-vod-'.$now.'",
    940                                         trailerUrl: "'.$video_trailer.'",
    941                                         videoUrl: "'.$video_path_final.'",
    942                                         autoplay: '.var_export($autoplay, true).',
    943                                         muted: '.var_export($muted, true).',
    944                                         playTrailerButtonElementId: "wpstream_video_on_demand_play_trailer_btn_'.$now.'",
    945                                         muteTrailerButtonElementId: "wpstream_video_on_demand_mute_trailer_btn_'.$now.'",
    946                                         unmuteTrailerButtonElementId: "wpstream_video_on_demand_unmute_trailer_btn_'.$now.'",
    947                                         playVideoButtonElementId: "wpstream_video_on_demand_play_video_btn_'.$now.'",
    948                                     });
    949                                 });
    950                             //]]>
    951                             </script>';
    952                             print '</div>';
    953                         }
    954                         else {
    955                             print '<script type="text/javascript">
    956                             //<![CDATA[
    957                                 jQuery(document).ready(function(){
    958                                  
    959                                 console.log("wpstream_video_on_demand_player 907");
    960 
    961                                     wpstream_player_initialize_vod({
    962                                         titleOverlayElementId:"'.$overlay_video_div_id.'",
    963                                         videoElementId: "wpstream-video-vod-'.$now.'",
    964                                         videoUrl: "'.$video_path_final.'",
    965                                         autoplay: '.var_export($autoplay, true).',
    966                                         muted: '.var_export($muted, true).',
    967                                     });
    968                                 });
    969                             //]]>
    970                             </script>';
    971                         }   
    972                     }else{
    973                         print '<div class="wpstream_insuficent_res">'.esc_html__('Insufficient resources to stream this title','wpstream').'</div>';
    974                     }
     993                        console.log("wpstream_video_on_demand_player 907");
     994
     995                            wpstream_player_initialize_vod({
     996                                titleOverlayElementId:"'.$overlay_video_div_id.'",
     997                                videoElementId: "wpstream-video-vod-'.$now.'",
     998                                videoUrl: "'.$video_path_final.'",
     999                                autoplay: '.var_export($autoplay, true).',
     1000                                muted: '.var_export($muted, true).',
     1001                                playerLogoSettings: {
     1002                                    image: "'. $this->wpstream_get_video_player_logo() . '",
     1003                                    position: "' . esc_html( get_option('wpstream_player_logo_position','top-right') ) . '",
     1004                                    opacity: ' . ( intval ( esc_html( get_option('wpstream_player_logo_opacity','100') ) ) / 100 ) . ',
     1005                                    width: 100,
     1006                                    height: "auto",
     1007                                    padding: 10,
     1008                                }
     1009                            });
     1010                        });
     1011                    //]]>
     1012                    </script>';
     1013                }
     1014            }else{
     1015                print '<div class="wpstream_insuficent_res">'.esc_html__('Insufficient resources to stream this title','wpstream').'</div>';
     1016            }
    9751017
    9761018        }
     
    9861028            wp_enqueue_script('video.min');
    9871029            wp_enqueue_script('wpstream-player');
    988          
    989            
     1030
     1031
     1032            $player_theme = $this->wpstream_get_player_theme();
    9901033            $now                =   time().rand(0,1000000);
    9911034            $overlay_video_div_id = "random_id_".$now;
     
    10171060         
    10181061                     
    1019             // TODO (crerem) populate these from VOD settings
    1020             $autoplay = false;
    1021             $muted = true;
     1062            $autoplay = false;
     1063            $muted = false;
     1064
     1065            if( intval ( get_option('wpstream_vod_start_muted','') ) === 1){
     1066                $muted = true;
     1067            }
     1068            if( intval  ( get_option('wpstream_vod_autoplay','') ) === 1 ){
     1069                $autoplay = true;
     1070            }
    10221071            $video_path_final='';
    10231072            $has_trailer_class='wpstream_theme_player_has_trailer';
    10241073
    1025             echo '<video id="wpstream-video-vod-'.$now.'" class="video-js vjs-default-skin  vjs-fluid kuk wpstream_video_on_demand vjs-wpstream '.esc_attr(  $has_trailer_class ).' "  data-me="'.esc_attr($usernamestream).'" data-product-id="'.$product_id.'"  playsinline preload="auto"
     1074            echo '<video id="wpstream-video-vod-'.$now.'" class="video-js vjs-default-skin  vjs-fluid kuk wpstream_video_on_demand vjs-wpstream '.esc_attr(  $has_trailer_class ).' ' . $player_theme . '"  data-me="'.esc_attr($usernamestream).'" data-product-id="'.$product_id.'"  playsinline preload="auto"
    10261075                   >
    10271076                    <p class="vjs-no-js">
     
    10661115                            playTrailerButtonElementId: "wpstream_video_on_demand_play_trailer_btn_'.$now.'",
    10671116                            muteTrailerButtonElementId: "wpstream_video_on_demand_mute_trailer_btn_'.$now.'",
    1068                             unmuteTrailerButtonElementId: "wpstream_video_on_demand_unmute_trailer_btn_'.$now.'",
     1117                            unmuteTrailerButtonElementId: "wpstream_video_on_demand_unmute_trailer_btn_'.$now.'",,
     1118                            playerLogoSettings: {
     1119                                    image: "'. $this->wpstream_get_video_player_logo() . '",
     1120                                    position: "' . esc_html( get_option('wpstream_player_logo_position','top-right') ) . '",
     1121                                    opacity: ' . ( intval ( esc_html( get_option('wpstream_player_logo_opacity','100') ) ) / 100 ) . ',
     1122                                    width: 100,
     1123                                    height: "auto",
     1124                                    padding: 10,
     1125                                },
    10691126                        });
    10701127                    });
     
    14711528                   
    14721529        }
    1473    
    1474    
     1530
     1531    /**
     1532     * Get the video player logo URL.
     1533     *
     1534     * @return mixed|string
     1535     */
     1536    public function wpstream_get_video_player_logo() {
     1537        if ( $this->wpstream_is_streamify_user() ) {
     1538            return WPSTREAM_PLUGIN_DIR_URL . 'img/default_300.png';
     1539        }
     1540
     1541        $logo = get_option( 'wpstream_player_logo', '' );
     1542        if ( ! empty( $logo ) ) {
     1543            return $logo;
     1544        }
     1545    }
     1546
     1547    public function wpstream_is_streamify_user() {
     1548        $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
     1549        if ( isset( $pack_details['total_data_mb'] ) && $pack_details['total_data_mb'] === 500 &&
     1550            isset( $pack_details['total_storage_mb'] ) && $pack_details['total_storage_mb'] === 100
     1551        ) {
     1552            return true;
     1553        }
     1554        return false;
     1555    }
    14751556}
  • wpstream/tags/4.6.7.4/public/class-wpstream-public.php

    r3278949 r3312871  
    7272
    7373            wp_enqueue_style('wpstream-style',          plugin_dir_url( __FILE__ ) .'/css/wpstream_style.css',array(), WPSTREAM_PLUGIN_VERSION, 'all' );
    74             wp_enqueue_style('video-js.min',            plugin_dir_url( __FILE__ ).'/css/video-js.min.css', array(), WPSTREAM_PLUGIN_VERSION, 'all');
    75             wp_enqueue_style('videojs-wpstream-player', plugin_dir_url( __FILE__ ).'/css/videojs-wpstream.css', array(), WPSTREAM_PLUGIN_VERSION, 'all');
     74            wp_enqueue_style('video-js.min',            plugin_dir_url( __FILE__ ).'/css/video-js.css', array(), WPSTREAM_PLUGIN_VERSION, 'all');
     75            wp_enqueue_style(
     76                'videojs-wpstream-player',
     77                plugin_dir_url( __FILE__ ).'/css/videojs-wpstream.css',
     78                array(),
     79                WPSTREAM_PLUGIN_VERSION . '.' . filemtime( plugin_dir_path(__FILE__) . 'css/videojs-wpstream.css' ),
     80                'all'
     81            );
    7682            wp_enqueue_style('wpstream-integrations',   plugin_dir_url( __DIR__ ) .'integrations/css/integrations.css',array(), WPSTREAM_PLUGIN_VERSION, 'all' );
    7783    }
     
    8490    public function enqueue_scripts() {
    8591
    86              
    87                 wp_register_script('video.min',              'https://vjs.zencdn.net/8.20.0/video.min.js', WPSTREAM_PLUGIN_VERSION, true);
     92        // Register the VideoJS script
     93        // Enqueuing is happing directly wherever is used
     94        wp_register_script('video.min',              'https://vjs.zencdn.net/8.20.0/video.min.js', WPSTREAM_PLUGIN_VERSION, true);
     95
     96        // Enqueue the VideoJS Logo plugin script
     97        wp_enqueue_script(
     98            'videojs-logo',
     99            'https://cdn.jsdelivr.net/npm/videojs-logo@latest/dist/videojs-logo.min.js',
     100            array('video.min'),
     101            '3.0.0',
     102            true
     103        );
    88104                wp_register_script('youtube.min',         
    89105                                  plugin_dir_url( __FILE__ ).'js/youtube.min.js',
     
    91107                                  WPSTREAM_PLUGIN_VERSION, true);
    92108             
    93                 wp_register_script('wpstream-player',     
    94                                     plugin_dir_url( __FILE__ ).'js/wpstream-player.js',
    95                                     array('video.min'),
    96                                     WPSTREAM_PLUGIN_VERSION,true);
    97 
    98                 wp_localize_script('wpstream-player', 'wpstream_player_vars',
     109                wp_register_script(
     110                    'wpstream-player',
     111                    plugin_dir_url( __FILE__ ).'js/wpstream-player.js',
     112                    array('video.min'),
     113                    WPSTREAM_PLUGIN_VERSION . '.' . filemtime(plugin_dir_path(__FILE__) . 'js/wpstream-player.js'),
     114                    true
     115                );
     116
     117                wp_localize_script('wpstream-player', 'wpstream_player_vars',
    99118                    array(
    100119                        'admin_url'             =>  get_admin_url(),
     
    106125                        'wpstream_player_state_paused_msg'             =>  esc_html__('The live stream is paused','wpstream'),
    107126                        'wpstream_player_state_ended_msg'             =>  esc_html__('The live stream has ended','wpstream'),
     127                        'wpstream_player_theme' => get_option('wpstream_video_player_theme'),
     128                        'playerLogoSettings'  => array(
     129                            'imageUrl'     => $this->main->wpstream_player->wpstream_get_video_player_logo(),
     130                            'position'  => get_option( 'wpstream_player_logo_position', 'top-left' ),
     131                            'opacity'   => get_option('wpstream_player_logo_opacity', '100'),
     132                        ),
    108133                    )
    109134                );
     
    181206                       
    182207    }
     208
    183209       
    184210       
  • wpstream/tags/4.6.7.4/public/css/video-js.css

    r2162139 r3312871  
    594594  height: 3.0em;
    595595  background-color: #2B333F;
    596   background-color: rgba(43, 51, 63, 0.7); }
     596  background-color: rgba(43, 51, 63, 0.7);
     597}
     598
     599.video-js:not(.vjs-theme-default) .vjs-control-bar {
     600  height: 54px;
     601}
     602
     603/* Fantasy theme */
     604.video-js.vjs-theme-fantasy .vjs-control {
     605  height: 100%;
     606  align-items: center;
     607}
     608
     609.video-js.vjs-theme-fantasy .vjs-control-bar .vjs-play-control {
     610  width: 4em;
     611}
     612
     613.video-js.vjs-theme-fantasy .vjs-play-progress:before {
     614  content: '';
     615}
     616
     617.vjs-wpstream.vjs-theme-fantasy .vjs-play-control.vjs-button>.vjs-icon-placeholder:before {
     618  font-size: 1.8em;
     619}
     620
     621.vjs-wpstream.vjs-theme-fantasy .vjs-button > .vjs-icon-placeholder:before {
     622  display: flex;
     623  align-items: center;
     624  width: 1.2em;
     625}
     626
     627.wp-theme-hello-wpstream .vjs-wpstream.vjs-theme-fantasy .vjs-button > .vjs-icon-placeholder:before {
     628  line-height: 1.9 !important;
     629}
     630
     631.video-js.vjs-theme-fantasy .vjs-play-progress:before {
     632  top: -.25em;
     633}
     634
     635.video-js.vjs-theme-fantasy .vjs-play-progress {
     636  background-color: var(--vjs-theme-fantasy--primary);
     637}
     638
     639.vjs-wpstream.vjs-theme-fantasy .vjs-volume-panel .vjs-button > .vjs-icon-placeholder:before {
     640  display: block;
     641  line-height: 54px;
     642}
     643
     644.wpstream-featured-player-wrapper .video-js.vjs-theme-fantasy .vjs-live-display {
     645  margin: 0;
     646}
     647/* End of Fantasy theme */
     648
     649/* City theme */
     650.video-js.vjs-theme-city .vjs-control-bar {
     651  height: 60px;
     652}
     653
     654.video-js.vjs-theme-city .vjs-control-bar .vjs-remaining-time {
     655  display: flex;
     656  align-content: center;
     657  flex-wrap: wrap;
     658
     659  flex: 3 1;
     660  line-height: 50px;
     661  order: 1;
     662  text-align: left;
     663  height: 100%;
     664  left: 20px;
     665}
     666
     667.function_wpstream_live_event_player .video-js.vjs-theme-city .vjs-control-bar .vjs-remaining-time {
     668  display: none;
     669}
     670
     671.function_wpstream_live_event_player .video-js.vjs-theme-city .vjs-live-control {
     672  flex: 3 1;
     673  left: 20px;
     674}
     675
     676.function_wpstream_live_event_player .video-js.vjs-theme-city .vjs-live-control .vjs-live-display {
     677  background-color: #670000;
     678  margin-top: 11px;
     679}
     680
     681.video-js.vjs-theme-city .vjs-progress-control {
     682  width: 100%;
     683  position: absolute;
     684  height: 20px;
     685}
     686
     687.video-js.vjs-theme-city > .vjs-control-bar {
     688  background-color: initial;
     689}
     690
     691.video-js.vjs-theme-city > .vjs-control-bar > .vjs-play-control {
     692  flex: 8 1;
     693}
     694
     695.video-js.vjs-theme-city .vjs-progress-control .vjs-progress-holder {
     696  margin: 0;
     697}
     698
     699.video-js.vjs-theme-city .vjs-progress-control .vjs-volume-panel .vjs-volume-bar {
     700  background-color: initial;
     701}
     702
     703.video-js.vjs-theme-city .vjs-volume-panel .vjs-volume-bar {
     704  background-color: initial;
     705}
     706
     707.video-js.vjs-theme-city .vjs-volume-panel.vjs-volume-panel-horizontal:hover {
     708  width: 3em;
     709}
     710
     711.video-js.vjs-theme-city .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal {
     712  width: 3em !important;
     713  height: 100%;
     714  opacity: 1;
     715}
     716
     717.video-js.vjs-theme-city .vjs-volume-panel:hover .vjs-volume-control.vjs-volume-horizontal {
     718  height: 100%;
     719}
     720
     721.video-js.vjs-theme-city .vjs-volume-panel > *,
     722.video-js.vjs-theme-forest .vjs-volume-panel > * {
     723  transition: none !important;
     724}
     725
     726.video-js.vjs-theme-city .vjs-volume-level,
     727.video-js.vjs-theme-forest .vjs-volume-level {
     728  background-color: transparent !important;
     729}
     730
     731.video-js.vjs-theme-city .vjs-volume-level:before {
     732    position: relative;
     733}
     734
     735.video-js.vjs-theme-city .vjs-volume-panel {
     736  width: 34px !important;
     737  flex: 1 !important;
     738  padding-top: 0;
     739}
     740
     741.video-js.vjs-theme-city .vjs-volume-bar:before {
     742  position: relative;
     743}
     744
     745.video-js.vjs-theme-city .vjs-volume-panel:not(:hover) .vjs-volume-control .vjs-mouse-display {
     746  visibility: hidden;
     747}
     748
     749.vjs-wpstream.vjs-theme-city .vjs-picture-in-picture-control,
     750.vjs-wpstream.vjs-theme-city .vjs-fullscreen-control,
     751.vjs-wpstream.vjs-theme-city .vjs-fullscreen-control:hover {
     752  background-size: auto !important;
     753  background-position: 50% 54% !important;
     754}
     755/* End of City theme */
     756
     757/* Forest theme */
     758.video-js.vjs-theme-forest .vjs-control-bar {
     759  height: 3em;
     760  background-color: transparent;
     761}
     762.video-js.vjs-theme-forest .vjs-control-bar button .vjs-icon-placeholder:before, .vjs-wpstream .vjs-live-control {
     763  line-height: 1.6;
     764}
     765.video-js.vjs-theme-forest .vjs-control-bar .vjs-picture-in-picture-control,
     766.video-js.vjs-theme-forest .vjs-control-bar .vjs-fullscreen-control {
     767  width: 3em;
     768  height: 3em;
     769}
     770.video-js.vjs-theme-forest .vjs-volume-panel.vjs-volume-panel-horizontal:hover {
     771  width: 34px;
     772  transition: none;
     773}
     774.video-js.vjs-theme-forest .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal {
     775  transition: none;
     776}
     777.video-js.vjs-theme-forest .vjs-volume-panel .vjs-slider {
     778  background-color: transparent;
     779}
     780.video-js.vjs-theme-forest .vjs-volume-panel:not(:hover) .vjs-volume-control .vjs-mouse-display {
     781  visibility: hidden;
     782}
     783.video-js.vjs-theme-forest .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal {
     784  width: 5em;
     785  height: 3em;
     786  opacity: 1;
     787}
     788
     789.video-js.vjs-theme-forest .vjs-big-play-button .vjs-icon-placeholder {
     790  display: block;
     791}
     792
     793.video-js.vjs-theme-forest .vjs-progress-control:hover .vjs-time-tooltip,
     794.video-js.vjs-theme-forest .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip {
     795  font-size: 1em;
     796}
     797
     798/* End of Forest theme */
     799
     800/* Sea theme */
     801.video-js.vjs-theme-sea .vjs-control-bar {
     802  height: 4em;
     803}
     804.video-js.vjs-theme-sea .vjs-progress-control {
     805  height: 4em;
     806}
     807.vjs-wpstream.vjs-theme-sea .vjs-time-control {
     808    height: 4em;
     809    line-height: 4em;
     810}
     811.video-js.vjs-theme-sea .vjs-volume-panel {
     812  height: 4em;
     813}
     814
     815.theme-hello-wpstream .function_wpstream_live_event_player .video-js.vjs-theme-sea .vjs-live-control .vjs-live-display {
     816  background-color: #670000;
     817  margin-top: 11px;
     818}
     819/* End of Sea theme */
     820
     821.video-js .vjs-poster img {
     822  width: 100%;
     823}
    597824
    598825.vjs-has-started .vjs-control-bar {
  • wpstream/tags/4.6.7.4/public/css/videojs-wpstream.css

    r2438830 r3312871  
    1 .vjs-wpstream .vjs-control-bar {
     1.vjs-wpstream.vjs-theme-default .vjs-control-bar {
    22    background-color: hsl(0 0% 100% / 0);
    33    padding: 0px 12px;
    44    height: auto;
    55    height: 4em;
     6    align-items: center;
    67}
    78
     
    4142    font-size: 1.1em;
    4243    line-height: 3em;
     44    height: 4em;
    4345}
    4446
     
    4648.vjs-wpstream .vjs-volume-panel .vjs-volume-control {
    4749    margin: 0px 0px 0px 0px;
     50}
     51
     52.vjs-wpstream .vjs-volume-panel .vjs-volume-control .vjs-volume-tooltip {
     53    position: static;
     54    margin-top: -20px;
    4855}
    4956
  • wpstream/tags/4.6.7.4/public/css/wpstream_style.css

    r3288783 r3312871  
    213213.video-js:hover .vjs-icon-placeholder{
    214214    opacity: 1;
     215}
     216
     217.video-js.vjs-logo.logo-top .vjs-logo-content {
     218    top: 30px !important;
     219}
     220
     221.video-js.vjs-logo.logo-bottom .vjs-logo-content {
     222    bottom: 40px !important;
     223}
     224
     225.video-js .vjs-logo-content {
     226    position: absolute;
     227}
     228
     229.video-js.vjs-has-started .vjs-logo-content img {
     230    height: auto;
     231}
     232
     233.video-js .vjs-volume-level:before {
     234    font-size: 10px !important;
     235    /*top: 0 !important;*/
    215236}
    216237
  • wpstream/tags/4.6.7.4/public/js/wpstream-player.js

    r3288783 r3312871  
    297297    });
    298298
     299    this.applyTheme(wpstream_player_vars.wpstream_player_theme)
     300
     301      if ( typeof this.player.logo === 'function' && wpstream_player_vars.playerLogoSettings ) {
     302          this.player.logo({
     303              image: wpstream_player_vars.playerLogoSettings.imageUrl,
     304              position: wpstream_player_vars.playerLogoSettings.position,
     305              width: 100,
     306              height: 'auto',
     307              opacity: parseFloat(wpstream_player_vars.playerLogoSettings.opacity)/100,
     308              padding: 10,
     309          });
     310      }
     311
    299312    if (this.master.settings.theaterModeButtons) {
    300313      const Button = videojs.getComponent("Button");
     
    451464      if (!this.playingTrailer) this.qoe.error();
    452465    });
     466  }
     467
     468  applyTheme(themeName) {
     469    const themes = ['vjs-theme-city', 'vjs-theme-forest', 'vjs-theme-sunset', 'vjs-theme-sea'];
     470    themes.forEach(theme => {
     471      this.player.removeClass(theme);
     472    })
     473
     474    this.player.addClass(`vjs-theme-${themeName}`);
     475  }
     476
     477  initThemeSelector() {
     478    const Button = videojs.getComponent('Button');
     479    const owner = this;
     480
    453481  }
    454482
     
    12401268  player.muted(settings.muted);
    12411269
     1270  if ( typeof player.logo === 'function' && settings.playerLogoSettings ) {
     1271    player.logo(settings.playerLogoSettings);
     1272  }
     1273
    12421274  const originalPoster = player.poster();
    12431275
  • wpstream/tags/4.6.7.4/readme.txt

    r3296345 r3312871  
    55Tested up to: 6.8
    66Requires PHP: 7.1
    7 Stable tag: 4.6.7.3
     7Stable tag: 4.6.7.4
    88License: GPL
    99License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
     
    138138== Changelog ==
    139139
     140= 4.6.7.4 =
     141* Feature - Give the video player a different look using the theme option
     142* Feature - Display a logo over the video player
     143* Enhancement - Fix issue regarding the basic streaming functionality when the video doesn't start
     144
    140145= 4.6.7.3 =
    141146* Fix - Broken WpStream login functionality
  • wpstream/tags/4.6.7.4/streamify/streamify.php

    r3233738 r3312871  
    342342
    343343function wpstreamify_add_rewrite_rules() {
    344     add_rewrite_rule('^wpstreamify/(.+)$', 'index.php?wpstreamify_path=$matches[1]', 'top');
     344    $rewrite_rules = get_option('rewrite_rules');
     345    $rule_pattern = '^wpstreamify/(.+)$';
     346    $rule_target = 'index.php?wpstreamify_path=$matches[1]';
     347
     348    // Check if the rewrite rule already exists
     349    if (!isset($rewrite_rules[$rule_pattern]) || $rewrite_rules[$rule_pattern] !== $rule_target) {
     350        add_rewrite_rule($rule_pattern, $rule_target, 'top');
     351        flush_rewrite_rules();
     352    }
    345353}
    346354add_action('init', 'wpstreamify_add_rewrite_rules');
  • wpstream/tags/4.6.7.4/wpstream.php

    r3296345 r3312871  
    44 * Plugin URI:        http://wpstream.net
    55 * Description:       WpStream is a platform that allows you to live stream, create Video-on-Demand, and offer Pay-Per-View videos. We provide an affordable and user-friendly way for businesses, non-profits, and public institutions to broadcast their content and monetize their work.
    6  * Version:           4.6.7.3
     6 * Version:           4.6.7.4
    77 * Author:            wpstream
    88 * Author URI:        http://wpstream.net
     
    1515    die;
    1616}
    17 define('WPSTREAM_PLUGIN_VERSION', '4.6.7.3');
     17define('WPSTREAM_PLUGIN_VERSION', '4.6.7.4');
    1818define('WPSTREAM_CLUBLINK', 'wpstream.net');
    1919define('WPSTREAM_CLUBLINKSSL', 'https');
  • wpstream/trunk/admin/class-wpstream-admin.php

    r3296345 r3312871  
    148148         */
    149149        wp_enqueue_style( 'wpstream-roboto', "https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700,900&display=swap&subset=latin-ext" ); 
    150         wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/wpstream-admin.css', array(), WPSTREAM_PLUGIN_VERSION, 'all' );
     150        wp_enqueue_style(
     151                $this->plugin_name,
     152                plugin_dir_url( __FILE__ ) . 'css/wpstream-admin.css',
     153                array(),
     154                filemtime(plugin_dir_path(__FILE__) . 'css/wpstream-admin.css' ),
     155                'all'
     156            );
    151157   
    152158        wp_enqueue_style(
     
    266272                wp_localize_script('wpstream-settings', 'wpstream_settings_vars', array(
    267273                        'error_message' => esc_html__( 'Failed to save settings. Please try again.', 'wpstream'),
     274                        'choose_image_text' => esc_html__( 'Choose Logo Image', 'wpstream'),
     275                        'select_image_text' => esc_html__( 'Select Image', 'wpstream'),
    268276                ));
    269277
     
    14121420                ),
    14131421
    1414              
     1422                14 =>  array(
     1423                            'tab'       =>  'general_options',
     1424                            'label'     =>  esc_html__('Video player theme','wpstream'),
     1425                            'name'      =>  'video_player_theme',
     1426                            'type'      =>  'select',
     1427                            'select_values'=>array(
     1428                                'default'  =>  esc_html__('Default','wpstream'),
     1429                                'city'  =>  esc_html__('City','wpstream'),
     1430                                'forest'  =>  esc_html__('Forest','wpstream'),
     1431                                'fantasy'  =>  esc_html__('Fantasy','wpstream'),
     1432                                'sea' => esc_html__('Sea','wpstream'),
     1433                            ),
     1434                            'details'   =>  esc_html__('Choose the video player theme to have a different look.','wpstream'),
     1435                        ),
     1436                'wpstream_player_logo' => array(
     1437                        'tab' => 'general_options',
     1438                        'name' => 'player_logo',
     1439                        'label' => esc_html__('Logo for the video player','wpstream'),
     1440                        'type' => 'image',
     1441                        'details' => esc_html__('This logo will be displayed on the the video player.','wpstream'),
     1442                        'default' => '',
     1443                        'image_size' => 'thumbnail',
     1444                ),
     1445                // hide the video player logo opacity for now
     1446//                'wpstream_player_logo_opacity' => array(
     1447//                        'tab' => 'general_options',
     1448//                        'name' => 'player_logo_opacity',
     1449//                        'label' => esc_html__('Opacity of the player logo','wpstream'),
     1450//                        'type' => 'range',
     1451//                        'details' => esc_html__('Set the opacity of the logo','wpstream'),
     1452//                        'default' => '',
     1453//                        'image_size' => 'thumbnail',
     1454//                ),
     1455                'wpsteram_player_logo_position' => array(
     1456                        'tab' => 'general_options',
     1457                        'name' => 'player_logo_position',
     1458                        'label' => esc_html__('Position of the video player logo','wpstream'),
     1459                        'type' => 'select',
     1460                        'select_values'=>array(
     1461                            'top-left'     =>  esc_html__('Top Left','wpstream'),
     1462                            'top-right'    =>  esc_html__('Top Right','wpstream'),
     1463                            'bottom-left'  =>  esc_html__('Bottom Left','wpstream'),
     1464                            'bottom-right' =>  esc_html__('Bottom Right','wpstream'),
     1465                        ),
     1466                        'details' => esc_html__('Choose the position of the logo on the video player.','wpstream'),
     1467                        'default' => '',
     1468                ),
     1469
    14151470
    14161471               
     
    15281583                                     
    15291584                                       
    1530                                             if($option['type']=='user_roles'){
    1531                                            
     1585                                           switch( $option['type'] ) {
     1586                                            case 'user_roles':
    15321587                                                print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
    15331588                                                print $this->wpstream_select_user_roles($option['name'],$options_value);
    15341589                                                print '<div class="settings_details">'.$option['details'].'</div>';
    1535 
    1536                                             }else if($option['type']=='user_streaming_global_channel_options'){
    1537                                              
     1590                                                break;
     1591                                            case 'user_streaming_global_channel_options':
    15381592                                                $exclude_array=array();
    15391593                                                $this->user_streaming_global_channel_options($option['name'],$options_value,$exclude_array);
    1540                                              
    1541                                                
    1542                                             }else if($option['type']=='text'){
    1543 
     1594                                                break;
     1595                                            case 'text':
    15441596                                                if($options_value==''){
    15451597                                                    $options_value='';
     
    15481600                                                    }
    15491601                                                }
    1550                                                
     1602
    15511603                                                print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
    15521604                                                print '<input class="wpstream-text-input-setting" id="'.$option['name'].'" type="'.$option['type'].'" size="36"  name="'.$option['name'].'" value="'.esc_attr($options_value).'" />';
    15531605                                                print '<div class="settings_details">'.$option['details'].'</div>';
    1554                                                
    1555                                             }  else if($option['type']=='select'){
    1556                                                
     1606                                                break;
     1607                                            case 'select':
    15571608                                                print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
    15581609                                                print '<select id="'.$option['name'].'"  name="'.$option['name'].'"  >';
     
    15671618                                                print '<input type="hidden" name="'.$option['name'].'_hidden" value="1" >';
    15681619                                                print '<div class="settings_details">'.$option['details'].'</div>';
    1569                                                
    1570                                             } else if($option['type']=='slidertoogle'){
     1620                                                break;
     1621                                            case 'slidertoogle':
    15711622                                                print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
    15721623                                                print '<label class="wpstream_switch">
     
    15791630                                                print '</label>';
    15801631                                                print '<div class="settings_details">'.$option['details'].'</div>';
    1581                                             }
     1632                                                break;
     1633                                            case 'image':
     1634                                                $image_url = $options_value ? esc_url($options_value) : '';
     1635                                                $has_image = !empty($image_url);
     1636
     1637                                                print '<label for="' . $option['name'] . '">' . $option['label'] . '</label>';
     1638                                                print '<div class="wpstream-image-upload-wrapper">';
     1639                                                print '<input type="hidden" id="' . $option['name'] . '" name="' . $option['name'] . '" value="' . $image_url . '" />';
     1640
     1641                                                // Preview area
     1642                                                print '<div class="wpstream-image-preview" style="' . (!$has_image ? 'display:none;' : '') . '">';
     1643                                                print '<img src="' . $image_url . '" alt="Preview" />';
     1644                                                print '</div>';
     1645
     1646                                                // Upload/remove buttons
     1647                                                print '<div class="wpstream-image-upload-buttons">';
     1648                                                print '<button type="button" class="wpstream-upload-image button">' . esc_html__('Upload Image', 'wpstream') . '</button>';
     1649                                                print '<button type="button" class="wpstream-remove-image button" style="' . (!$has_image ? 'display:none;' : '') . '">' . esc_html__('Remove Image', 'wpstream') . '</button>';
     1650                                                print '</div>';
     1651
     1652                                                print '</div>';
     1653                                                print '<div class="settings_details">' . $option['details'] . '</div>';
     1654                                                break;
     1655                                            case 'range':
     1656                                                print '<label for="'.$option['name'].'">'.$option['label'].'</label>';
     1657                                                print '<input class="wpstream-range-input" type="range" id="'.$option['name'].'" name="'.$option['name'].'" min="0" max="100" step="10" value="'.esc_attr($options_value).'" />';
     1658                                                print '<div class="settings_details">'.$option['details'].'</div>';
     1659                                                break;
     1660                                        }
    15821661                                   print '</div>';
    15831662                               }
     
    17501829
    17511830                                }else if($token==''){
    1752                                     $text = get_option('wpstream_curl_failed') === false ?
     1831                                    $text = get_option('wpstream_curl_failed') === "0" ?
    17531832                                        ' Incorrect username or password. Please check your credentials or go <a href="https://wpstream.net/my-account/edit-account/" target="_blank">here</a> to reset your password.' :
    17541833                                        'Not connected to WpStream. Please note the errors above and contact support.';
     
    19492028        public function wpstream_present_file_management(){
    19502029                $video_list_raw = $this->main->wpstream_live_connection->wpstream_get_videos_from_api();
     2030
     2031                if ( $video_list_raw === false ) {
     2032                    return '<div class="wpstream_upload_container">'.esc_html__('Not connected. Please connect to WpStream to upload videos.','wpstream').'</div>';
     2033                }
    19512034
    19522035                $video_list_raw_array = [];
     
    34503533                }
    34513534                else {
    3452                     $text = get_option('wpstream_curl_failed') ? 
     3535                    $text = get_option('wpstream_curl_failed') ?
    34533536                        'Login failed with critical error: ' . get_option('wpstream_curl_failed') :
    34543537                        'Wrong username or password!';
     
    34863569            if(current_user_can('administrator')){
    34873570                $wpstream_register_email            = sanitize_text_field($_POST['wpstream_register_email']);
    3488                 $wpstream_register_password         = sanitize_text_field($_POST['wpstream_register_password']);
     3571                $wpstream_register_password         = $_POST['wpstream_register_password'];
    34893572                $wpstream_register_captcha          = sanitize_text_field($_POST['wpstream_register_captcha']);
    34903573                $wpstream_register_captcha_id       = sanitize_text_field($_POST['wpstream_register_captcha_id']);
     
    36043687                $return= array(
    36053688                    'success'=>  false,
    3606                     'message'  =>  esc_html('The email doesn\'t look right !','wpstream')
     3689                    'message'  =>  esc_html__("The email doesn't look right !",'wpstream')
    36073690                );
    36083691                return $return;die();
     
    36143697                $return= array(
    36153698                    'success'=>  false,
    3616                     'message'  =>  esc_html('The email doesn\'t look right !','wpstream')
     3699                    'message'  =>  esc_html__("The email doesn't look right !",'wpstream')
    36173700                );
    36183701                return $return;die();
  • wpstream/trunk/admin/css/wpstream-admin.css

    r3296345 r3312871  
    8787    margin-top: 5px;
    8888    max-width: 365px;
     89}
     90
     91.wpstream_option .wpstream-image-upload-wrapper {
     92    margin-bottom: 10px;
     93}
     94
     95.wpstream_option .wpstream-image-upload-wrapper .wpstream-image-preview {
     96    margin: 10px 0;
     97    max-width: 300px;
     98}
     99
     100.wpstream_option .wpstream-image-upload-wrapper .wpstream-image-preview img {
     101    max-width: 100%;
     102    height: auto;
     103    border: 1px solid #ddd;
     104    padding: 5px;
     105    background: #fff;
     106}
     107
     108.wpstream_option .wpstream-image-upload-wrapper .wpstream-image-upload-buttons .button {
     109    margin-right: 5px;
    89110}
    90111
  • wpstream/trunk/admin/js/admin_control.js

    r3261076 r3312871  
    1515    wpstream_handle_video_selection();   
    1616    wpstream_upload_images_in_wpadmin();
     17
     18    wpstream_upload_player_logo();
    1719 
    1820   
     
    612614}
    613615
     616function wpstream_upload_player_logo(){
     617    var mediaUploader;
     618
     619    // Handle upload button click
     620    jQuery('.wpstream-upload-image').on('click', function(e) {
     621        e.preventDefault();
     622
     623        var button = jQuery(this);
     624        var wrapper = button.closest('.wpstream-image-upload-wrapper');
     625        var inputField = wrapper.find('input[type="hidden"]');
     626        var previewArea = wrapper.find('.wpstream-image-preview');
     627        var removeButton = wrapper.find('.wpstream-remove-image');
     628
     629        // Create media uploader instance if not already created
     630        if (!mediaUploader) {
     631            mediaUploader = wp.media({
     632                title: wpstream_settings_vars.choose_image_text || 'Choose Image',
     633                button: {
     634                    text: wpstream_settings_vars.select_image_text || 'Select Image'
     635                },
     636                multiple: false
     637            });
     638
     639            // When image is selected in the media uploader
     640            mediaUploader.on('select', function() {
     641                var attachment = mediaUploader.state().get('selection').first().toJSON();
     642                inputField.val(attachment.url);
     643
     644                previewArea.find('img').attr('src', attachment.url);
     645                previewArea.show();
     646                removeButton.show();
     647            });
     648        }
     649
     650        // Open the media uploader
     651        mediaUploader.open();
     652    });
     653
     654    // Handle remove button click
     655    jQuery('.wpstream-remove-image').on('click', function(e) {
     656        e.preventDefault();
     657
     658        var button = jQuery(this);
     659        var wrapper = button.closest('.wpstream-image-upload-wrapper');
     660        var inputField = wrapper.find('input[type="hidden"]');
     661        var previewArea = wrapper.find('.wpstream-image-preview');
     662
     663        inputField.val('');
     664        previewArea.hide();
     665        button.hide();
     666    });
     667}
  • wpstream/trunk/admin/js/wpstream_settings.js

    r3296345 r3312871  
    133133        })
    134134    })
     135
     136    jQuery('.wpstream_option_wrapper .wpstream-range-input').on('change',function(e){
     137        var option_name = jQuery(this).attr('id');
     138        var option_value = jQuery(this).val();
     139        var option_type = jQuery(this).attr('type');
     140
     141        jQuery('.theme_options_tab_wpstream .wpstream-save-settings').find('.spinner').css('visibility','visible');
     142        jQuery.ajax({
     143            type: 'POST',
     144            url: ajaxurl,
     145            timeout: 300000,
     146            data: {
     147                'action'        : 'wpstream_update_settings',
     148                'option_name'   : option_name,
     149                'option_type'   : option_type,
     150                'option_value'  : option_value,
     151                'security'      : nonce
     152            },
     153            success: function (data) {
     154                jQuery('.theme_options_tab_wpstream .wpstream-save-settings').find('.spinner').css('visibility','hidden');
     155            },
     156            error: function (jqXHR,textStatus,errorThrown) {
     157                wpstream_show_error_message(jQuery('.theme_options_tab_wpstream .wpstream-save-settings'));
     158            }
     159        })
     160    })
    135161}
    136162
  • wpstream/trunk/includes/class-wpstream-live-api-connection.php

    r3296345 r3312871  
    6161        if($token=='' and $page!='wpstream_plugin_options'){
    6262            // echo 'wpstream_curl_failed: ' . get_option('wpstream_curl_failed');
    63             $text = get_option('wpstream_curl_failed') == false ?
     63            $text = get_option('wpstream_curl_failed') === "0" ?
    6464                'Not connected to WpStream. Please check your credentials <a href="/wp-admin/admin.php?page=wpstream_credentials">here</a>.' :
    6565                'Not connected to WpStream. Please note the errors above and contact support.';
     
    102102        curl_close($curl);
    103103
    104         $curl_failed = false;
     104        $curl_failed = 0;
    105105
    106106        if ($err) {
     
    142142            $curl_response_decoded  =   json_decode($response,JSON_OBJECT_AS_ARRAY);
    143143            if (JSON_ERROR_NONE !== json_last_error()) {
    144                 if (!$quiet){
    145                     echo '<div class="api_not_conected wpstream_error_curl">Critical: Malformed API response #: ' . json_last_error() . '</div>';
    146                 }
    147 
    148                 $curl_failed = json_last_error();
    149 
    150                 $response = json_encode(   array(
    151                     'success'      => false,
    152                     'error'        => json_last_error(),
    153                 ));
    154             }
    155         }
    156 
    157         update_option("wpstream_curl_failed", $curl_failed);
     144                if (!$quiet) {
     145                    echo '<div class="api_not_conected wpstream_error_curl">Critical: Malformed API response #: ' . json_last_error() . '</div>';
     146                }
     147
     148                $curl_failed = json_last_error();
     149
     150                $response = json_encode(array(
     151                    'success' => false,
     152                    'error' => json_last_error(),
     153                ));
     154            }
     155        }
     156
     157        update_option( "wpstream_curl_failed", $curl_failed );
    158158
    159159        return $response;
  • wpstream/trunk/includes/class-wpstream-player.php

    r3283102 r3312871  
    2525        add_action('wp_ajax_nopriv_wpstream_player_check_status', array($this,'wpstream_player_check_status'));
    2626     
    27        
    28    
    29        
    30        
    3127    }
    3228   
     
    352348
    353349
     350        $player_theme = $this->wpstream_get_player_theme();
    354351        $now                =   time().rand(0,1000000);
    355352        $overlay_video_div_id = "random_id_".$now;
     
    478475
    479476
     477            $player_logo_position = get_option('wpstream_player_logo_position');
     478            $player_logo_position_class = '';
     479            if( $player_logo_position && $player_logo_position != '' ){
     480                $player_logo_position_class = 'logo-' . explode( '-', $player_logo_position )[0];
     481            }
    480482                echo'
    481                 <video id="wpstream-video'.$now.'"     '.$poster_data.'  class="video-js vjs-default-skin  vjs-fluid vjs-wpstream '.esc_attr($has_trailer_class).'" playsinline="true" '.$is_muted_str." ".$autoplay_str.'>
     483                <video id="wpstream-video'.$now.'"     '.$poster_data.'  class="video-js vjs-default-skin  vjs-fluid vjs-wpstream ' . esc_attr($has_trailer_class) . ' ' . $player_theme . ' ' . $player_logo_position_class .'" playsinline="true" '.$is_muted_str." ".$autoplay_str.'>
    482484               
    483485                </video>';
     
    750752        }
    751753
    752        
     754        function wpstream_get_player_theme() {
     755            $player_theme = get_option('wpstream_video_player_theme');
     756            $is_streamify_user = $this->wpstream_is_streamify_user();
     757            if ( !empty($player_theme) && !$is_streamify_user ) {
     758                $this->wpstream_enqueue_player_theme_style( $player_theme );
     759                return 'vjs-theme-' . $player_theme;
     760            }
     761
     762            return '';
     763        }
     764
     765        function wpstream_enqueue_player_theme_style( $player_theme ) {
     766            if ( $player_theme != 'default' ) {
     767                wp_enqueue_style('videojs-theme-' . $player_theme, 'https://cdn.jsdelivr.net/npm/@videojs/themes@1/dist/' . $player_theme . '/index.min.css', array(), '1.0.0');
     768
     769            }
     770        }
     771
    753772       
    754773       
     
    816835            wp_enqueue_script('video.min');
    817836            wp_enqueue_script('wpstream-player');
    818            
    819            
    820                     $uri_details        =   $this->wpstream_video_on_demand_player_uri_request($product_id);
    821                     $video_path_final   =   $uri_details['video_path_final'];
    822                     $wpstream_data_setup =  $uri_details['wpstream_data_setup'];
    823                     $video_type          =  $uri_details['video_type'];
    824                     $now                =   time().rand(0,1000000);
    825                    
    826                     $overlay_video_div_id = "random_id_".$now;
    827                     print '<div id="'.esc_attr($overlay_video_div_id).'" class="vjs-title-overlay wpstream-video-title-overlay">'.esc_html__('Playing:','wpstream').' '.get_the_title($product_id).'</div>';
    828 
    829                     $thumb_id               =   get_post_thumbnail_id($product_id);
    830                     $thumb                  =   wp_get_attachment_image_src($thumb_id,'small');
    831                     $usernamestream         =   esc_html ( get_option('wpstream_api_username','') );
    832                    
    833                     $poster_thumb           =   '';
    834                     if(isset($thumb[0])){
    835                         $poster_thumb=$thumb[0];
    836                     }
    837 
    838                     $hlsDecryptionKey       =   get_post_meta($product_id,'hlsDecryptionKey',true);
    839                     $hlsDecryptionKeyIndex  =   get_post_meta($product_id,'hlsDecryptionKeyIndex',true);
    840                    
    841 
    842                     $pack = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
    843                    
    844                
    845 
    846                     $trailer_attachment_id    =  intval (get_post_meta( $product_id, 'video_trailer', true ));
    847                     $video_trailer            = '';
    848                     $video_trailer_type       = '';
    849                     if($trailer_attachment_id!=0) {
    850                         $video_trailer                 =   wp_get_attachment_url( $trailer_attachment_id );
    851                         $attachment_metadata           =   wp_get_attachment_metadata($trailer_attachment_id);
    852                         $video_trailer_type            =   $attachment_metadata['mime_type'];
    853                     }
     837
     838            $player_theme = $this->wpstream_get_player_theme();
     839           
     840            $uri_details        =   $this->wpstream_video_on_demand_player_uri_request($product_id);
     841            $video_path_final   =   $uri_details['video_path_final'];
     842            $wpstream_data_setup =  $uri_details['wpstream_data_setup'];
     843            $video_type          =  $uri_details['video_type'];
     844            $now                =   time().rand(0,1000000);
     845
     846            $overlay_video_div_id = "random_id_".$now;
     847            print '<div id="'.esc_attr($overlay_video_div_id).'" class="vjs-title-overlay wpstream-video-title-overlay">'.esc_html__('Playing:','wpstream').' '.get_the_title($product_id).'</div>';
     848
     849            $thumb_id               =   get_post_thumbnail_id($product_id);
     850            $thumb                  =   wp_get_attachment_image_src($thumb_id,'small');
     851            $usernamestream         =   esc_html ( get_option('wpstream_api_username','') );
     852
     853            $poster_thumb           =   '';
     854            if(isset($thumb[0])){
     855                $poster_thumb=$thumb[0];
     856            }
     857
     858            $hlsDecryptionKey       =   get_post_meta($product_id,'hlsDecryptionKey',true);
     859            $hlsDecryptionKeyIndex  =   get_post_meta($product_id,'hlsDecryptionKeyIndex',true);
     860
     861
     862            $pack = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
     863
     864
     865
     866            $trailer_attachment_id    =  intval (get_post_meta( $product_id, 'video_trailer', true ));
     867            $video_trailer            = '';
     868            $video_trailer_type       = '';
     869            if($trailer_attachment_id!=0) {
     870                $video_trailer                 =   wp_get_attachment_url( $trailer_attachment_id );
     871                $attachment_metadata           =   wp_get_attachment_metadata($trailer_attachment_id);
     872                $video_trailer_type            =   $attachment_metadata['mime_type'];
     873            }
     874
     875            // override trailer setup here (for testing)
     876            // $trailer_attachment_id = 1;
     877            // $video_trailer = '/wp-content/uploads/2023/10/production-ID_4608975.mp4';
     878            // $video_trailer = '/wp-content/uploads/2023/10/ultrawide.mp4';
     879
     880            // If the video is self hosted or external, we should let the user see it
     881            $video_type = intval( get_post_meta($product_id, 'wpstream_product_type', true));
     882
     883
     884            if ( (isset($pack['available_data_mb']) && $pack['available_data_mb']>0) || $video_type === 3 ) {
     885
     886                if($video_path_final==''){
     887                    if( $uri_details['post_type']=='wpstream_product_vod'  && $uri_details['free_video_type']==3 ){
     888                    }else{
     889                        print '<div class="wpstream_vod_notice">This video does not exist or it has been deleted!</div>';
     890                    }
     891
     892                }
     893
     894                // TODO (crerem) populate these from VOD settings
     895                $autoplay = false;
     896                $muted = false;
     897
     898                $wpstream_vod_start_muted   =   intval ( get_option('wpstream_vod_start_muted','') );
     899                if($wpstream_vod_start_muted===1){
     900                    $muted=true;
     901                }
     902                $wpstream_vod_autoplay      =   intval  ( get_option('wpstream_vod_autoplay','') );
     903                if($wpstream_vod_autoplay===1){
     904                    $autoplay=true;
     905                }
     906
     907                $poster_data = 'poster="'.esc_url($poster_thumb).'"';
     908                $has_trailer_class='';
     909                if($trailer_attachment_id !=0){
     910                    $poster_data=''; // cancel poster for theme
     911                    $has_trailer_class='wpstream_theme_player_has_trailer';
     912                }
     913
     914                $player_logo_position       = get_option('wpstream_player_logo_position');
     915                $player_logo_position_class = '';
     916                if( $player_logo_position && $player_logo_position!='' ){
     917                    $player_logo_position_class = 'logo-' . explode( '-', $player_logo_position )[0];
     918                }
     919
     920                echo '<video id="wpstream-video-vod-'.$now.'" class="'.esc_attr($has_trailer_class).' video-js vjs-default-skin  vjs-fluid kuk wpstream_video_on_demand vjs-wpstream ' . $player_theme .' ' . $player_logo_position_class . '"  data-me="'.esc_attr($usernamestream).'" data-product-id="'.$product_id.'"  playsinline preload="auto"
     921                  '. $poster_data.' '.$wpstream_data_setup.'>
     922                        <p class="vjs-no-js">
     923                          To view this video please enable JavaScript, and consider upgrading to a web browser that
     924                          <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
     925                        </p>
     926                    </video>';
     927
     928                if($trailer_attachment_id !=0){
     929                    print '<div class="wpstream_theme_trailer_wrapper">';
     930                    print '<div id="wpstream_video_on_demand_play_trailer_btn_' . $now . '" class="wpstream_video_on_demand_play_trailer">
     931                    <svg width="30" height="24" viewBox="0 0 30 24" fill="none" xmlns="http://www.w3.org/2000/svg">
     932                        <path fill-rule="evenodd" clip-rule="evenodd" d="M26.6667 1.5H3.33337C2.50495 1.5 1.83337 2.17157 1.83337 3V21C1.83337 21.8284 2.50495 22.5 3.33338 22.5H26.6667C27.4951 22.5 28.1667 21.8284 28.1667 21V3C28.1667 2.17157 27.4951 1.5 26.6667 1.5ZM3.33337 0C1.67652 0 0.333374 1.34315 0.333374 3V21C0.333374 22.6569 1.67652 24 3.33338 24H26.6667C28.3236 24 29.6667 22.6569 29.6667 21V3C29.6667 1.34315 28.3236 0 26.6667 0H3.33337ZM4.83337 4C4.55723 4 4.33337 4.22386 4.33337 4.5V6.16667C4.33337 6.44281 4.55723 6.66667 4.83337 6.66667H6.50004C6.77618 6.66667 7.00004 6.44281 7.00004 6.16667V4.5C7.00004 4.22386 6.77618 4 6.50004 4H4.83337ZM23.5 4C23.2239 4 23 4.22386 23 4.5V6.16667C23 6.44281 23.2239 6.66667 23.5 6.66667H25.1667C25.4428 6.66667 25.6667 6.44281 25.6667 6.16667V4.5C25.6667 4.22386 25.4428 4 25.1667 4H23.5ZM4.33337 11.167C4.33337 10.8909 4.55723 10.667 4.83337 10.667H6.50004C6.77618 10.667 7.00004 10.8909 7.00004 11.167V12.8337C7.00004 13.1098 6.77618 13.3337 6.50004 13.3337H4.83337C4.55723 13.3337 4.33337 13.1098 4.33337 12.8337V11.167ZM23.5001 10.667C23.224 10.667 23.0001 10.8909 23.0001 11.167V12.8337C23.0001 13.1098 23.224 13.3337 23.5001 13.3337H25.1668C25.4429 13.3337 25.6668 13.1098 25.6668 12.8337V11.167C25.6668 10.8909 25.4429 10.667 25.1668 10.667H23.5001ZM4.33337 17.833C4.33337 17.5569 4.55723 17.333 4.83337 17.333H6.50004C6.77618 17.333 7.00004 17.5569 7.00004 17.833V19.4997C7.00004 19.7758 6.77618 19.9997 6.50004 19.9997H4.83337C4.55723 19.9997 4.33337 19.7758 4.33337 19.4997V17.833ZM23.5001 17.333C23.224 17.333 23.0001 17.5569 23.0001 17.833V19.4997C23.0001 19.7758 23.224 19.9997 23.5001 19.9997H25.1668C25.4429 19.9997 25.6668 19.7758 25.6668 19.4997V17.833C25.6668 17.5569 25.4429 17.333 25.1668 17.333H23.5001ZM19.0677 13.0997L13.4077 16.5087C13.0434 16.7281 12.6092 16.7094 12.2661 16.5091C11.9218 16.3081 11.6666 15.9224 11.6666 15.4086V8.59072C11.6666 8.07698 11.9218 7.69125 12.2661 7.49026C12.6092 7.28999 13.0434 7.27126 13.4077 7.49064L19.0677 10.8996C19.8663 11.3805 19.8663 12.6188 19.0677 13.0997Z"/>
     933                    </svg>
     934                    '.esc_html__('Play Trailer','wpstream').'</div>';
     935
     936                    print '<div class="wpstream_video_on_demand_play_video_wrapper" id="wpstream_video_on_demand_play_video_btn_' . $now . '" >
     937                    <div class="wpstream_video_on_demand_play_video">
     938                        <svg width="29" height="30" viewBox="0 0 29 30" fill="none" xmlns="http://www.w3.org/2000/svg">
     939                            <path fill-rule="evenodd" clip-rule="evenodd" d="M6.1808 28.9035L26.274 18.1652C29.1087 16.6503 29.1087 12.7497 26.274 11.2348L6.1808 0.496557C4.88769 -0.194506 3.34623 -0.1355 2.1283 0.495357C0.906043 1.12846 1.0095e-06 2.34351 9.38766e-07 3.96179L0 25.4382C-7.07369e-08 27.0565 0.906042 28.2715 2.1283 28.9046C3.34622 29.5355 4.88769 29.5945 6.1808 28.9035ZM24.8221 13.8026C25.5742 14.2045 25.5742 15.1955 24.8221 15.5974L4.72891 26.3356C3.94628 26.7539 3.01386 26.2165 3.01386 25.4382L3.01386 3.96179C3.01386 3.18347 3.94628 2.6461 4.72891 3.06436L24.8221 13.8026Z" fill="#F1F1F1"/>
     940                        </svg>
     941                    </div>
     942                    '.esc_html__('Play Video','wpstream').'
     943                    </div>';
     944
     945
     946
     947                    print '<div id="wpstream_video_on_demand_mute_trailer_btn_' . $now . '" class="wpstream_video_on_demand_mute_trailer">
    854948                 
    855                     // override trailer setup here (for testing)
    856                     // $trailer_attachment_id = 1;
    857                     // $video_trailer = '/wp-content/uploads/2023/10/production-ID_4608975.mp4';
    858                     // $video_trailer = '/wp-content/uploads/2023/10/ultrawide.mp4';
    859 
    860                     // If the video is self hosted or external, we should let the user see it
    861                     $video_type = intval( get_post_meta($product_id, 'wpstream_product_type', true));
    862 
    863 
    864                     if ( (isset($pack['available_data_mb']) && $pack['available_data_mb']>0) || $video_type === 3 ) {
    865                        
    866                         if($video_path_final==''){
    867                             if( $uri_details['post_type']=='wpstream_product_vod'  && $uri_details['free_video_type']==3 ){
    868                             }else{
    869                                 print '<div class="wpstream_vod_notice">This video does not exist or it has been deleted!</div>';
    870                             }
    871                            
    872                         }
    873                        
    874                         // TODO (crerem) populate these from VOD settings
    875                         $autoplay = false;
    876                         $muted = false;
    877 
    878                         $wpstream_vod_start_muted   =   intval ( get_option('wpstream_vod_start_muted','') );
    879                         if($wpstream_vod_start_muted===1){
    880                             $muted=true;
    881                         }
    882                         $wpstream_vod_autoplay      =   intval  ( get_option('wpstream_vod_autoplay','') );
    883                         if($wpstream_vod_autoplay===1){
    884                             $autoplay=true;
    885                         }
    886 
    887                         $poster_data = 'poster="'.esc_url($poster_thumb).'"';
    888                         $has_trailer_class='';
    889                         if($trailer_attachment_id !=0){
    890                             $poster_data=''; // cancel poster for theme
    891                             $has_trailer_class='wpstream_theme_player_has_trailer';
    892                         }
    893 
    894                         echo '<video id="wpstream-video-vod-'.$now.'" class="'.esc_attr($has_trailer_class).' video-js vjs-default-skin  vjs-fluid kuk wpstream_video_on_demand vjs-wpstream"  data-me="'.esc_attr($usernamestream).'" data-product-id="'.$product_id.'"  playsinline preload="auto"
    895                           '. $poster_data.' '.$wpstream_data_setup.'>
    896                                 <p class="vjs-no-js">
    897                                   To view this video please enable JavaScript, and consider upgrading to a web browser that
    898                                   <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
    899                                 </p>
    900                             </video>';
    901                            
    902                         if($trailer_attachment_id !=0){
    903                             print '<div class="wpstream_theme_trailer_wrapper">';
    904                             print '<div id="wpstream_video_on_demand_play_trailer_btn_' . $now . '" class="wpstream_video_on_demand_play_trailer">
    905                             <svg width="30" height="24" viewBox="0 0 30 24" fill="none" xmlns="http://www.w3.org/2000/svg">
    906                                 <path fill-rule="evenodd" clip-rule="evenodd" d="M26.6667 1.5H3.33337C2.50495 1.5 1.83337 2.17157 1.83337 3V21C1.83337 21.8284 2.50495 22.5 3.33338 22.5H26.6667C27.4951 22.5 28.1667 21.8284 28.1667 21V3C28.1667 2.17157 27.4951 1.5 26.6667 1.5ZM3.33337 0C1.67652 0 0.333374 1.34315 0.333374 3V21C0.333374 22.6569 1.67652 24 3.33338 24H26.6667C28.3236 24 29.6667 22.6569 29.6667 21V3C29.6667 1.34315 28.3236 0 26.6667 0H3.33337ZM4.83337 4C4.55723 4 4.33337 4.22386 4.33337 4.5V6.16667C4.33337 6.44281 4.55723 6.66667 4.83337 6.66667H6.50004C6.77618 6.66667 7.00004 6.44281 7.00004 6.16667V4.5C7.00004 4.22386 6.77618 4 6.50004 4H4.83337ZM23.5 4C23.2239 4 23 4.22386 23 4.5V6.16667C23 6.44281 23.2239 6.66667 23.5 6.66667H25.1667C25.4428 6.66667 25.6667 6.44281 25.6667 6.16667V4.5C25.6667 4.22386 25.4428 4 25.1667 4H23.5ZM4.33337 11.167C4.33337 10.8909 4.55723 10.667 4.83337 10.667H6.50004C6.77618 10.667 7.00004 10.8909 7.00004 11.167V12.8337C7.00004 13.1098 6.77618 13.3337 6.50004 13.3337H4.83337C4.55723 13.3337 4.33337 13.1098 4.33337 12.8337V11.167ZM23.5001 10.667C23.224 10.667 23.0001 10.8909 23.0001 11.167V12.8337C23.0001 13.1098 23.224 13.3337 23.5001 13.3337H25.1668C25.4429 13.3337 25.6668 13.1098 25.6668 12.8337V11.167C25.6668 10.8909 25.4429 10.667 25.1668 10.667H23.5001ZM4.33337 17.833C4.33337 17.5569 4.55723 17.333 4.83337 17.333H6.50004C6.77618 17.333 7.00004 17.5569 7.00004 17.833V19.4997C7.00004 19.7758 6.77618 19.9997 6.50004 19.9997H4.83337C4.55723 19.9997 4.33337 19.7758 4.33337 19.4997V17.833ZM23.5001 17.333C23.224 17.333 23.0001 17.5569 23.0001 17.833V19.4997C23.0001 19.7758 23.224 19.9997 23.5001 19.9997H25.1668C25.4429 19.9997 25.6668 19.7758 25.6668 19.4997V17.833C25.6668 17.5569 25.4429 17.333 25.1668 17.333H23.5001ZM19.0677 13.0997L13.4077 16.5087C13.0434 16.7281 12.6092 16.7094 12.2661 16.5091C11.9218 16.3081 11.6666 15.9224 11.6666 15.4086V8.59072C11.6666 8.07698 11.9218 7.69125 12.2661 7.49026C12.6092 7.28999 13.0434 7.27126 13.4077 7.49064L19.0677 10.8996C19.8663 11.3805 19.8663 12.6188 19.0677 13.0997Z"/>
    907                             </svg>
    908                             '.esc_html__('Play Trailer','wpstream').'</div>';
    909 
    910                             print '<div class="wpstream_video_on_demand_play_video_wrapper" id="wpstream_video_on_demand_play_video_btn_' . $now . '" >
    911                             <div class="wpstream_video_on_demand_play_video">
    912                                 <svg width="29" height="30" viewBox="0 0 29 30" fill="none" xmlns="http://www.w3.org/2000/svg">
    913                                     <path fill-rule="evenodd" clip-rule="evenodd" d="M6.1808 28.9035L26.274 18.1652C29.1087 16.6503 29.1087 12.7497 26.274 11.2348L6.1808 0.496557C4.88769 -0.194506 3.34623 -0.1355 2.1283 0.495357C0.906043 1.12846 1.0095e-06 2.34351 9.38766e-07 3.96179L0 25.4382C-7.07369e-08 27.0565 0.906042 28.2715 2.1283 28.9046C3.34622 29.5355 4.88769 29.5945 6.1808 28.9035ZM24.8221 13.8026C25.5742 14.2045 25.5742 15.1955 24.8221 15.5974L4.72891 26.3356C3.94628 26.7539 3.01386 26.2165 3.01386 25.4382L3.01386 3.96179C3.01386 3.18347 3.94628 2.6461 4.72891 3.06436L24.8221 13.8026Z" fill="#F1F1F1"/>
    914                                 </svg>
    915                             </div>
    916                             '.esc_html__('Play Video','wpstream').'
    917                             </div>';
    918 
    919 
    920 
    921                             print '<div id="wpstream_video_on_demand_mute_trailer_btn_' . $now . '" class="wpstream_video_on_demand_mute_trailer">
     949                    <svg width="37" height="36" viewBox="0 0 37 36" fill="none" xmlns="http://www.w3.org/2000/svg">
     950                    <path fill-rule="evenodd" clip-rule="evenodd" d="M1.32143 10.0789H8.69499L18.8964 0L21.1428 0.921053V35.1316L18.8964 36L8.69499 25.8684H1.32143L0 24.5526V11.3947L1.32143 10.0789ZM10.175 23.6842L18.5 31.9474V4.10526L10.175 12.3158L9.24999 12.7105H2.64286V23.2368H9.24999L10.175 23.6842ZM37 17.9737C37.0069 22.2216 35.5329 26.3401 32.8295 29.6263L30.9478 27.7579C33.1613 24.9734 34.3629 21.5249 34.3571 17.9737C34.3571 14.2895 33.0885 10.8974 30.9637 8.21053L32.8454 6.34211C35.5382 9.62494 37.0062 13.735 37 17.9737ZM31.7143 17.9737C31.7193 20.8255 30.7895 23.6011 29.0661 25.8789L27.1738 23.9947C28.4127 22.2295 29.0752 20.1272 29.0714 17.9737C29.0751 15.8287 28.4174 13.7344 27.1871 11.9737L29.0793 10.0895C30.7338 12.2868 31.7143 15.0158 31.7143 17.9737ZM26.4286 17.9737C26.4286 19.4842 26.0057 20.8947 25.2657 22.0947L23.3126 20.1526C23.6249 19.4729 23.7876 18.7345 23.7899 17.9869C23.7922 17.2394 23.634 16.5001 23.3258 15.8184L25.2789 13.8737C26.0083 15.0684 26.4286 16.4737 26.4286 17.9737Z" fill="white"/>
     951                    </svg>
     952                    </div>';
     953                    print '<div id="wpstream_video_on_demand_unmute_trailer_btn_' . $now . '" class="wpstream_video_on_demand_unmute_trailer">
     954                    <svg width="33" height="32" viewBox="0 0 33 32" fill="none" xmlns="http://www.w3.org/2000/svg">
     955                    <path fill-rule="evenodd" clip-rule="evenodd" d="M1.15625 8.85688H7.60813L16.5344 0L18.5 0.809375V30.8719L16.5344 31.635L7.60813 22.7319H1.15625L0 21.5756V10.0131L1.15625 8.85688ZM8.90313 20.8125L16.1875 28.0738V3.6075L8.90313 10.8225L8.09375 11.1694H2.3125V20.4194H8.09375L8.90313 20.8125ZM30.5967 11.3127L32.2316 12.9477L28.2287 16.9506L32.2316 20.9559L30.5967 22.5908L26.5938 18.5856L22.5885 22.5908L20.9536 20.9559L24.9588 16.9506L20.9513 12.95L22.5862 11.3151L26.5938 15.3157L30.5967 11.3127Z" fill="white"/>
     956                    </svg>
     957
     958                    </div>';
     959                    print '<script type="text/javascript">
     960                    //<![CDATA[
     961                        jQuery(document).ready(function(){
     962                            console.log("wpstream_video_on_demand_player 886");
     963                            wpstream_player_initialize_vod({
     964                                titleOverlayElementId:"'.$overlay_video_div_id.'",
     965                                videoElementId: "wpstream-video-vod-'.$now.'",
     966                                trailerUrl: "'.$video_trailer.'",
     967                                videoUrl: "'.$video_path_final.'",
     968                                autoplay: '.var_export($autoplay, true).',
     969                                muted: '.var_export($muted, true).',
     970                                playTrailerButtonElementId: "wpstream_video_on_demand_play_trailer_btn_'.$now.'",
     971                                muteTrailerButtonElementId: "wpstream_video_on_demand_mute_trailer_btn_'.$now.'",
     972                                unmuteTrailerButtonElementId: "wpstream_video_on_demand_unmute_trailer_btn_'.$now.'",
     973                                playVideoButtonElementId: "wpstream_video_on_demand_play_video_btn_'.$now.'",
     974                                playerLogoSettings: {
     975                                    image: "'. $this->wpstream_get_video_player_logo() . '",
     976                                    position: "' . esc_html( get_option('wpstream_player_logo_position','top-right') ) . '",
     977                                    opacity: ' . ( intval ( esc_html( get_option('wpstream_player_logo_opacity','100') ) ) / 100 ) . ',
     978                                    width: 100,
     979                                    height: "auto",
     980                                    padding: 10,
     981                                },
     982                            });
     983                        });
     984                    //]]>
     985                    </script>';
     986                    print '</div>';
     987                }
     988                else {
     989                    print '<script type="text/javascript">
     990                    //<![CDATA[
     991                        jQuery(document).ready(function(){
    922992                         
    923                             <svg width="37" height="36" viewBox="0 0 37 36" fill="none" xmlns="http://www.w3.org/2000/svg">
    924                             <path fill-rule="evenodd" clip-rule="evenodd" d="M1.32143 10.0789H8.69499L18.8964 0L21.1428 0.921053V35.1316L18.8964 36L8.69499 25.8684H1.32143L0 24.5526V11.3947L1.32143 10.0789ZM10.175 23.6842L18.5 31.9474V4.10526L10.175 12.3158L9.24999 12.7105H2.64286V23.2368H9.24999L10.175 23.6842ZM37 17.9737C37.0069 22.2216 35.5329 26.3401 32.8295 29.6263L30.9478 27.7579C33.1613 24.9734 34.3629 21.5249 34.3571 17.9737C34.3571 14.2895 33.0885 10.8974 30.9637 8.21053L32.8454 6.34211C35.5382 9.62494 37.0062 13.735 37 17.9737ZM31.7143 17.9737C31.7193 20.8255 30.7895 23.6011 29.0661 25.8789L27.1738 23.9947C28.4127 22.2295 29.0752 20.1272 29.0714 17.9737C29.0751 15.8287 28.4174 13.7344 27.1871 11.9737L29.0793 10.0895C30.7338 12.2868 31.7143 15.0158 31.7143 17.9737ZM26.4286 17.9737C26.4286 19.4842 26.0057 20.8947 25.2657 22.0947L23.3126 20.1526C23.6249 19.4729 23.7876 18.7345 23.7899 17.9869C23.7922 17.2394 23.634 16.5001 23.3258 15.8184L25.2789 13.8737C26.0083 15.0684 26.4286 16.4737 26.4286 17.9737Z" fill="white"/>
    925                             </svg>
    926                             </div>';
    927                             print '<div id="wpstream_video_on_demand_unmute_trailer_btn_' . $now . '" class="wpstream_video_on_demand_unmute_trailer">
    928                             <svg width="33" height="32" viewBox="0 0 33 32" fill="none" xmlns="http://www.w3.org/2000/svg">
    929                             <path fill-rule="evenodd" clip-rule="evenodd" d="M1.15625 8.85688H7.60813L16.5344 0L18.5 0.809375V30.8719L16.5344 31.635L7.60813 22.7319H1.15625L0 21.5756V10.0131L1.15625 8.85688ZM8.90313 20.8125L16.1875 28.0738V3.6075L8.90313 10.8225L8.09375 11.1694H2.3125V20.4194H8.09375L8.90313 20.8125ZM30.5967 11.3127L32.2316 12.9477L28.2287 16.9506L32.2316 20.9559L30.5967 22.5908L26.5938 18.5856L22.5885 22.5908L20.9536 20.9559L24.9588 16.9506L20.9513 12.95L22.5862 11.3151L26.5938 15.3157L30.5967 11.3127Z" fill="white"/>
    930                             </svg>
    931 
    932                             </div>';
    933                             print '<script type="text/javascript">
    934                             //<![CDATA[
    935                                 jQuery(document).ready(function(){
    936                                     console.log("wpstream_video_on_demand_player 886");
    937                                     wpstream_player_initialize_vod({
    938                                         titleOverlayElementId:"'.$overlay_video_div_id.'",
    939                                         videoElementId: "wpstream-video-vod-'.$now.'",
    940                                         trailerUrl: "'.$video_trailer.'",
    941                                         videoUrl: "'.$video_path_final.'",
    942                                         autoplay: '.var_export($autoplay, true).',
    943                                         muted: '.var_export($muted, true).',
    944                                         playTrailerButtonElementId: "wpstream_video_on_demand_play_trailer_btn_'.$now.'",
    945                                         muteTrailerButtonElementId: "wpstream_video_on_demand_mute_trailer_btn_'.$now.'",
    946                                         unmuteTrailerButtonElementId: "wpstream_video_on_demand_unmute_trailer_btn_'.$now.'",
    947                                         playVideoButtonElementId: "wpstream_video_on_demand_play_video_btn_'.$now.'",
    948                                     });
    949                                 });
    950                             //]]>
    951                             </script>';
    952                             print '</div>';
    953                         }
    954                         else {
    955                             print '<script type="text/javascript">
    956                             //<![CDATA[
    957                                 jQuery(document).ready(function(){
    958                                  
    959                                 console.log("wpstream_video_on_demand_player 907");
    960 
    961                                     wpstream_player_initialize_vod({
    962                                         titleOverlayElementId:"'.$overlay_video_div_id.'",
    963                                         videoElementId: "wpstream-video-vod-'.$now.'",
    964                                         videoUrl: "'.$video_path_final.'",
    965                                         autoplay: '.var_export($autoplay, true).',
    966                                         muted: '.var_export($muted, true).',
    967                                     });
    968                                 });
    969                             //]]>
    970                             </script>';
    971                         }   
    972                     }else{
    973                         print '<div class="wpstream_insuficent_res">'.esc_html__('Insufficient resources to stream this title','wpstream').'</div>';
    974                     }
     993                        console.log("wpstream_video_on_demand_player 907");
     994
     995                            wpstream_player_initialize_vod({
     996                                titleOverlayElementId:"'.$overlay_video_div_id.'",
     997                                videoElementId: "wpstream-video-vod-'.$now.'",
     998                                videoUrl: "'.$video_path_final.'",
     999                                autoplay: '.var_export($autoplay, true).',
     1000                                muted: '.var_export($muted, true).',
     1001                                playerLogoSettings: {
     1002                                    image: "'. $this->wpstream_get_video_player_logo() . '",
     1003                                    position: "' . esc_html( get_option('wpstream_player_logo_position','top-right') ) . '",
     1004                                    opacity: ' . ( intval ( esc_html( get_option('wpstream_player_logo_opacity','100') ) ) / 100 ) . ',
     1005                                    width: 100,
     1006                                    height: "auto",
     1007                                    padding: 10,
     1008                                }
     1009                            });
     1010                        });
     1011                    //]]>
     1012                    </script>';
     1013                }
     1014            }else{
     1015                print '<div class="wpstream_insuficent_res">'.esc_html__('Insufficient resources to stream this title','wpstream').'</div>';
     1016            }
    9751017
    9761018        }
     
    9861028            wp_enqueue_script('video.min');
    9871029            wp_enqueue_script('wpstream-player');
    988          
    989            
     1030
     1031
     1032            $player_theme = $this->wpstream_get_player_theme();
    9901033            $now                =   time().rand(0,1000000);
    9911034            $overlay_video_div_id = "random_id_".$now;
     
    10171060         
    10181061                     
    1019             // TODO (crerem) populate these from VOD settings
    1020             $autoplay = false;
    1021             $muted = true;
     1062            $autoplay = false;
     1063            $muted = false;
     1064
     1065            if( intval ( get_option('wpstream_vod_start_muted','') ) === 1){
     1066                $muted = true;
     1067            }
     1068            if( intval  ( get_option('wpstream_vod_autoplay','') ) === 1 ){
     1069                $autoplay = true;
     1070            }
    10221071            $video_path_final='';
    10231072            $has_trailer_class='wpstream_theme_player_has_trailer';
    10241073
    1025             echo '<video id="wpstream-video-vod-'.$now.'" class="video-js vjs-default-skin  vjs-fluid kuk wpstream_video_on_demand vjs-wpstream '.esc_attr(  $has_trailer_class ).' "  data-me="'.esc_attr($usernamestream).'" data-product-id="'.$product_id.'"  playsinline preload="auto"
     1074            echo '<video id="wpstream-video-vod-'.$now.'" class="video-js vjs-default-skin  vjs-fluid kuk wpstream_video_on_demand vjs-wpstream '.esc_attr(  $has_trailer_class ).' ' . $player_theme . '"  data-me="'.esc_attr($usernamestream).'" data-product-id="'.$product_id.'"  playsinline preload="auto"
    10261075                   >
    10271076                    <p class="vjs-no-js">
     
    10661115                            playTrailerButtonElementId: "wpstream_video_on_demand_play_trailer_btn_'.$now.'",
    10671116                            muteTrailerButtonElementId: "wpstream_video_on_demand_mute_trailer_btn_'.$now.'",
    1068                             unmuteTrailerButtonElementId: "wpstream_video_on_demand_unmute_trailer_btn_'.$now.'",
     1117                            unmuteTrailerButtonElementId: "wpstream_video_on_demand_unmute_trailer_btn_'.$now.'",,
     1118                            playerLogoSettings: {
     1119                                    image: "'. $this->wpstream_get_video_player_logo() . '",
     1120                                    position: "' . esc_html( get_option('wpstream_player_logo_position','top-right') ) . '",
     1121                                    opacity: ' . ( intval ( esc_html( get_option('wpstream_player_logo_opacity','100') ) ) / 100 ) . ',
     1122                                    width: 100,
     1123                                    height: "auto",
     1124                                    padding: 10,
     1125                                },
    10691126                        });
    10701127                    });
     
    14711528                   
    14721529        }
    1473    
    1474    
     1530
     1531    /**
     1532     * Get the video player logo URL.
     1533     *
     1534     * @return mixed|string
     1535     */
     1536    public function wpstream_get_video_player_logo() {
     1537        if ( $this->wpstream_is_streamify_user() ) {
     1538            return WPSTREAM_PLUGIN_DIR_URL . 'img/default_300.png';
     1539        }
     1540
     1541        $logo = get_option( 'wpstream_player_logo', '' );
     1542        if ( ! empty( $logo ) ) {
     1543            return $logo;
     1544        }
     1545    }
     1546
     1547    public function wpstream_is_streamify_user() {
     1548        $pack_details = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
     1549        if ( isset( $pack_details['total_data_mb'] ) && $pack_details['total_data_mb'] === 500 &&
     1550            isset( $pack_details['total_storage_mb'] ) && $pack_details['total_storage_mb'] === 100
     1551        ) {
     1552            return true;
     1553        }
     1554        return false;
     1555    }
    14751556}
  • wpstream/trunk/public/class-wpstream-public.php

    r3278949 r3312871  
    7272
    7373            wp_enqueue_style('wpstream-style',          plugin_dir_url( __FILE__ ) .'/css/wpstream_style.css',array(), WPSTREAM_PLUGIN_VERSION, 'all' );
    74             wp_enqueue_style('video-js.min',            plugin_dir_url( __FILE__ ).'/css/video-js.min.css', array(), WPSTREAM_PLUGIN_VERSION, 'all');
    75             wp_enqueue_style('videojs-wpstream-player', plugin_dir_url( __FILE__ ).'/css/videojs-wpstream.css', array(), WPSTREAM_PLUGIN_VERSION, 'all');
     74            wp_enqueue_style('video-js.min',            plugin_dir_url( __FILE__ ).'/css/video-js.css', array(), WPSTREAM_PLUGIN_VERSION, 'all');
     75            wp_enqueue_style(
     76                'videojs-wpstream-player',
     77                plugin_dir_url( __FILE__ ).'/css/videojs-wpstream.css',
     78                array(),
     79                WPSTREAM_PLUGIN_VERSION . '.' . filemtime( plugin_dir_path(__FILE__) . 'css/videojs-wpstream.css' ),
     80                'all'
     81            );
    7682            wp_enqueue_style('wpstream-integrations',   plugin_dir_url( __DIR__ ) .'integrations/css/integrations.css',array(), WPSTREAM_PLUGIN_VERSION, 'all' );
    7783    }
     
    8490    public function enqueue_scripts() {
    8591
    86              
    87                 wp_register_script('video.min',              'https://vjs.zencdn.net/8.20.0/video.min.js', WPSTREAM_PLUGIN_VERSION, true);
     92        // Register the VideoJS script
     93        // Enqueuing is happing directly wherever is used
     94        wp_register_script('video.min',              'https://vjs.zencdn.net/8.20.0/video.min.js', WPSTREAM_PLUGIN_VERSION, true);
     95
     96        // Enqueue the VideoJS Logo plugin script
     97        wp_enqueue_script(
     98            'videojs-logo',
     99            'https://cdn.jsdelivr.net/npm/videojs-logo@latest/dist/videojs-logo.min.js',
     100            array('video.min'),
     101            '3.0.0',
     102            true
     103        );
    88104                wp_register_script('youtube.min',         
    89105                                  plugin_dir_url( __FILE__ ).'js/youtube.min.js',
     
    91107                                  WPSTREAM_PLUGIN_VERSION, true);
    92108             
    93                 wp_register_script('wpstream-player',     
    94                                     plugin_dir_url( __FILE__ ).'js/wpstream-player.js',
    95                                     array('video.min'),
    96                                     WPSTREAM_PLUGIN_VERSION,true);
    97 
    98                 wp_localize_script('wpstream-player', 'wpstream_player_vars',
     109                wp_register_script(
     110                    'wpstream-player',
     111                    plugin_dir_url( __FILE__ ).'js/wpstream-player.js',
     112                    array('video.min'),
     113                    WPSTREAM_PLUGIN_VERSION . '.' . filemtime(plugin_dir_path(__FILE__) . 'js/wpstream-player.js'),
     114                    true
     115                );
     116
     117                wp_localize_script('wpstream-player', 'wpstream_player_vars',
    99118                    array(
    100119                        'admin_url'             =>  get_admin_url(),
     
    106125                        'wpstream_player_state_paused_msg'             =>  esc_html__('The live stream is paused','wpstream'),
    107126                        'wpstream_player_state_ended_msg'             =>  esc_html__('The live stream has ended','wpstream'),
     127                        'wpstream_player_theme' => get_option('wpstream_video_player_theme'),
     128                        'playerLogoSettings'  => array(
     129                            'imageUrl'     => $this->main->wpstream_player->wpstream_get_video_player_logo(),
     130                            'position'  => get_option( 'wpstream_player_logo_position', 'top-left' ),
     131                            'opacity'   => get_option('wpstream_player_logo_opacity', '100'),
     132                        ),
    108133                    )
    109134                );
     
    181206                       
    182207    }
     208
    183209       
    184210       
  • wpstream/trunk/public/css/video-js.css

    r2162139 r3312871  
    594594  height: 3.0em;
    595595  background-color: #2B333F;
    596   background-color: rgba(43, 51, 63, 0.7); }
     596  background-color: rgba(43, 51, 63, 0.7);
     597}
     598
     599.video-js:not(.vjs-theme-default) .vjs-control-bar {
     600  height: 54px;
     601}
     602
     603/* Fantasy theme */
     604.video-js.vjs-theme-fantasy .vjs-control {
     605  height: 100%;
     606  align-items: center;
     607}
     608
     609.video-js.vjs-theme-fantasy .vjs-control-bar .vjs-play-control {
     610  width: 4em;
     611}
     612
     613.video-js.vjs-theme-fantasy .vjs-play-progress:before {
     614  content: '';
     615}
     616
     617.vjs-wpstream.vjs-theme-fantasy .vjs-play-control.vjs-button>.vjs-icon-placeholder:before {
     618  font-size: 1.8em;
     619}
     620
     621.vjs-wpstream.vjs-theme-fantasy .vjs-button > .vjs-icon-placeholder:before {
     622  display: flex;
     623  align-items: center;
     624  width: 1.2em;
     625}
     626
     627.wp-theme-hello-wpstream .vjs-wpstream.vjs-theme-fantasy .vjs-button > .vjs-icon-placeholder:before {
     628  line-height: 1.9 !important;
     629}
     630
     631.video-js.vjs-theme-fantasy .vjs-play-progress:before {
     632  top: -.25em;
     633}
     634
     635.video-js.vjs-theme-fantasy .vjs-play-progress {
     636  background-color: var(--vjs-theme-fantasy--primary);
     637}
     638
     639.vjs-wpstream.vjs-theme-fantasy .vjs-volume-panel .vjs-button > .vjs-icon-placeholder:before {
     640  display: block;
     641  line-height: 54px;
     642}
     643
     644.wpstream-featured-player-wrapper .video-js.vjs-theme-fantasy .vjs-live-display {
     645  margin: 0;
     646}
     647/* End of Fantasy theme */
     648
     649/* City theme */
     650.video-js.vjs-theme-city .vjs-control-bar {
     651  height: 60px;
     652}
     653
     654.video-js.vjs-theme-city .vjs-control-bar .vjs-remaining-time {
     655  display: flex;
     656  align-content: center;
     657  flex-wrap: wrap;
     658
     659  flex: 3 1;
     660  line-height: 50px;
     661  order: 1;
     662  text-align: left;
     663  height: 100%;
     664  left: 20px;
     665}
     666
     667.function_wpstream_live_event_player .video-js.vjs-theme-city .vjs-control-bar .vjs-remaining-time {
     668  display: none;
     669}
     670
     671.function_wpstream_live_event_player .video-js.vjs-theme-city .vjs-live-control {
     672  flex: 3 1;
     673  left: 20px;
     674}
     675
     676.function_wpstream_live_event_player .video-js.vjs-theme-city .vjs-live-control .vjs-live-display {
     677  background-color: #670000;
     678  margin-top: 11px;
     679}
     680
     681.video-js.vjs-theme-city .vjs-progress-control {
     682  width: 100%;
     683  position: absolute;
     684  height: 20px;
     685}
     686
     687.video-js.vjs-theme-city > .vjs-control-bar {
     688  background-color: initial;
     689}
     690
     691.video-js.vjs-theme-city > .vjs-control-bar > .vjs-play-control {
     692  flex: 8 1;
     693}
     694
     695.video-js.vjs-theme-city .vjs-progress-control .vjs-progress-holder {
     696  margin: 0;
     697}
     698
     699.video-js.vjs-theme-city .vjs-progress-control .vjs-volume-panel .vjs-volume-bar {
     700  background-color: initial;
     701}
     702
     703.video-js.vjs-theme-city .vjs-volume-panel .vjs-volume-bar {
     704  background-color: initial;
     705}
     706
     707.video-js.vjs-theme-city .vjs-volume-panel.vjs-volume-panel-horizontal:hover {
     708  width: 3em;
     709}
     710
     711.video-js.vjs-theme-city .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal {
     712  width: 3em !important;
     713  height: 100%;
     714  opacity: 1;
     715}
     716
     717.video-js.vjs-theme-city .vjs-volume-panel:hover .vjs-volume-control.vjs-volume-horizontal {
     718  height: 100%;
     719}
     720
     721.video-js.vjs-theme-city .vjs-volume-panel > *,
     722.video-js.vjs-theme-forest .vjs-volume-panel > * {
     723  transition: none !important;
     724}
     725
     726.video-js.vjs-theme-city .vjs-volume-level,
     727.video-js.vjs-theme-forest .vjs-volume-level {
     728  background-color: transparent !important;
     729}
     730
     731.video-js.vjs-theme-city .vjs-volume-level:before {
     732    position: relative;
     733}
     734
     735.video-js.vjs-theme-city .vjs-volume-panel {
     736  width: 34px !important;
     737  flex: 1 !important;
     738  padding-top: 0;
     739}
     740
     741.video-js.vjs-theme-city .vjs-volume-bar:before {
     742  position: relative;
     743}
     744
     745.video-js.vjs-theme-city .vjs-volume-panel:not(:hover) .vjs-volume-control .vjs-mouse-display {
     746  visibility: hidden;
     747}
     748
     749.vjs-wpstream.vjs-theme-city .vjs-picture-in-picture-control,
     750.vjs-wpstream.vjs-theme-city .vjs-fullscreen-control,
     751.vjs-wpstream.vjs-theme-city .vjs-fullscreen-control:hover {
     752  background-size: auto !important;
     753  background-position: 50% 54% !important;
     754}
     755/* End of City theme */
     756
     757/* Forest theme */
     758.video-js.vjs-theme-forest .vjs-control-bar {
     759  height: 3em;
     760  background-color: transparent;
     761}
     762.video-js.vjs-theme-forest .vjs-control-bar button .vjs-icon-placeholder:before, .vjs-wpstream .vjs-live-control {
     763  line-height: 1.6;
     764}
     765.video-js.vjs-theme-forest .vjs-control-bar .vjs-picture-in-picture-control,
     766.video-js.vjs-theme-forest .vjs-control-bar .vjs-fullscreen-control {
     767  width: 3em;
     768  height: 3em;
     769}
     770.video-js.vjs-theme-forest .vjs-volume-panel.vjs-volume-panel-horizontal:hover {
     771  width: 34px;
     772  transition: none;
     773}
     774.video-js.vjs-theme-forest .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal {
     775  transition: none;
     776}
     777.video-js.vjs-theme-forest .vjs-volume-panel .vjs-slider {
     778  background-color: transparent;
     779}
     780.video-js.vjs-theme-forest .vjs-volume-panel:not(:hover) .vjs-volume-control .vjs-mouse-display {
     781  visibility: hidden;
     782}
     783.video-js.vjs-theme-forest .vjs-volume-panel .vjs-volume-control.vjs-volume-horizontal {
     784  width: 5em;
     785  height: 3em;
     786  opacity: 1;
     787}
     788
     789.video-js.vjs-theme-forest .vjs-big-play-button .vjs-icon-placeholder {
     790  display: block;
     791}
     792
     793.video-js.vjs-theme-forest .vjs-progress-control:hover .vjs-time-tooltip,
     794.video-js.vjs-theme-forest .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip {
     795  font-size: 1em;
     796}
     797
     798/* End of Forest theme */
     799
     800/* Sea theme */
     801.video-js.vjs-theme-sea .vjs-control-bar {
     802  height: 4em;
     803}
     804.video-js.vjs-theme-sea .vjs-progress-control {
     805  height: 4em;
     806}
     807.vjs-wpstream.vjs-theme-sea .vjs-time-control {
     808    height: 4em;
     809    line-height: 4em;
     810}
     811.video-js.vjs-theme-sea .vjs-volume-panel {
     812  height: 4em;
     813}
     814
     815.theme-hello-wpstream .function_wpstream_live_event_player .video-js.vjs-theme-sea .vjs-live-control .vjs-live-display {
     816  background-color: #670000;
     817  margin-top: 11px;
     818}
     819/* End of Sea theme */
     820
     821.video-js .vjs-poster img {
     822  width: 100%;
     823}
    597824
    598825.vjs-has-started .vjs-control-bar {
  • wpstream/trunk/public/css/videojs-wpstream.css

    r2438830 r3312871  
    1 .vjs-wpstream .vjs-control-bar {
     1.vjs-wpstream.vjs-theme-default .vjs-control-bar {
    22    background-color: hsl(0 0% 100% / 0);
    33    padding: 0px 12px;
    44    height: auto;
    55    height: 4em;
     6    align-items: center;
    67}
    78
     
    4142    font-size: 1.1em;
    4243    line-height: 3em;
     44    height: 4em;
    4345}
    4446
     
    4648.vjs-wpstream .vjs-volume-panel .vjs-volume-control {
    4749    margin: 0px 0px 0px 0px;
     50}
     51
     52.vjs-wpstream .vjs-volume-panel .vjs-volume-control .vjs-volume-tooltip {
     53    position: static;
     54    margin-top: -20px;
    4855}
    4956
  • wpstream/trunk/public/css/wpstream_style.css

    r3288783 r3312871  
    213213.video-js:hover .vjs-icon-placeholder{
    214214    opacity: 1;
     215}
     216
     217.video-js.vjs-logo.logo-top .vjs-logo-content {
     218    top: 30px !important;
     219}
     220
     221.video-js.vjs-logo.logo-bottom .vjs-logo-content {
     222    bottom: 40px !important;
     223}
     224
     225.video-js .vjs-logo-content {
     226    position: absolute;
     227}
     228
     229.video-js.vjs-has-started .vjs-logo-content img {
     230    height: auto;
     231}
     232
     233.video-js .vjs-volume-level:before {
     234    font-size: 10px !important;
     235    /*top: 0 !important;*/
    215236}
    216237
  • wpstream/trunk/public/js/wpstream-player.js

    r3288783 r3312871  
    297297    });
    298298
     299    this.applyTheme(wpstream_player_vars.wpstream_player_theme)
     300
     301      if ( typeof this.player.logo === 'function' && wpstream_player_vars.playerLogoSettings ) {
     302          this.player.logo({
     303              image: wpstream_player_vars.playerLogoSettings.imageUrl,
     304              position: wpstream_player_vars.playerLogoSettings.position,
     305              width: 100,
     306              height: 'auto',
     307              opacity: parseFloat(wpstream_player_vars.playerLogoSettings.opacity)/100,
     308              padding: 10,
     309          });
     310      }
     311
    299312    if (this.master.settings.theaterModeButtons) {
    300313      const Button = videojs.getComponent("Button");
     
    451464      if (!this.playingTrailer) this.qoe.error();
    452465    });
     466  }
     467
     468  applyTheme(themeName) {
     469    const themes = ['vjs-theme-city', 'vjs-theme-forest', 'vjs-theme-sunset', 'vjs-theme-sea'];
     470    themes.forEach(theme => {
     471      this.player.removeClass(theme);
     472    })
     473
     474    this.player.addClass(`vjs-theme-${themeName}`);
     475  }
     476
     477  initThemeSelector() {
     478    const Button = videojs.getComponent('Button');
     479    const owner = this;
     480
    453481  }
    454482
     
    12401268  player.muted(settings.muted);
    12411269
     1270  if ( typeof player.logo === 'function' && settings.playerLogoSettings ) {
     1271    player.logo(settings.playerLogoSettings);
     1272  }
     1273
    12421274  const originalPoster = player.poster();
    12431275
  • wpstream/trunk/readme.txt

    r3296345 r3312871  
    55Tested up to: 6.8
    66Requires PHP: 7.1
    7 Stable tag: 4.6.7.3
     7Stable tag: 4.6.7.4
    88License: GPL
    99License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
     
    138138== Changelog ==
    139139
     140= 4.6.7.4 =
     141* Feature - Give the video player a different look using the theme option
     142* Feature - Display a logo over the video player
     143* Enhancement - Fix issue regarding the basic streaming functionality when the video doesn't start
     144
    140145= 4.6.7.3 =
    141146* Fix - Broken WpStream login functionality
  • wpstream/trunk/streamify/streamify.php

    r3233738 r3312871  
    342342
    343343function wpstreamify_add_rewrite_rules() {
    344     add_rewrite_rule('^wpstreamify/(.+)$', 'index.php?wpstreamify_path=$matches[1]', 'top');
     344    $rewrite_rules = get_option('rewrite_rules');
     345    $rule_pattern = '^wpstreamify/(.+)$';
     346    $rule_target = 'index.php?wpstreamify_path=$matches[1]';
     347
     348    // Check if the rewrite rule already exists
     349    if (!isset($rewrite_rules[$rule_pattern]) || $rewrite_rules[$rule_pattern] !== $rule_target) {
     350        add_rewrite_rule($rule_pattern, $rule_target, 'top');
     351        flush_rewrite_rules();
     352    }
    345353}
    346354add_action('init', 'wpstreamify_add_rewrite_rules');
  • wpstream/trunk/wpstream.php

    r3296345 r3312871  
    44 * Plugin URI:        http://wpstream.net
    55 * Description:       WpStream is a platform that allows you to live stream, create Video-on-Demand, and offer Pay-Per-View videos. We provide an affordable and user-friendly way for businesses, non-profits, and public institutions to broadcast their content and monetize their work.
    6  * Version:           4.6.7.3
     6 * Version:           4.6.7.4
    77 * Author:            wpstream
    88 * Author URI:        http://wpstream.net
     
    1515    die;
    1616}
    17 define('WPSTREAM_PLUGIN_VERSION', '4.6.7.3');
     17define('WPSTREAM_PLUGIN_VERSION', '4.6.7.4');
    1818define('WPSTREAM_CLUBLINK', 'wpstream.net');
    1919define('WPSTREAM_CLUBLINKSSL', 'https');
Note: See TracChangeset for help on using the changeset viewer.