| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
* To change this license header, choose License Headers in Project Properties. |
| 5 |
* To change this template file, choose Tools | Templates |
| 6 |
* and open the template in the editor. |
| 7 |
*/ |
| 8 |
|
| 9 |
|
| 10 |
/** |
| 11 |
* Description of class-wpstream-player |
| 12 |
* |
| 13 |
* @author cretu |
| 14 |
*/ |
| 15 |
class Wpstream_Player{ |
| 16 |
public $main; |
| 17 |
|
| 18 |
public function __construct($plugin_main) { |
| 19 |
$this->main = $plugin_main; |
| 20 |
|
| 21 |
add_filter( 'the_content',array($this, 'wpstream_filter_the_title') ); |
| 22 |
add_action( 'woocommerce_before_single_product', array($this,'wpstream_user_logged_in_product_already_bought') ); |
| 23 |
|
| 24 |
add_action( 'wp_ajax_wpstream_player_check_status', array($this,'wpstream_player_check_status') ); |
| 25 |
add_action('wp_ajax_nopriv_wpstream_player_check_status', array($this,'wpstream_player_check_status')); |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
/** |
| 39 |
* |
| 40 |
* edited 4.0 |
| 41 |
* |
| 42 |
* check player status |
| 43 |
* |
| 44 |
* @author cretu |
| 45 |
*/ |
| 46 |
|
| 47 |
public function wpstream_player_check_status(){ |
| 48 |
$channel_id = intval($_POST['channel_id']); |
| 49 |
|
| 50 |
|
| 51 |
$transient_name = 'event_data_to_return_'. $channel_id; |
| 52 |
$event_data_for_transient = get_transient( $transient_name ); |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
if ( false === $event_data_for_transient || $event_data_for_transient=='' ) { //ws || $hls_to_return=='' |
| 57 |
$notes = 'wpstream_player_check_status_note_from_js'; |
| 58 |
$event_status = $this->main->wpstream_live_connection-> wpstream_check_event_status_api_call($channel_id,$notes); |
| 59 |
$event_data_for_transient = $event_status; |
| 60 |
|
| 61 |
set_transient($transient_name,$event_data_for_transient,45); |
| 62 |
} |
| 63 |
|
| 64 |
|
| 65 |
if( isset($event_data_for_transient['hls_playback_url']) && $event_data_for_transient['hls_playback_url']!=''){ |
| 66 |
echo json_encode( array( |
| 67 |
|
| 68 |
'started' => 'yes', |
| 69 |
'channel_id' => $channel_id, |
| 70 |
'event_uri' => $event_data_for_transient['hls_playback_url'], |
| 71 |
'live_conect_views' => $event_data_for_transient['stats_url'], |
| 72 |
'chat_url' => $event_data_for_transient['chat_url'], |
| 73 |
'$event_data_for_transient'=>$event_data_for_transient |
| 74 |
|
| 75 |
|
| 76 |
)); |
| 77 |
update_post_meta($channel_id,'stream_name',$event_data_for_transient['stream_name']); |
| 78 |
update_post_meta($channel_id,'hls_key_retrieval_url',$event_data_for_transient['hls_key_retrieval_url']); |
| 79 |
delete_transient( 'free_event_streamName_'.$event_data_for_transient['stream_name']); |
| 80 |
|
| 81 |
}else{ |
| 82 |
echo json_encode( array( |
| 83 |
'started' => 'no', |
| 84 |
'server_id' => '', |
| 85 |
'channel_id' => $channel_id, |
| 86 |
'event_uri' => '', |
| 87 |
'live_conect_views' => '', |
| 88 |
'chat_url' => '', |
| 89 |
|
| 90 |
)); |
| 91 |
|
| 92 |
} |
| 93 |
|
| 94 |
die(); |
| 95 |
} |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
/** |
| 100 |
* Insert player in page |
| 101 |
* |
| 102 |
* @author cretu |
| 103 |
*/ |
| 104 |
public function wpstream_filter_the_title( $content ) { |
| 105 |
if(function_exists('remove_wpstream_filter')){ |
| 106 |
return $content; |
| 107 |
} |
| 108 |
|
| 109 |
if( is_singular('wpstream_product') || is_singular('wpstream_product_vod') ){ |
| 110 |
global $post; |
| 111 |
$args=array('id'=>$post->ID); |
| 112 |
$custom_content = $this->wpstream_insert_player_inpage($args); |
| 113 |
$content = '<div class="wpestream_inserted_player">'.$custom_content.'</div>'.$content; |
| 114 |
return $content; |
| 115 |
}else{ |
| 116 |
return $content; |
| 117 |
} |
| 118 |
} |
| 119 |
|
| 120 |
/** |
| 121 |
* Insert player in page |
| 122 |
* |
| 123 |
* @author cretu |
| 124 |
*/ |
| 125 |
|
| 126 |
public function wpstream_insert_player_inpage($attributes, $content = null){ |
| 127 |
$product_id = ''; |
| 128 |
$return_string = ''; |
| 129 |
$attributes = shortcode_atts( |
| 130 |
array( |
| 131 |
'id' => 0, |
| 132 |
), $attributes) ; |
| 133 |
|
| 134 |
|
| 135 |
if ( isset($attributes['id']) ){ |
| 136 |
$product_id=$attributes['id']; |
| 137 |
} |
| 138 |
|
| 139 |
if(intval($product_id)==0){ |
| 140 |
$product_id= $this->wpstream_player_retrive_first_id(); |
| 141 |
} |
| 142 |
|
| 143 |
ob_start(); |
| 144 |
|
| 145 |
$this->wpstream_video_player_shortcode($product_id); |
| 146 |
$return_string= ob_get_contents(); |
| 147 |
ob_end_clean(); |
| 148 |
|
| 149 |
return $return_string; |
| 150 |
} |
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
/** |
| 156 |
* Video Player shortcode |
| 157 |
* |
| 158 |
* @author cretu |
| 159 |
*/ |
| 160 |
|
| 161 |
public function wpstream_video_player_shortcode($from_sh_id='') { |
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
if ( is_user_logged_in() ) { |
| 166 |
global $product; |
| 167 |
$current_user = wp_get_current_user(); |
| 168 |
$product_id = intval($from_sh_id); |
| 169 |
$term_list = wp_get_post_terms($product_id, 'product_type'); |
| 170 |
$possible_bundle = get_post_meta($product_id, 'wpstream_part_of_bundle', true); |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
if ( |
| 176 |
|
| 177 |
( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) && wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product_id) ) || |
| 178 |
( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) && (intval($possible_bundle)!=0) && wc_customer_bought_product( $current_user->user_email, $current_user->ID, $possible_bundle) ) || |
| 179 |
get_post_type($product_id)=='wpstream_product' || |
| 180 |
get_post_type($product_id)=='wpstream_product_vod' ){ |
| 181 |
global $product; |
| 182 |
echo '<div class="wpstream_player_wrapper wpstream_player_shortcode"><div class="wpstream_player_container">'; |
| 183 |
|
| 184 |
|
| 185 |
if( get_post_type($product_id) == 'wpstream_product' ){ |
| 186 |
$this->wpstream_live_event_player($product_id); |
| 187 |
}else if( get_post_type($product_id) == 'wpstream_product_vod' ){ |
| 188 |
$this->wpstream_video_on_demand_player($product_id); |
| 189 |
}else{ |
| 190 |
|
| 191 |
$is_subscription_live_event = esc_html(get_post_meta($product_id,'_subscript_live_event',true)); |
| 192 |
|
| 193 |
if( $term_list[0]->name=='live_stream' || ( $term_list[0]->name=='subscription' && $is_subscription_live_event=='yes' ) ){ |
| 194 |
$this->wpstream_live_event_player($product_id); |
| 195 |
}else if( $term_list[0]->name=='video_on_demand' || ($term_list[0]->name=='subscription' && $is_subscription_live_event=='no' ) ){ |
| 196 |
$this->wpstream_video_on_demand_player($product_id); |
| 197 |
} |
| 198 |
} |
| 199 |
|
| 200 |
|
| 201 |
echo '</div></div>'; |
| 202 |
}else{ |
| 203 |
|
| 204 |
if( get_post_type($product_id) == 'product' ){ |
| 205 |
echo '<div class="wpstream_player_wrapper wpstream_player_shortcode no_buy"><div class="wpstream_player_container">'; |
| 206 |
$message =esc_html( get_option('wpstream_product_not_bought','You did not yet purchase this item.')) ; |
| 207 |
echo '<div class="wpstream_notice" style="background:#e16767;">'.esc_html($message).'</div>'; |
| 208 |
echo '</div></div>'; |
| 209 |
} |
| 210 |
} |
| 211 |
|
| 212 |
|
| 213 |
}else{ |
| 214 |
|
| 215 |
$product_id = intval($from_sh_id); |
| 216 |
$term_list = wp_get_post_terms($product_id, 'product_type'); |
| 217 |
|
| 218 |
if( get_post_type($product_id) == 'product' && ($term_list[0]->name=='live_stream' || $term_list[0]->name=='video_on_demand') ){ |
| 219 |
|
| 220 |
echo '<div class="wpstream_player_wrapper wpstream_player_shortcode no_buy"><div class="wpstream_player_container">'; |
| 221 |
$message= esc_html( get_option('wpstream_product_not_login','You must be logged in to watch this video.')) ; |
| 222 |
|
| 223 |
|
| 224 |
echo '<div class="wpstream_notice" style="background:#e16767;">'.esc_html($message).'</div>'; |
| 225 |
echo '</div></div>'; |
| 226 |
}elseif( get_post_type($product_id) == 'wpstream_product' ){ |
| 227 |
$this->wpstream_live_event_player($product_id); |
| 228 |
} else if( get_post_type($product_id) == 'wpstream_product_vod' ){ |
| 229 |
$this->wpstream_video_on_demand_player($product_id); |
| 230 |
} |
| 231 |
} |
| 232 |
} |
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
/** |
| 237 |
* Video Player shortcode - low latency |
| 238 |
* |
| 239 |
* @author cretu |
| 240 |
*/ |
| 241 |
|
| 242 |
public function wpstream_video_player_shortcode_low_latency($from_sh_id='') { |
| 243 |
|
| 244 |
if ( is_user_logged_in() ) { |
| 245 |
global $product; |
| 246 |
$current_user = wp_get_current_user(); |
| 247 |
$product_id = intval($from_sh_id); |
| 248 |
|
| 249 |
|
| 250 |
if ( ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) && wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product_id) ) || get_post_type($product_id)=='wpstream_product' ){ |
| 251 |
global $product; |
| 252 |
echo '<div class="wpstream_player_wrapper wpstream_player_shortcode"><div class="wpstream_player_container">'; |
| 253 |
|
| 254 |
|
| 255 |
if( get_post_type($product_id) == 'wpstream_product' ){ |
| 256 |
$this->wpstream_live_event_player_low_latency($product_id); |
| 257 |
}else{ |
| 258 |
$term_list = wp_get_post_terms($product_id, 'product_type'); |
| 259 |
$is_subscription_live_event = esc_html(get_post_meta($product_id,'_subscript_live_event',true)); |
| 260 |
|
| 261 |
if( $term_list[0]->name=='live_stream' || ( $term_list[0]->name=='subscription' && $is_subscription_live_event=='yes' ) ){ |
| 262 |
$this->wpstream_live_event_player_low_latency($product_id); |
| 263 |
} |
| 264 |
} |
| 265 |
|
| 266 |
|
| 267 |
echo '</div></div>'; |
| 268 |
}else{ |
| 269 |
|
| 270 |
if( get_post_type($product_id) == 'product' ){ |
| 271 |
echo '<div class="wpstream_player_wrapper wpstream_player_shortcode no_buy"><div class="wpstream_player_container">'; |
| 272 |
|
| 273 |
$message =esc_html( get_option('wpstream_product_not_bought','You did not yet purchase this item.')) ; |
| 274 |
echo '<div class="wpstream_notice" style="background:#e16767;">'.$message.'</div>'; |
| 275 |
echo '</div></div>'; |
| 276 |
} |
| 277 |
} |
| 278 |
|
| 279 |
|
| 280 |
}else{ |
| 281 |
$product_id = intval($from_sh_id); |
| 282 |
if( get_post_type($product_id) == 'wpstream_product' ){ |
| 283 |
$this->wpstream_live_event_player_low_latency($product_id); |
| 284 |
} |
| 285 |
} |
| 286 |
} |
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
/** |
| 293 |
* Live Event Player |
| 294 |
* |
| 295 |
* @author cretu |
| 296 |
*/ |
| 297 |
function remove_http($url) { |
| 298 |
$disallowed = array('http://', 'https://'); |
| 299 |
foreach($disallowed as $d) { |
| 300 |
if(strpos($url, $d) === 0) { |
| 301 |
return str_replace($d, '', $url); |
| 302 |
} |
| 303 |
} |
| 304 |
return $url; |
| 305 |
} |
| 306 |
|
| 307 |
/** |
| 308 |
* Get event settings |
| 309 |
* |
| 310 |
* @author cretu |
| 311 |
*/ |
| 312 |
|
| 313 |
function wpestream_return_event_settings($product_id){ |
| 314 |
|
| 315 |
$local_event_options = get_post_meta($product_id,'local_event_options',true); |
| 316 |
if(!is_array($local_event_options)){ |
| 317 |
$local_event_options = get_option('wpstream_user_streaming_global_channel_options') ; |
| 318 |
} |
| 319 |
|
| 320 |
return $local_event_options; |
| 321 |
} |
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
/** |
| 326 |
* edited in 4.0 |
| 327 |
* |
| 328 |
* Live Event Player |
| 329 |
* |
| 330 |
* @author cretu |
| 331 |
*/ |
| 332 |
|
| 333 |
function wpstream_live_event_player($channel_id,$poster_show='',$use_chat=''){ |
| 334 |
|
| 335 |
$now = time().rand(0,1000000); |
| 336 |
$thumb_id = get_post_thumbnail_id($channel_id); |
| 337 |
$thumb = wp_get_attachment_image_src($thumb_id,'small'); |
| 338 |
$usernamestream = esc_html ( get_option('wpstream_api_username','') ); |
| 339 |
$autoplay = true; |
| 340 |
|
| 341 |
$event_settings = $this->wpestream_return_event_settings($channel_id); |
| 342 |
$notes = 'wpstream_live_event_player_note'; |
| 343 |
$event_status = $this->main->wpstream_live_connection-> wpstream_check_event_status_api_call($channel_id,$notes); |
| 344 |
$hls_playback_url = ''; |
| 345 |
$live_conect_views = ''; |
| 346 |
|
| 347 |
if(isset($event_status['status']) && $event_status['status']=='active'){ |
| 348 |
//live event |
| 349 |
if(isset($event_status['hls_playback_url'])){ |
| 350 |
$hls_playback_url = $event_status['hls_playback_url']; |
| 351 |
|
| 352 |
update_post_meta($channel_id,'stream_name',$event_status['stream_name']); |
| 353 |
update_post_meta($channel_id,'hls_key_retrieval_url',$event_status['hls_key_retrieval_url']); |
| 354 |
delete_transient( 'free_event_streamName_'.$event_status['stream_name']); |
| 355 |
|
| 356 |
$live_conect_array = explode('live.streamer.wpstream.net',$hls_playback_url); |
| 357 |
$live_conect_views = $live_conect_array[0].'live.streamer.wpstream.net'; |
| 358 |
$live_conect_views = $this->remove_http($live_conect_views); |
| 359 |
|
| 360 |
} |
| 361 |
if(isset($event_status['chat_url'])){ |
| 362 |
$chat_url = $event_status['chat_url']; |
| 363 |
} |
| 364 |
|
| 365 |
}else{ |
| 366 |
// event not live |
| 367 |
} |
| 368 |
|
| 369 |
if(isset($event_settings['autoplay']) && intval($event_settings['autoplay'])==0){ |
| 370 |
$autoplay=false; |
| 371 |
} |
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
echo '<div class="wpstream_live_player_wrapper function_wpstream_live_event_player" data-now="'.$now.'" data-me="'.esc_attr($usernamestream).'" data-product-id="'.$channel_id.'" id="wpstream_live_player_wrapper'.$now.'" > '; |
| 376 |
|
| 377 |
if( ( isset($event_settings['view_count'] ) && intval($event_settings['view_count'])==1 ) || !isset($event_settings['view_count']) ){ |
| 378 |
echo '<div id="wpestream_live_counting" class="wpestream_live_counting"></div>'; |
| 379 |
} |
| 380 |
|
| 381 |
$show_wpstream_not_live_mess=' style="display:none;" '; |
| 382 |
if(trim($hls_playback_url) ==''){ |
| 383 |
|
| 384 |
$show_wpstream_not_live_mess=''; |
| 385 |
} |
| 386 |
|
| 387 |
$message_show= esc_html( get_option('wpstream_you_are_not_live','We are not live at this moment')) ; |
| 388 |
|
| 389 |
if(function_exists('wpstream_theme_not_live_section')){ |
| 390 |
print wpstream_theme_not_live_section($channel_id); |
| 391 |
}else{ |
| 392 |
print '<div class="wpstream_not_live_mess" '.$show_wpstream_not_live_mess.'><div class="wpstream_not_live_mess_back"></div><div class="wpstream_not_live_mess_mess">'.esc_html($message_show).'</div></div>'; |
| 393 |
} |
| 394 |
|
| 395 |
|
| 396 |
$poster_data=''; |
| 397 |
if(isset($thumb[0])){ |
| 398 |
$poster_data=' poster="'.$thumb[0].'" '; |
| 399 |
} |
| 400 |
if($poster_show=='no'){ |
| 401 |
$poster_data=''; |
| 402 |
} |
| 403 |
|
| 404 |
$is_muted=false; |
| 405 |
if( isset($event_settings['mute']) && intval($event_settings['mute'])==1){ |
| 406 |
$is_muted=true; |
| 407 |
} |
| 408 |
// override $is_muted and $autoplay here - for testing |
| 409 |
// $autoplay = true; |
| 410 |
// $is_muted = false; |
| 411 |
|
| 412 |
$autoplay_str = $autoplay ? 'autoplay' : ''; |
| 413 |
$is_muted_str = $is_muted ? 'muted' : ''; |
| 414 |
|
| 415 |
$video_trailer = ''; |
| 416 |
$trailer_attachment_id = intval (get_post_meta( $channel_id, 'video_trailer', true )); |
| 417 |
$video_trailer = ''; |
| 418 |
$video_trailer_type = ''; |
| 419 |
if($trailer_attachment_id!=0) { |
| 420 |
$video_trailer = wp_get_attachment_url( $trailer_attachment_id ); |
| 421 |
$attachment_metadata = wp_get_attachment_metadata($trailer_attachment_id); |
| 422 |
$video_trailer_type = $attachment_metadata['mime_type']; |
| 423 |
} |
| 424 |
|
| 425 |
// override trailer url here - for testing |
| 426 |
// $video_trailer = ''; |
| 427 |
// $video_trailer = '/wp-content/uploads/2023/10/production-ID_4608975.mp4'; |
| 428 |
// $video_trailer = '/wp-content/uploads/2023/10/ultrawide.mp4'; |
| 429 |
|
| 430 |
|
| 431 |
echo' |
| 432 |
<video id="wpstream-video'.$now.'" '.$poster_data.' class="video-js vjs-default-skin vjs-fluid vjs-wpstream" playsinline="true" '.$is_muted_str." ".$autoplay_str.'> |
| 433 |
|
| 434 |
</video>'; |
| 435 |
if ($video_trailer){ |
| 436 |
print '<div id="wpstream_live_video_play_trailer_btn_' . $now . '" style="display: none;" class="wpstream_video_on_demand_play_trailer">'.esc_html('Play Trailer').'</div>'; |
| 437 |
print '<div id="wpstream_live_video_mute_trailer_btn_' . $now . '" style="display: none;" class="wpstream_video_on_demand_mute_trailer"> |
| 438 |
<svg width="37" height="36" viewBox="0 0 37 36" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 439 |
<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"/> |
| 440 |
</svg> |
| 441 |
|
| 442 |
</div>'; |
| 443 |
print '<div id="wpstream_live_video_unmute_trailer_btn_' . $now . '" style="display: none;" class="wpstream_video_on_demand_unmute_trailer"> |
| 444 |
<svg width="37" height="37" viewBox="0 0 37 37" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 445 |
<g clip-path="url(#clip0_619_9546)"> |
| 446 |
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.63981 11.5624H11.0462L21.293 2.70557L23.5494 3.51494V33.5774L21.293 34.3406L11.0462 25.4374H3.63981L2.3125 24.2812V12.7187L3.63981 11.5624ZM12.5328 23.5181L20.8948 30.7793V6.31307L12.5328 13.5281L11.6036 13.8749H4.96711V23.1249H11.6036L12.5328 23.5181ZM37.4357 14.0183L39.3125 15.6533L34.7174 19.6562L39.3125 23.6614L37.4357 25.2964L32.8406 21.2911L28.2428 25.2964L26.366 23.6614L30.9637 19.6562L26.3633 15.6556L28.2401 14.0206L32.8406 18.0213L37.4357 14.0183Z" fill="white"/> |
| 447 |
</g> |
| 448 |
<defs> |
| 449 |
<clipPath id="clip0_619_9546"> |
| 450 |
<rect width="37" height="37" fill="white"/> |
| 451 |
</clipPath> |
| 452 |
</defs> |
| 453 |
</svg> |
| 454 |
|
| 455 |
|
| 456 |
</div>'; |
| 457 |
} |
| 458 |
print '<script type="text/javascript"> |
| 459 |
//<![CDATA[ |
| 460 |
jQuery(document).ready(function(){ |
| 461 |
wpstream_player_initialize({ |
| 462 |
videoElementId: "'.$now.'", |
| 463 |
trailerUrl: "'.$video_trailer.'", |
| 464 |
contentUrl: "'.$hls_playback_url.'", |
| 465 |
statsUri: "'.$live_conect_views.'", |
| 466 |
autoplay: '.var_export($autoplay, true).', |
| 467 |
muted: '.var_export($is_muted, true).', |
| 468 |
playTrailerButtonElementId: "wpstream_live_video_play_trailer_btn_'.$now.'", |
| 469 |
muteTrailerButtonElementId: "wpstream_live_video_mute_trailer_btn_'.$now.'", |
| 470 |
unmuteTrailerButtonElementId: "wpstream_live_video_unmute_trailer_btn_'.$now.'", |
| 471 |
}); |
| 472 |
}); |
| 473 |
//]]> |
| 474 |
</script>'; |
| 475 |
print '</div>'; |
| 476 |
|
| 477 |
|
| 478 |
if(trim($hls_playback_url) ==''){ |
| 479 |
// $show_wpstream_not_live_mess=''; |
| 480 |
}else{ |
| 481 |
print '<script type="text/javascript"> |
| 482 |
//<![CDATA[ |
| 483 |
jQuery(document).ready(function(){ |
| 484 |
var player_wrapper = jQuery(".wpstream_live_player_wrapper"); |
| 485 |
wpstream_read_websocket_info("'.$channel_id.'","wpstream_live_player_wrapper'.$now.'", player_wrapper ,"'.$chat_url.'", "'.$hls_playback_url.'"); |
| 486 |
}); |
| 487 |
//]]> |
| 488 |
</script>'; |
| 489 |
} |
| 490 |
|
| 491 |
|
| 492 |
if($use_chat=="yes"){ |
| 493 |
$this->wpstream_connect_to_chat($channel_id); |
| 494 |
} |
| 495 |
|
| 496 |
usleep (10000); |
| 497 |
|
| 498 |
} |
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
/** |
| 505 |
* |
| 506 |
* Edited in 4.0 |
| 507 |
* |
| 508 |
* |
| 509 |
* Live Event Player |
| 510 |
* |
| 511 |
* @author cretu |
| 512 |
*/ |
| 513 |
|
| 514 |
function wpstream_live_event_player_low_latency($channel_id,$poster_show='',$use_chat=''){ |
| 515 |
$usernamestream = esc_html ( get_option('wpstream_api_username','') ); |
| 516 |
$thumb_id = get_post_thumbnail_id($channel_id); |
| 517 |
$thumb = wp_get_attachment_image_src($thumb_id,'small'); |
| 518 |
|
| 519 |
$event_settings = $this->wpestream_return_event_settings($channel_id); |
| 520 |
$notes = 'wpstream_live_event_player_low_latency_note'; |
| 521 |
$event_status = $this->main->wpstream_live_connection-> wpstream_check_event_status_api_call($channel_id,$notes); |
| 522 |
$hls_playback_url = ''; |
| 523 |
$live_conect_views = ''; |
| 524 |
$now = time().rand(0,10); |
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
if(isset($event_status['status']) && $event_status['status']=='active'){ |
| 529 |
//live event |
| 530 |
if(isset($event_status['sldp_playback_url'])){ |
| 531 |
$hls_playback_url = $event_status['sldp_playback_url']; |
| 532 |
|
| 533 |
$live_conect_array = explode('live.streamer.wpstream.net',$hls_playback_url); |
| 534 |
$live_conect_views = $live_conect_array[0].'live.streamer.wpstream.net'; |
| 535 |
$live_conect_views = $this->remove_http($live_conect_views); |
| 536 |
|
| 537 |
} |
| 538 |
if(isset($event_status['chat_url'])){ |
| 539 |
$chat_url =$event_status['chat_url']; |
| 540 |
} |
| 541 |
|
| 542 |
}else{ |
| 543 |
// event not live |
| 544 |
} |
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
echo '<div class="wpstream_live_player_wrapper function_wpstream_live_event_player_low_latency wpstream_low_latency" data-now="'.$now.'" data-me="'.esc_attr($usernamestream).'" data-product-id="'.$channel_id.'" id="wpstream_live_player_wrapper'.$now.'" > '; |
| 550 |
|
| 551 |
|
| 552 |
if( ( isset($event_settings['view_count'] ) && intval($event_settings['view_count'])==1 ) || !isset($event_settings['view_count']) ){ |
| 553 |
echo '<div id="wpestream_live_counting" class="wpestream_live_counting"></div>'; |
| 554 |
} |
| 555 |
|
| 556 |
$show_wpstream_not_live_mess=' style="display:none;" '; |
| 557 |
if(trim($hls_playback_url) ==''){ |
| 558 |
$show_wpstream_not_live_mess=''; |
| 559 |
} |
| 560 |
|
| 561 |
$message_show= esc_html( get_option('wpstream_you_are_not_live','We are not live at this moment')) ; |
| 562 |
print '<div class="wpstream_not_live_mess " '.$show_wpstream_not_live_mess.' ><div class="wpstream_not_live_mess_back"></div><div class="wpstream_not_live_mess_mess">'. $message_show.'</div></div>'; |
| 563 |
|
| 564 |
|
| 565 |
$poster_data=' poster="'.$thumb[0].'" '; |
| 566 |
if($poster_show=='no'){ |
| 567 |
$poster_data=''; |
| 568 |
} |
| 569 |
|
| 570 |
|
| 571 |
$is_muted=''; |
| 572 |
if( isset($event_settings['mute']) && intval($event_settings['mute'])==1){ |
| 573 |
$is_muted=' muted '; |
| 574 |
} |
| 575 |
|
| 576 |
|
| 577 |
$autoplay='autoplay'; |
| 578 |
if(isset($event_settings['autoplay']) && intval($event_settings['autoplay'])==0){ |
| 579 |
$autoplay=''; |
| 580 |
} |
| 581 |
|
| 582 |
echo' |
| 583 |
<div iccd="player" id="wpstream-video'.$now.'" '.$poster_data.' '.$is_muted.' class="" > |
| 584 |
</div>'; |
| 585 |
|
| 586 |
print '<script type="text/javascript"> |
| 587 |
//<![CDATA[ |
| 588 |
jQuery(document).ready(function(){ |
| 589 |
var low_latencyid="wpstream-video'.$now.'"; |
| 590 |
document.addEventListener("DOMContentLoaded", initPlayer(low_latencyid, "'.$hls_playback_url.'","'.$is_muted.'","'.$autoplay.'" ) ); '; |
| 591 |
print'}); |
| 592 |
//]]> |
| 593 |
</script>'; |
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
if(trim($hls_playback_url) ==''){ |
| 598 |
// $show_wpstream_not_live_mess=''; |
| 599 |
}else{ |
| 600 |
print '<script type="text/javascript"> |
| 601 |
//<![CDATA[ |
| 602 |
jQuery(document).ready(function(){ |
| 603 |
var player_wrapper = jQuery(".wpstream_live_player_wrapper"); |
| 604 |
wpstream_read_websocket_info("'.$channel_id.'","wpstream_live_player_wrapper'.$now.'", player_wrapper ,"'.$chat_url.'", "'.$hls_playback_url.'"); |
| 605 |
}); |
| 606 |
//]]> |
| 607 |
</script>'; |
| 608 |
} |
| 609 |
|
| 610 |
|
| 611 |
if($use_chat=="yes"){ |
| 612 |
$this->wpstream_connect_to_chat($channel_id); |
| 613 |
} |
| 614 |
|
| 615 |
usleep (10000); |
| 616 |
|
| 617 |
} |
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
|
| 623 |
/* |
| 624 |
* |
| 625 |
* Request HLS player |
| 626 |
* |
| 627 |
* |
| 628 |
* |
| 629 |
*/ |
| 630 |
public function wpstream_request_video_on_demand_hls_player($video_name,$product_id){ |
| 631 |
if($video_name==''){ |
| 632 |
return ''; |
| 633 |
} |
| 634 |
|
| 635 |
$transient_name = 'wpstream_video_on_demand_'.$video_name; |
| 636 |
$hls_to_return = get_transient( $transient_name ); |
| 637 |
$hls_to_return = false; |
| 638 |
|
| 639 |
|
| 640 |
if($hls_to_return==false){ |
| 641 |
|
| 642 |
$access_token = $this->main->wpstream_live_connection->wpstream_get_token(); |
| 643 |
$url = 'video/info'; |
| 644 |
|
| 645 |
//corsorigin de check |
| 646 |
$local_event_options = get_option('wpstream_user_streaming_global_channel_options') ; |
| 647 |
$domain = parse_url ( get_site_url() ); |
| 648 |
$domain_scheme = 'http'; |
| 649 |
if(is_ssl()){ |
| 650 |
$domain_scheme='https'; |
| 651 |
} |
| 652 |
|
| 653 |
|
| 654 |
$wpstream_vod_domain_lock = intval( get_option('wpstream_vod_domain_lock','') ) ; |
| 655 |
$corsorigin='*'; |
| 656 |
if($wpstream_vod_domain_lock === 0 ){ |
| 657 |
$corsorigin=$domain_scheme.'://'.$domain['host']; |
| 658 |
} |
| 659 |
|
| 660 |
|
| 661 |
$is_encrypt="false"; |
| 662 |
$wpstream_vod_encrypt = intval( get_option('wpstream_vod_encrypt','') ) ; |
| 663 |
if( intval( $wpstream_vod_encrypt ) ==1 ){ |
| 664 |
$is_encrypt="true"; |
| 665 |
} |
| 666 |
|
| 667 |
$hlsKeysUrlPrefix = get_site_url().'?wpstream_voddrm='; |
| 668 |
$encrypt = $is_encrypt; |
| 669 |
$debugDrm = false; |
| 670 |
|
| 671 |
$curl_post_fields=array( |
| 672 |
'access_token' => $access_token, |
| 673 |
'name' => $video_name, |
| 674 |
'corsOrigin' => $corsorigin, |
| 675 |
'encryptHls' => $encrypt, |
| 676 |
'hlsKeysUrlPrefix' => $hlsKeysUrlPrefix, |
| 677 |
'debugDrm' => $debugDrm, |
| 678 |
); |
| 679 |
|
| 680 |
|
| 681 |
$curl_response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url,$curl_post_fields); |
| 682 |
$curl_response_decoded = json_decode($curl_response,JSON_OBJECT_AS_ARRAY); |
| 683 |
|
| 684 |
if($curl_response_decoded['success']){ |
| 685 |
set_transient( $transient_name, $curl_response_decoded['hlsUrl'] ,300); |
| 686 |
$hls_to_return = $curl_response_decoded['hlsUrl']; |
| 687 |
if( isset($curl_response_decoded['hlsDecryptionKey']) && isset($curl_response_decoded['hlsDecryptionKeyIndex']) ){ |
| 688 |
update_post_meta($product_id,'hlsDecryptionKey',$curl_response_decoded['hlsDecryptionKey']); |
| 689 |
update_post_meta($product_id,'hlsDecryptionKeyIndex',$curl_response_decoded['hlsDecryptionKeyIndex']); |
| 690 |
}else{ |
| 691 |
delete_post_meta($product_id,'hlsDecryptionKey'); |
| 692 |
delete_post_meta($product_id,'hlsDecryptionKeyIndex'); |
| 693 |
} |
| 694 |
|
| 695 |
}else{ |
| 696 |
return ''; |
| 697 |
} |
| 698 |
|
| 699 |
} |
| 700 |
|
| 701 |
return $hls_to_return; |
| 702 |
|
| 703 |
} |
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
/** |
| 709 |
* VODPlayer uri details |
| 710 |
* |
| 711 |
* @author cretu |
| 712 |
*/ |
| 713 |
public function wpstream_video_on_demand_player_uri_request($product_id){ |
| 714 |
|
| 715 |
$wpstream_data_setup = ' data-setup="{}" '; |
| 716 |
|
| 717 |
/* free_video_type |
| 718 |
* 1 - free live channel |
| 719 |
* 2 - free video encrypted |
| 720 |
* 3 - free video -not encrypted |
| 721 |
*/ |
| 722 |
|
| 723 |
$post_type = get_post_type($product_id); |
| 724 |
$free_video_type = intval( get_post_meta($product_id, 'wpstream_product_type', true)); |
| 725 |
if( ( $post_type =='wpstream_product_vod' && $free_video_type==2 ) || get_post_type($product_id)=='product' ){ |
| 726 |
|
| 727 |
/* |
| 728 |
* IF vide is encrypted- readed from vod,streaner |
| 729 |
* |
| 730 |
*/ |
| 731 |
|
| 732 |
|
| 733 |
$video_type = 'application/x-mpegURL'; |
| 734 |
$video_path = get_post_meta($product_id,'_movie_url',true); |
| 735 |
if(get_post_type($product_id)=='wpstream_product_vod'){ |
| 736 |
$video_path = esc_html(get_post_meta($product_id, 'wpstream_free_video', true)); |
| 737 |
} |
| 738 |
$video_path_final = $this->wpstream_request_video_on_demand_hls_player($video_path,$product_id); |
| 739 |
|
| 740 |
|
| 741 |
}else if( $post_type =='wpstream_product_vod' && $free_video_type==3 ){ |
| 742 |
|
| 743 |
/* Video is unecrypted - read from local or youtube / vimeo |
| 744 |
*/ |
| 745 |
|
| 746 |
$video_type = 'video/mp4'; |
| 747 |
$video_path_final=esc_html(get_post_meta($product_id, 'wpstream_free_video_external', true)); |
| 748 |
|
| 749 |
if (strpos($video_path_final, 'www.youtube') !== false) { |
| 750 |
$wpstream_data_setup= ' data-setup=\'{ "techOrder": ["youtube"], "sources": [{ "type": "video/youtube", "src": "'.$video_path_final.'"}] }\' '; |
| 751 |
$video_path_final=''; |
| 752 |
} |
| 753 |
/* disabled due to old lib |
| 754 |
if (strpos($video_path_final, 'vimeo.com') !== false) { |
| 755 |
$wpstream_data_setup= ' data-setup=\'{"techOrder": ["vimeo"], "sources": [{ "type": "video/vimeo", "src": "'.$video_path_final.'"}], "vimeo": { "color": "#fbc51b"} }\' '; |
| 756 |
$video_path_final=''; |
| 757 |
}*/ |
| 758 |
|
| 759 |
} |
| 760 |
|
| 761 |
$return_array = array(); |
| 762 |
$return_array['video_path_final'] = $video_path_final; |
| 763 |
$return_array['wpstream_data_setup']= $wpstream_data_setup; |
| 764 |
$return_array['video_type'] = $video_type; |
| 765 |
$return_array['free_video_type'] = $free_video_type; |
| 766 |
$return_array['post_type'] = $post_type ; |
| 767 |
return $return_array; |
| 768 |
} |
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
/** |
| 773 |
* VODPlayer url |
| 774 |
* |
| 775 |
* @author cretu |
| 776 |
*/ |
| 777 |
|
| 778 |
public function wpstream_video_on_demand_player($product_id){ |
| 779 |
|
| 780 |
$uri_details = $this->wpstream_video_on_demand_player_uri_request($product_id); |
| 781 |
$video_path_final = $uri_details['video_path_final']; |
| 782 |
$wpstream_data_setup = $uri_details['wpstream_data_setup']; |
| 783 |
$video_type = $uri_details['video_type']; |
| 784 |
$now = time().rand(0,1000000); |
| 785 |
|
| 786 |
$thumb_id = get_post_thumbnail_id($product_id); |
| 787 |
$thumb = wp_get_attachment_image_src($thumb_id,'small'); |
| 788 |
$usernamestream = esc_html ( get_option('wpstream_api_username','') ); |
| 789 |
|
| 790 |
$poster_thumb = ''; |
| 791 |
if(isset($thumb[0])){ |
| 792 |
$poster_thumb=$thumb[0]; |
| 793 |
} |
| 794 |
|
| 795 |
$hlsDecryptionKey = get_post_meta($product_id,'hlsDecryptionKey',true); |
| 796 |
$hlsDecryptionKeyIndex = get_post_meta($product_id,'hlsDecryptionKeyIndex',true); |
| 797 |
|
| 798 |
|
| 799 |
$pack = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user(); |
| 800 |
|
| 801 |
|
| 802 |
|
| 803 |
$trailer_attachment_id = intval (get_post_meta( $product_id, 'video_trailer', true )); |
| 804 |
$video_trailer = ''; |
| 805 |
$video_trailer_type = ''; |
| 806 |
if($trailer_attachment_id!=0) { |
| 807 |
$video_trailer = wp_get_attachment_url( $trailer_attachment_id ); |
| 808 |
$attachment_metadata = wp_get_attachment_metadata($trailer_attachment_id); |
| 809 |
$video_trailer_type = $attachment_metadata['mime_type']; |
| 810 |
} |
| 811 |
|
| 812 |
// override trailer setup here (for testing) |
| 813 |
// $trailer_attachment_id = 1; |
| 814 |
// $video_trailer = '/wp-content/uploads/2023/10/production-ID_4608975.mp4'; |
| 815 |
// $video_trailer = '/wp-content/uploads/2023/10/ultrawide.mp4'; |
| 816 |
|
| 817 |
|
| 818 |
if(isset($pack['available_data_mb']) && $pack['available_data_mb']>0){ |
| 819 |
|
| 820 |
if($video_path_final==''){ |
| 821 |
if( $uri_details['post_type']=='wpstream_product_vod' && $uri_details['free_video_type']==3 ){ |
| 822 |
}else{ |
| 823 |
print '<div class="wpstream_vod_notice">This video does not exist or it has been deleted!</div>'; |
| 824 |
} |
| 825 |
|
| 826 |
} |
| 827 |
|
| 828 |
// TODO (crerem) populate these from VOD settings |
| 829 |
$autoplay = false; |
| 830 |
$muted = false; |
| 831 |
|
| 832 |
$wpstream_vod_start_muted = intval ( get_option('wpstream_vod_start_muted','') ); |
| 833 |
if($wpstream_vod_start_muted===1){ |
| 834 |
$muted=true; |
| 835 |
} |
| 836 |
$wpstream_vod_autoplay = intval ( get_option('wpstream_vod_autoplay','') ); |
| 837 |
if($wpstream_vod_autoplay===1){ |
| 838 |
$autoplay=true; |
| 839 |
} |
| 840 |
|
| 841 |
echo '<video id="wpstream-video-vod-'.$now.'" 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" |
| 842 |
poster="'.esc_url($poster_thumb).'" '.$wpstream_data_setup.'> |
| 843 |
<p class="vjs-no-js"> |
| 844 |
To view this video please enable JavaScript, and consider upgrading to a web browser that |
| 845 |
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a> |
| 846 |
</p> |
| 847 |
</video>'; |
| 848 |
|
| 849 |
if($trailer_attachment_id !=0){ |
| 850 |
print '<div id="wpstream_video_on_demand_play_trailer_btn_' . $now . '" class="wpstream_video_on_demand_play_trailer">'.esc_html('play trailer').'</div>'; |
| 851 |
print '<div id="wpstream_video_on_demand_play_video_btn_' . $now . '" class="wpstream_video_on_demand_play_video">'.esc_html('play real video').'</div>'; |
| 852 |
print '<div id="wpstream_video_on_demand_mute_trailer_btn_' . $now . '" class="wpstream_video_on_demand_mute_trailer"> |
| 853 |
|
| 854 |
<svg width="37" height="36" viewBox="0 0 37 36" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 855 |
<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"/> |
| 856 |
</svg> |
| 857 |
</div>'; |
| 858 |
print '<div id="wpstream_video_on_demand_unmute_trailer_btn_' . $now . '" class="wpstream_video_on_demand_unmute_trailer"> |
| 859 |
<svg width="37" height="37" viewBox="0 0 37 37" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 860 |
<g clip-path="url(#clip0_619_9546)"> |
| 861 |
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.63981 11.5624H11.0462L21.293 2.70557L23.5494 3.51494V33.5774L21.293 34.3406L11.0462 25.4374H3.63981L2.3125 24.2812V12.7187L3.63981 11.5624ZM12.5328 23.5181L20.8948 30.7793V6.31307L12.5328 13.5281L11.6036 13.8749H4.96711V23.1249H11.6036L12.5328 23.5181ZM37.4357 14.0183L39.3125 15.6533L34.7174 19.6562L39.3125 23.6614L37.4357 25.2964L32.8406 21.2911L28.2428 25.2964L26.366 23.6614L30.9637 19.6562L26.3633 15.6556L28.2401 14.0206L32.8406 18.0213L37.4357 14.0183Z" fill="white"/> |
| 862 |
</g> |
| 863 |
<defs> |
| 864 |
<clipPath id="clip0_619_9546"> |
| 865 |
<rect width="37" height="37" fill="white"/> |
| 866 |
</clipPath> |
| 867 |
</defs> |
| 868 |
</svg> |
| 869 |
</div>'; |
| 870 |
print '<script type="text/javascript"> |
| 871 |
//<![CDATA[ |
| 872 |
jQuery(document).ready(function(){ |
| 873 |
wpstream_player_initialize_vod({ |
| 874 |
videoElementId: "wpstream-video-vod-'.$now.'", |
| 875 |
trailerUrl: "'.$video_trailer.'", |
| 876 |
videoUrl: "'.$video_path_final.'", |
| 877 |
autoplay: '.var_export($autoplay, true).', |
| 878 |
muted: '.var_export($muted, true).', |
| 879 |
playTrailerButtonElementId: "wpstream_video_on_demand_play_trailer_btn_'.$now.'", |
| 880 |
muteTrailerButtonElementId: "wpstream_video_on_demand_mute_trailer_btn_'.$now.'", |
| 881 |
unmuteTrailerButtonElementId: "wpstream_video_on_demand_unmute_trailer_btn_'.$now.'", |
| 882 |
playVideoButtonElementId: "wpstream_video_on_demand_play_video_btn_'.$now.'", |
| 883 |
}); |
| 884 |
}); |
| 885 |
//]]> |
| 886 |
</script>'; |
| 887 |
} |
| 888 |
else { |
| 889 |
print '<script type="text/javascript"> |
| 890 |
//<![CDATA[ |
| 891 |
jQuery(document).ready(function(){ |
| 892 |
wpstream_player_initialize_vod({ |
| 893 |
videoElementId: "wpstream-video-vod-'.$now.'", |
| 894 |
videoUrl: "'.$video_path_final.'", |
| 895 |
autoplay: '.var_export($autoplay, true).', |
| 896 |
muted: '.var_export($muted, true).', |
| 897 |
}); |
| 898 |
}); |
| 899 |
//]]> |
| 900 |
</script>'; |
| 901 |
} |
| 902 |
}else{ |
| 903 |
print esc_html_e('Insufficient resources to stream this title','wpstream'); |
| 904 |
} |
| 905 |
|
| 906 |
} |
| 907 |
|
| 908 |
|
| 909 |
|
| 910 |
/** |
| 911 |
* VODPlayer url - only trailer - used in theme |
| 912 |
* |
| 913 |
* @author cretu |
| 914 |
*/ |
| 915 |
public function wpstream_video_on_demand_player_only_trailer($product_id){ |
| 916 |
|
| 917 |
|
| 918 |
$now = time().rand(0,1000000); |
| 919 |
$thumb_id = get_post_thumbnail_id($product_id); |
| 920 |
$thumb = wp_get_attachment_image_src($thumb_id,'small'); |
| 921 |
$usernamestream = esc_html ( get_option('wpstream_api_username','') ); |
| 922 |
|
| 923 |
$poster_thumb = ''; |
| 924 |
if(isset($thumb[0])){ |
| 925 |
$poster_thumb=$thumb[0]; |
| 926 |
} |
| 927 |
|
| 928 |
|
| 929 |
$trailer_attachment_id = intval (get_post_meta( $product_id, 'video_trailer', true )); |
| 930 |
$video_trailer = ''; |
| 931 |
$video_trailer_type = ''; |
| 932 |
if($trailer_attachment_id!=0) { |
| 933 |
$video_trailer = wp_get_attachment_url( $trailer_attachment_id ); |
| 934 |
$attachment_metadata = wp_get_attachment_metadata($trailer_attachment_id); |
| 935 |
$video_trailer_type = $attachment_metadata['mime_type']; |
| 936 |
} |
| 937 |
|
| 938 |
|
| 939 |
// TODO (crerem) populate these from VOD settings |
| 940 |
$autoplay = false; |
| 941 |
$muted = true; |
| 942 |
$video_path_final=''; |
| 943 |
|
| 944 |
echo '<video id="wpstream-video-vod-'.$now.'" 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" |
| 945 |
poster="'.esc_url($poster_thumb).'"> |
| 946 |
<p class="vjs-no-js"> |
| 947 |
To view this video please enable JavaScript, and consider upgrading to a web browser that |
| 948 |
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a> |
| 949 |
</p> |
| 950 |
</video>'; |
| 951 |
|
| 952 |
if($trailer_attachment_id !=0){ |
| 953 |
print '<div id="wpstream_video_on_demand_play_trailer_btn_' . $now . '" class="wpstream_video_on_demand_play_trailer">'.esc_html('play trailer').'</div>'; |
| 954 |
print '<div id="wpstream_video_on_demand_mute_trailer_btn_' . $now . '" class="wpstream_video_on_demand_mute_trailer"> |
| 955 |
<svg width="37" height="36" viewBox="0 0 37 36" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 956 |
<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"/> |
| 957 |
</svg> |
| 958 |
|
| 959 |
|
| 960 |
</div>'; |
| 961 |
print '<div id="wpstream_video_on_demand_unmute_trailer_btn_' . $now . '" class="wpstream_video_on_demand_unmute_trailer"> |
| 962 |
<svg width="37" height="37" viewBox="0 0 37 37" fill="none" xmlns="http://www.w3.org/2000/svg"> |
| 963 |
<g clip-path="url(#clip0_619_9546)"> |
| 964 |
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.63981 11.5624H11.0462L21.293 2.70557L23.5494 3.51494V33.5774L21.293 34.3406L11.0462 25.4374H3.63981L2.3125 24.2812V12.7187L3.63981 11.5624ZM12.5328 23.5181L20.8948 30.7793V6.31307L12.5328 13.5281L11.6036 13.8749H4.96711V23.1249H11.6036L12.5328 23.5181ZM37.4357 14.0183L39.3125 15.6533L34.7174 19.6562L39.3125 23.6614L37.4357 25.2964L32.8406 21.2911L28.2428 25.2964L26.366 23.6614L30.9637 19.6562L26.3633 15.6556L28.2401 14.0206L32.8406 18.0213L37.4357 14.0183Z" fill="white"/> |
| 965 |
</g> |
| 966 |
<defs> |
| 967 |
<clipPath id="clip0_619_9546"> |
| 968 |
<rect width="37" height="37" fill="white"/> |
| 969 |
</clipPath> |
| 970 |
</defs> |
| 971 |
</svg> |
| 972 |
</div>'; |
| 973 |
print '<script type="text/javascript"> |
| 974 |
//<![CDATA[ |
| 975 |
jQuery(document).ready(function(){ |
| 976 |
wpstream_player_initialize_vod({ |
| 977 |
videoElementId: "wpstream-video-vod-'.$now.'", |
| 978 |
trailerUrl: "'.$video_trailer.'", |
| 979 |
autoplay: '.var_export($autoplay, true).', |
| 980 |
muted: '.var_export($muted, true).', |
| 981 |
playTrailerButtonElementId: "wpstream_video_on_demand_play_trailer_btn_'.$now.'", |
| 982 |
muteTrailerButtonElementId: "wpstream_video_on_demand_mute_trailer_btn_'.$now.'", |
| 983 |
unmuteTrailerButtonElementId: "wpstream_video_on_demand_unmute_trailer_btn_'.$now.'", |
| 984 |
}); |
| 985 |
}); |
| 986 |
//]]> |
| 987 |
</script>'; |
| 988 |
} |
| 989 |
else { |
| 990 |
//just show the poster or don't show anything; no player needed |
| 991 |
} |
| 992 |
|
| 993 |
} |
| 994 |
|
| 995 |
|
| 996 |
|
| 997 |
/** |
| 998 |
* |
| 999 |
* edited 4.0 |
| 1000 |
* |
| 1001 |
* Retreive username for vod path |
| 1002 |
* |
| 1003 |
* @author cretu |
| 1004 |
*/ |
| 1005 |
private function wpstream_retrive_username(){ |
| 1006 |
|
| 1007 |
return get_option('wpstream_api_username_from_token'); |
| 1008 |
} |
| 1009 |
|
| 1010 |
/** |
| 1011 |
* check if the we can add display the player |
| 1012 |
* |
| 1013 |
* @since 3.12 |
| 1014 |
* returns html of the player |
| 1015 |
*/ |
| 1016 |
|
| 1017 |
public function wpstream_check_if_player_can_dsplay($product_id){ |
| 1018 |
if ( is_user_logged_in() ) { |
| 1019 |
|
| 1020 |
$term_list = wp_get_post_terms($product_id, 'product_type'); |
| 1021 |
$current_user = wp_get_current_user(); |
| 1022 |
$subscription_model = intval( get_option('wpstream_global_sub','')) ; |
| 1023 |
|
| 1024 |
$product = wc_get_product($product_id); |
| 1025 |
$product_type = $product->get_type(); |
| 1026 |
|
| 1027 |
|
| 1028 |
if($subscription_model==1){ // if we have Neflix mode |
| 1029 |
if( $product_type=='subscription' ){ // if the product loaded is a subscription and we are on netflix mode |
| 1030 |
return false; |
| 1031 |
} |
| 1032 |
if($this->wpstream_in_plugin_check_global_subscription_model($product_id)){ |
| 1033 |
return true; |
| 1034 |
} |
| 1035 |
}else{ |
| 1036 |
// ppv mode |
| 1037 |
|
| 1038 |
if( $product_type=='subscription' ){ |
| 1039 |
|
| 1040 |
// $user_subscriptions = wcs_get_users_subscriptions($current_user->ID ); |
| 1041 |
// foreach ($user_subscriptions as $subscription) { |
| 1042 |
// $subscription_status = $subscription->get_status(); |
| 1043 |
// echo "</br>*** Subscription ID $subscription->ID for User ID $current_user->ID has status: $subscription_status"; |
| 1044 |
// } |
| 1045 |
|
| 1046 |
|
| 1047 |
if( wcs_user_has_subscription( $current_user->ID, $product_id ,'active') ) { |
| 1048 |
// user has active subcription |
| 1049 |
return true; |
| 1050 |
} |
| 1051 |
|
| 1052 |
}else{ |
| 1053 |
if( wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product_id)){ |
| 1054 |
return true; |
| 1055 |
} |
| 1056 |
} |
| 1057 |
|
| 1058 |
|
| 1059 |
} |
| 1060 |
return false; |
| 1061 |
|
| 1062 |
} |
| 1063 |
return false; |
| 1064 |
|
| 1065 |
} |
| 1066 |
|
| 1067 |
|
| 1068 |
|
| 1069 |
/** |
| 1070 |
* check if the we can add display the player - theme variant |
| 1071 |
* |
| 1072 |
* @since 3.12 |
| 1073 |
* returns html of the player |
| 1074 |
*/ |
| 1075 |
public function wpstream_check_if_player_can_dsplay_theme($product_id){ |
| 1076 |
|
| 1077 |
$post_type= get_post_type($product_id); |
| 1078 |
|
| 1079 |
|
| 1080 |
|
| 1081 |
if($post_type=='wpstream_product_vod' || $post_type=='wpstream_product'){ |
| 1082 |
return true; // if we have free vod or live |
| 1083 |
} |
| 1084 |
|
| 1085 |
|
| 1086 |
|
| 1087 |
if ( is_user_logged_in() && $post_type==='product' ) { |
| 1088 |
|
| 1089 |
$product = wc_get_product( $product_id ); |
| 1090 |
$product_type = $product->get_type(); |
| 1091 |
$possible_bundle = get_post_meta($product_id, 'wpstream_part_of_bundle',true); |
| 1092 |
|
| 1093 |
|
| 1094 |
|
| 1095 |
|
| 1096 |
|
| 1097 |
$current_user = wp_get_current_user(); |
| 1098 |
$subscription_model = intval( get_option('wpstream_global_sub','')) ; |
| 1099 |
// print 'subscription model '.$subscription_model.'</br>'; |
| 1100 |
|
| 1101 |
if($subscription_model==1){ // if we have Neflix mode |
| 1102 |
if( $product_type=='subscription' ){ // if the product loaded is a subscription and we are on netflix mode |
| 1103 |
return false; |
| 1104 |
} |
| 1105 |
if($this->wpstream_in_plugin_check_global_subscription_model($product_id)){ |
| 1106 |
return true; |
| 1107 |
} |
| 1108 |
}else{ |
| 1109 |
// ppv mode |
| 1110 |
if ( wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product_id) ){ |
| 1111 |
return true; //simple product bought |
| 1112 |
}else if (function_exists('wcs_user_has_subscription') && wcs_user_has_subscription( $current_user->ID, $product_id ,'active') ){ |
| 1113 |
return true; // subscription boght |
| 1114 |
}else if( get_post_type($product_id) =='product' && |
| 1115 |
intval($possible_bundle )!=0 && |
| 1116 |
wc_customer_bought_product( $current_user->user_email, $current_user->ID, $possible_bundle) |
| 1117 |
){ |
| 1118 |
return true; // part of a boght bundle |
| 1119 |
} |
| 1120 |
} |
| 1121 |
// print ' fac return false </br>'; |
| 1122 |
return false; |
| 1123 |
|
| 1124 |
} |
| 1125 |
return false; |
| 1126 |
|
| 1127 |
} |
| 1128 |
|
| 1129 |
|
| 1130 |
/** |
| 1131 |
* in plugin - check if global subscription model is enabled |
| 1132 |
* |
| 1133 |
* @since 3.12 |
| 1134 |
* |
| 1135 |
*/ |
| 1136 |
public function wpstream_in_plugin_check_global_subscription_model($product_id) { |
| 1137 |
|
| 1138 |
// $selected_sub= get_post_meta($post->ID,'_wpstream_parent_sub',true); |
| 1139 |
if( is_user_logged_in() && function_exists('wcs_user_has_subscription') ){ |
| 1140 |
|
| 1141 |
global $woocommerce; |
| 1142 |
$current_user = wp_get_current_user(); |
| 1143 |
|
| 1144 |
$subscription_model = intval( get_option('wpstream_global_sub','')) ; |
| 1145 |
$main_subscription = intval( get_option('wpstream_global_sub_id','')); |
| 1146 |
|
| 1147 |
if($subscription_model==1){ |
| 1148 |
$selected_sub= get_post_meta($product_id,'_wpstream_parent_sub',true) ; |
| 1149 |
|
| 1150 |
if( is_array($selected_sub) ){ |
| 1151 |
|
| 1152 |
// we have per product sub |
| 1153 |
foreach($selected_sub as $key=>$subscrition_id ): |
| 1154 |
if( wcs_user_has_subscription( $current_user->ID, $subscrition_id ,'active') ) { |
| 1155 |
return true; |
| 1156 |
} |
| 1157 |
endforeach; |
| 1158 |
|
| 1159 |
} else if($main_subscription!=0){ |
| 1160 |
|
| 1161 |
// if we have one main subscription |
| 1162 |
if( wcs_user_has_subscription( $current_user->ID, $main_subscription ,'active') ) { |
| 1163 |
return true; |
| 1164 |
} |
| 1165 |
} |
| 1166 |
|
| 1167 |
|
| 1168 |
} |
| 1169 |
return false; |
| 1170 |
|
| 1171 |
} |
| 1172 |
// there is no woo subscription or user not logged in |
| 1173 |
return false; |
| 1174 |
} |
| 1175 |
|
| 1176 |
|
| 1177 |
|
| 1178 |
|
| 1179 |
|
| 1180 |
|
| 1181 |
|
| 1182 |
|
| 1183 |
|
| 1184 |
/** |
| 1185 |
* |
| 1186 |
* |
| 1187 |
* |
| 1188 |
* |
| 1189 |
* check if the user bought the product and display the player - TO REDo |
| 1190 |
* |
| 1191 |
* @since 3.0.1 |
| 1192 |
* returns html of the player |
| 1193 |
* |
| 1194 |
* |
| 1195 |
* |
| 1196 |
* |
| 1197 |
* |
| 1198 |
*/ |
| 1199 |
public function wpstream_user_logged_in_product_already_bought($from_sh_id='') { |
| 1200 |
if(function_exists('remove_wpstream_filter')){ |
| 1201 |
return; |
| 1202 |
} |
| 1203 |
global $product; |
| 1204 |
$product_id = $product->get_id(); |
| 1205 |
$current_user = wp_get_current_user(); |
| 1206 |
|
| 1207 |
if ( is_user_logged_in() ) { |
| 1208 |
|
| 1209 |
|
| 1210 |
if($this->wpstream_check_if_player_can_dsplay($product_id) ){ |
| 1211 |
|
| 1212 |
echo '<div class="wpstream_player_wrapper "><div class="wpstream_player_container">'; |
| 1213 |
|
| 1214 |
$is_subscription_live_event = esc_html(get_post_meta($product_id,'_subscript_live_event',true)); |
| 1215 |
$term_list = wp_get_post_terms($product_id, 'product_type'); |
| 1216 |
|
| 1217 |
|
| 1218 |
if( $term_list[0]->name=='live_stream' || ($term_list[0]->name=='subscription' && $is_subscription_live_event=='yes' ) ){ |
| 1219 |
$this->wpstream_live_event_player($product_id); |
| 1220 |
}else if( $term_list[0]->name=='video_on_demand' || ($term_list[0]->name=='subscription' && $is_subscription_live_event=='no' ) ){ |
| 1221 |
$this->wpstream_video_on_demand_player($product_id); |
| 1222 |
} |
| 1223 |
echo '</div></div>'; |
| 1224 |
}else{ |
| 1225 |
|
| 1226 |
|
| 1227 |
$term_list = wp_get_post_terms($product_id, 'product_type'); |
| 1228 |
|
| 1229 |
if( $term_list[0]->name=='subscription' ){ |
| 1230 |
|
| 1231 |
if( !wcs_user_has_subscription( $current_user->ID, $product_id ,'active') ) { |
| 1232 |
$this->wpstream_display_no_buy_message('nobuy',$product_id); |
| 1233 |
} |
| 1234 |
|
| 1235 |
}else{ |
| 1236 |
$this->wpstream_display_no_buy_message('nobuy',$product_id); |
| 1237 |
} |
| 1238 |
|
| 1239 |
|
| 1240 |
|
| 1241 |
} |
| 1242 |
|
| 1243 |
|
| 1244 |
}else{ |
| 1245 |
|
| 1246 |
$this->wpstream_display_no_buy_message('nolog',$product_id); |
| 1247 |
} |
| 1248 |
} |
| 1249 |
|
| 1250 |
|
| 1251 |
|
| 1252 |
|
| 1253 |
|
| 1254 |
/** |
| 1255 |
* |
| 1256 |
* |
| 1257 |
* check if the user bought the product and display the player - TO REDo |
| 1258 |
* |
| 1259 |
* @since 3.0.1 |
| 1260 |
* returns html of the player |
| 1261 |
*/ |
| 1262 |
|
| 1263 |
public function wpstream_chat_wrapper($product_id){ |
| 1264 |
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/templates/wpstream_chat_template.php'; |
| 1265 |
} |
| 1266 |
|
| 1267 |
|
| 1268 |
|
| 1269 |
|
| 1270 |
|
| 1271 |
|
| 1272 |
|
| 1273 |
|
| 1274 |
/** |
| 1275 |
* coonect to chat |
| 1276 |
* |
| 1277 |
* @since 1.12.2 |
| 1278 |
* |
| 1279 |
*/ |
| 1280 |
|
| 1281 |
|
| 1282 |
|
| 1283 |
public function wpstream_connect_to_chat($product_id){ |
| 1284 |
$current_user = wp_get_current_user(); |
| 1285 |
$userID = $current_user->ID; |
| 1286 |
$user_login = $current_user->user_login; |
| 1287 |
|
| 1288 |
$key=''; |
| 1289 |
|
| 1290 |
$chat_url = get_post_meta($product_id,'chat_url',true); |
| 1291 |
|
| 1292 |
|
| 1293 |
wp_enqueue_script( 'sockjs-0.3.min' ); |
| 1294 |
wp_enqueue_script( 'emojione.min.js' ); |
| 1295 |
wp_enqueue_script( "jquery-effects-core"); |
| 1296 |
wp_enqueue_script( 'jquery.linkify.min.js'); |
| 1297 |
wp_enqueue_script( 'ripples.min.js'); |
| 1298 |
wp_enqueue_script( 'material.min.js'); |
| 1299 |
wp_enqueue_script( 'chat.js'); |
| 1300 |
|
| 1301 |
|
| 1302 |
|
| 1303 |
wp_enqueue_style( 'chat.css'); |
| 1304 |
wp_enqueue_style( 'ripples.css'); |
| 1305 |
wp_enqueue_style( 'emojione.min.css'); |
| 1306 |
|
| 1307 |
|
| 1308 |
|
| 1309 |
|
| 1310 |
if(!is_user_logged_in()){ |
| 1311 |
$user_login=''; |
| 1312 |
$chat_url=''; |
| 1313 |
} |
| 1314 |
|
| 1315 |
|
| 1316 |
print '<script type="text/javascript"> |
| 1317 |
//<![CDATA[ |
| 1318 |
jQuery(document).ready(function(){ |
| 1319 |
username = "'.$user_login.'"; |
| 1320 |
key="'.$key.'"; |
| 1321 |
|
| 1322 |
}); |
| 1323 |
//]]> |
| 1324 |
</script>'; |
| 1325 |
|
| 1326 |
} |
| 1327 |
|
| 1328 |
|
| 1329 |
/** |
| 1330 |
* display no buy Message |
| 1331 |
* |
| 1332 |
* @since 3.12.2 |
| 1333 |
* |
| 1334 |
*/ |
| 1335 |
public function wpstream_display_no_buy_message($log,$product_id) { |
| 1336 |
|
| 1337 |
if($log=='sub_active'){ |
| 1338 |
$message= esc_html( get_option('wpstream_subscription_active','Your Subscription is Active.')) ; |
| 1339 |
echo '<div class="wpstream_player_wrapper no_buy"><div class="wpstream_player_container">'; |
| 1340 |
echo '<div class="wpstream_notice"> '.$message.'</div>'; |
| 1341 |
echo '</div></div>'; |
| 1342 |
return; |
| 1343 |
|
| 1344 |
}else if($log=='nolog'){ |
| 1345 |
$message= esc_html( get_option('wpstream_product_not_login','You must be logged in to watch this video.')) ; |
| 1346 |
}else{ |
| 1347 |
$message =esc_html( get_option('wpstream_product_not_bought','You did not yet purchase this item.')) ; |
| 1348 |
} |
| 1349 |
$subscription_model = intval( get_option('wpstream_global_sub','')) ; |
| 1350 |
if($subscription_model==1){ |
| 1351 |
$message =esc_html( get_option('wpstream_product_not_subscribe','You did not yet subscribe to this item.')); |
| 1352 |
} |
| 1353 |
|
| 1354 |
|
| 1355 |
if( get_post_type($product_id) == 'product' && $subscription_model==0 ){ |
| 1356 |
$product = wc_get_product($product_id); |
| 1357 |
$term_list = wp_get_post_terms($product_id, 'product_type'); |
| 1358 |
$product_type = $product->get_type(); |
| 1359 |
$is_subscription_live_event = esc_html(get_post_meta($product_id,'_subscript_live_event',true)); |
| 1360 |
|
| 1361 |
|
| 1362 |
|
| 1363 |
if( $term_list[0]->name=='video_on_demand' || $term_list[0]->name=='live_stream' || $product_type=='subscription'){ |
| 1364 |
|
| 1365 |
echo '<div class="wpstream_player_wrapper no_buy"><div class="wpstream_player_container">'; |
| 1366 |
echo '<div class="wpstream_notice">'.$message.'</div>'; |
| 1367 |
echo '</div></div>'; |
| 1368 |
|
| 1369 |
} |
| 1370 |
|
| 1371 |
}else if( get_post_type($product_id) == 'product' && $subscription_model==1 ){ |
| 1372 |
$term_list = wp_get_post_terms($product_id, 'product_type'); |
| 1373 |
if( $term_list[0]->name!=='simple'){ |
| 1374 |
echo '<div class="wpstream_player_wrapper no_buy"><div class="wpstream_player_container">'; |
| 1375 |
echo '<div class="wpstream_notice"> '.$message.'</div>'; |
| 1376 |
echo '</div></div>'; |
| 1377 |
} |
| 1378 |
} |
| 1379 |
|
| 1380 |
|
| 1381 |
|
| 1382 |
|
| 1383 |
|
| 1384 |
|
| 1385 |
} |
| 1386 |
|
| 1387 |
|
| 1388 |
} |