PluginProbe
WpStream – Live Streaming, Video on Demand, Pay Per View / 3.8
WpStream – Live Streaming, Video on Demand, Pay Per View v3.8
4.14.1 4.14.0 4.13.2 4.13.1 4.13 4.12.5 4.12.4 4.12.3 4.12.2 4.12.1 4.12 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5 4.5.1 4.5.11 4.5.11.1 4.5.11.2 4.5.11.4 4.5.11.5 4.5.11.6 All 181 releases
← All changes | includes/class-wpstream-player.php +368 -480 4.53.8 View file →
@@ -22,9 +22,10 @@
22 22 add_action( 'wp_ajax_wpstream_player_check_status', array($this,'wpstream_player_check_status') );
23 23 add_action('wp_ajax_nopriv_wpstream_player_check_status', array($this,'wpstream_player_check_status'));
24 24
25 25
26 -
26 + add_action( 'wp_ajax_wpstream_force_clear_transient', array($this,'wpstream_force_clear_transient') );
27 + add_action('wp_ajax_nopriv_wpstream_force_clear_transient', array($this,'wpstream_force_clear_transient'));
27 28
28 29
29 30 }
30 31
@@ -29,15 +30,27 @@
29 30 }
30 31
31 32
32 33
33 -
34 + /**
35 + * clear status transients
36 + *
37 + * @author cretu
38 + */
34 39
40 +
41 + public function wpstream_force_clear_transient($event_id){
42 +
43 + $transient_name = 'event_data_to_return_'.$event_id;
44 + delete_transient($transient_name);
45 + update_post_meta($event_id,'statsUrl','');
46 + update_post_meta($event_id,'chatUrl','');
35 47
48 + }
49 +
50 +
51 +
36 52 /**
37 - *
38 - * edited 4.0
39 - *
40 53 * check player status
41 54 *
42 55 * @author cretu
43 56 */
@@ -42,54 +55,115 @@
42 55 * @author cretu
43 56 */
44 57
45 58 public function wpstream_player_check_status(){
46 - $channel_id = intval($_POST['channel_id']);
47 -
48 -
49 - $transient_name = 'event_data_to_return_'. $channel_id;
59 + $event_id = intval($_POST['event_id']);
60 + $show_id=$event_id;
61 + $transient_name = 'event_data_to_return_'.$event_id;
50 62 $event_data_for_transient = get_transient( $transient_name );
51 63
64 +
65 +
66 + if ( false === $event_data_for_transient || $event_data_for_transient=='' ) { //ws || $hls_to_return==''
67 +
68 + $server_id = ''; // server id IS blank - need to retrive it
69 + $token = $this->main->wpstream_live_connection->wpstream_get_token();
70 +
71 + if($server_id==''){
72 + update_post_meta($show_id,'server_id', '' );
73 +
74 + $server_id =$this->main->wpstream_live_connection->retrive_server_id_based_on_show_id($show_id);
75 +
76 + }
77 +
52 78
79 +
80 + update_post_meta($show_id,'server_id', $server_id );
81 + $values_array=array(
82 + "server_id" => esc_html($server_id),
83 + 'from_where' => 'wpstream_check_event_status_front_player'
84 + );
85 +
86 + if($server_id==''){
87 + $this->main->wpstream_live_connection->wpstream_reset_event_data($show_id);
88 + //print 'failed connection';
89 + return;
90 + }
91 +
92 +
93 +
94 + $url=WPSTREAM_CLUBLINKSSL."://www.".WPSTREAM_CLUBLINK."/wp-json/rcapi/v1/api20-livestrem/event_status/?access_token=".$token;
95 + $arguments = array(
96 + 'method' => 'GET',
97 + 'timeout' => 45,
98 + 'redirection' => 5,
99 + 'httpversion' => '1.0',
100 + 'blocking' => true,
101 + 'headers' => array(),
102 + 'body' => $values_array,
103 + 'cookies' => array()
104 + );
53 105
54 - if ( false === $event_data_for_transient || $event_data_for_transient=='' ) { //ws || $hls_to_return==''
55 - $notes = 'wpstream_player_check_status_note_from_js';
56 - $event_status = $this->main->wpstream_live_connection-> wpstream_check_event_status_api_call($channel_id,$notes);
57 - $event_data_for_transient = $event_status;
106 + $response = wp_remote_post($url,$arguments);
107 + $received_data = wp_remote_retrieve_body($response);
58 108
59 - set_transient($transient_name,$event_data_for_transient,45);
109 + if( isset($response['response']['code']) && $response['response']['code']=='200'){
110 + $received_data_encoded=json_decode($received_data,true);
111 +
112 + if( isset($received_data_encoded['success']) && intval( $received_data_encoded['success'] ) ==1 ){
113 +
114 + /*
115 + * we set transient and return the array saved
116 + * false if no data
117 + *
118 + * */
119 + $event_data_for_transient= $this->main->wpstream_live_connection->api20_wpstream_update_event($received_data_encoded,$show_id,$server_id);
120 + }else{
121 + $this->main->wpstream_live_connection->wpstream_reset_event_data($show_id);
122 + }
123 +
124 + }else{
125 + $this->main->wpstream_live_connection->wpstream_reset_event_data($show_id);
126 + }
127 +
128 +
129 +
130 +
131 + if ( false === $event_data_for_transient || $event_data_for_transient=='' ){
132 + //we are not live
133 + $event_data_for_transient=array();
134 + $event_data_for_transient['hlsPlaybackUrl']='';
135 +
136 + }
60 137 }
61 138
62 139
63 - if( isset($event_data_for_transient['hls_playback_url']) && $event_data_for_transient['hls_playback_url']!=''){
140 +
141 + // 1==2 &&
142 +
143 + if( $event_data_for_transient['hlsPlaybackUrl']!=''){
64 144 echo json_encode( array(
65 145
66 146 'started' => 'yes',
67 - 'channel_id' => $channel_id,
68 - 'event_uri' => $event_data_for_transient['hls_playback_url'],
69 - 'live_conect_views' => $event_data_for_transient['stats_url'],
70 - 'chat_url' => $event_data_for_transient['chat_url'],
71 - '$event_data_for_transient'=>$event_data_for_transient
72 -
147 + 'server_id' => $event_data_for_transient['server_id'],
148 + 'event_id' => $event_id,
149 + 'event_uri' => $event_data_for_transient['hlsPlaybackUrl'],
150 + 'live_conect_views' => $event_data_for_transient['statsUrl'],
151 + 'chat_url' => $event_data_for_transient['chatUrl'],
73 152
74 153 ));
75 - update_post_meta($channel_id,'stream_name',$event_data_for_transient['stream_name']);
76 - update_post_meta($channel_id,'hls_key_retrieval_url',$event_data_for_transient['hls_key_retrieval_url']);
77 - delete_transient( 'free_event_streamName_'.$event_data_for_transient['stream_name']);
78 -
79 154 }else{
80 155 echo json_encode( array(
81 156 'started' => 'no',
82 - 'server_id' => '',
83 - 'channel_id' => $channel_id,
157 + 'server_id' => $server_id,
158 + 'event_id' => $event_id,
84 159 'event_uri' => '',
85 160 'live_conect_views' => '',
86 161 'chat_url' => '',
87 162
88 163 ));
89 -
164 + $this->wpstream_force_clear_transient($event_id);
90 165 }
91 -
92 166 die();
93 167 }
94 168
95 169
@@ -99,9 +173,9 @@
99 173 *
100 174 * @author cretu
101 175 */
102 176 public function wpstream_filter_the_title( $content ) {
103 - if( is_singular('wpstream_product') || is_singular('wpstream_product_vod') ){
177 + if( is_singular('wpstream_product')){
104 178 global $post;
105 179 $args=array('id'=>$post->ID);
106 180 $custom_content = $this->wpstream_insert_player_inpage($args);
107 181 $content = '<div class="wpestream_inserted_player">'.$custom_content.'</div>'.$content;
@@ -153,32 +227,30 @@
153 227 */
154 228
155 229 public function wpstream_video_player_shortcode($from_sh_id='') {
156 230
157 -
158 -
159 231 if ( is_user_logged_in() ) {
160 232 global $product;
161 233 $current_user = wp_get_current_user();
162 234 $product_id = intval($from_sh_id);
163 - $term_list = wp_get_post_terms($product_id, 'product_type');
164 -
165 -
166 235
167 236
168 -
169 - 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) )
170 - || get_post_type($product_id)=='wpstream_product' || get_post_type($product_id)=='wpstream_product_vod' ){
237 + 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' ){
171 238 global $product;
172 239 echo '<div class="wpstream_player_wrapper wpstream_player_shortcode"><div class="wpstream_player_container">';
173 240
174 241
175 242 if( get_post_type($product_id) == 'wpstream_product' ){
176 - $this->wpstream_live_event_player($product_id);
177 - }else if( get_post_type($product_id) == 'wpstream_product_vod' ){
178 - $this->wpstream_video_on_demand_player($product_id);
243 +
244 + $wpstream_product_type = esc_html(get_post_meta($product_id, 'wpstream_product_type', true));
245 + if($wpstream_product_type==1){
246 + $this->wpstream_live_event_player($product_id);
247 + } else if($wpstream_product_type==2 || $wpstream_product_type==3){
248 + $this->wpstream_video_on_demand_player($product_id);
249 + }
250 +
179 251 }else{
180 -
252 + $term_list = wp_get_post_terms($product_id, 'product_type');
181 253 $is_subscription_live_event = esc_html(get_post_meta($product_id,'_subscript_live_event',true));
182 254
183 255 if( $term_list[0]->name=='live_stream' || ( $term_list[0]->name=='subscription' && $is_subscription_live_event=='yes' ) ){
184 256 $this->wpstream_live_event_player($product_id);
@@ -192,10 +264,9 @@
192 264 }else{
193 265
194 266 if( get_post_type($product_id) == 'product' ){
195 267 echo '<div class="wpstream_player_wrapper wpstream_player_shortcode no_buy"><div class="wpstream_player_container">';
196 - $message =esc_html( get_option('wpstream_product_not_bought','You did not yet purchase this item.')) ;
197 - echo '<div class="wpstream_notice" style="background:#e16767;">'.esc_html($message).'</div>';
268 + echo '<div class="wpstream_notice" style="background:#e16767;">'.esc_html__('You did not buy this product!','wpstream').'</div>';
198 269 echo '</div></div>';
199 270 }
200 271 }
201 272
@@ -202,22 +273,17 @@
202 273
203 274 }else{
204 275
205 276 $product_id = intval($from_sh_id);
206 - $term_list = wp_get_post_terms($product_id, 'product_type');
207 -
208 - if( get_post_type($product_id) == 'product' && ($term_list[0]->name=='live_stream' || $term_list[0]->name=='video_on_demand') ){
209 -
210 - echo '<div class="wpstream_player_wrapper wpstream_player_shortcode no_buy"><div class="wpstream_player_container">';
211 - $message= esc_html( get_option('wpstream_product_not_login','You must be logged in to watch this video.')) ;
277 + if( get_post_type($product_id) == 'wpstream_product' ){
212 278
279 + $wpstream_product_type = esc_html(get_post_meta($product_id, 'wpstream_product_type', true));
280 + if($wpstream_product_type==1){
281 + $this->wpstream_live_event_player($product_id);
282 + } else if($wpstream_product_type==2 || $wpstream_product_type==3){
283 + $this->wpstream_video_on_demand_player($product_id);
284 + }
213 285
214 - echo '<div class="wpstream_notice" style="background:#e16767;">'.esc_html($message).'</div>';
215 - echo '</div></div>';
216 - }elseif( get_post_type($product_id) == 'wpstream_product' ){
217 - $this->wpstream_live_event_player($product_id);
218 - } else if( get_post_type($product_id) == 'wpstream_product_vod' ){
219 - $this->wpstream_video_on_demand_player($product_id);
220 286 }
221 287 }
222 288 }
223 289
@@ -242,9 +308,14 @@
242 308 echo '<div class="wpstream_player_wrapper wpstream_player_shortcode"><div class="wpstream_player_container">';
243 309
244 310
245 311 if( get_post_type($product_id) == 'wpstream_product' ){
246 - $this->wpstream_live_event_player_low_latency($product_id);
312 +
313 + $wpstream_product_type = esc_html(get_post_meta($product_id, 'wpstream_product_type', true));
314 + if($wpstream_product_type==1){
315 + $this->wpstream_live_event_player_low_latency($product_id);
316 + }
317 +
247 318 }else{
248 319 $term_list = wp_get_post_terms($product_id, 'product_type');
249 320 $is_subscription_live_event = esc_html(get_post_meta($product_id,'_subscript_live_event',true));
250 321
@@ -258,11 +329,9 @@
258 329 }else{
259 330
260 331 if( get_post_type($product_id) == 'product' ){
261 332 echo '<div class="wpstream_player_wrapper wpstream_player_shortcode no_buy"><div class="wpstream_player_container">';
262 -
263 - $message =esc_html( get_option('wpstream_product_not_bought','You did not yet purchase this item.')) ;
264 - echo '<div class="wpstream_notice" style="background:#e16767;">'.$message.'</div>';
333 + echo '<div class="wpstream_notice" style="background:#e16767;">'.esc_html__('You did not buy this product!','wpstream').'</div>';
265 334 echo '</div></div>';
266 335 }
267 336 }
268 337
@@ -269,9 +338,13 @@
269 338
270 339 }else{
271 340 $product_id = intval($from_sh_id);
272 341 if( get_post_type($product_id) == 'wpstream_product' ){
273 - $this->wpstream_live_event_player_low_latency($product_id);
342 +
343 + $wpstream_product_type = esc_html(get_post_meta($product_id, 'wpstream_product_type', true));
344 + if($wpstream_product_type==1){
345 + $this->wpstream_live_event_player_low_latency($product_id);
346 + }
274 347 }
275 348 }
276 349 }
277 350
@@ -312,95 +385,67 @@
312 385
313 386
314 387
315 388 /**
316 - * edited in 4.0
317 - *
318 389 * Live Event Player
319 390 *
320 391 * @author cretu
321 392 */
322 393
323 - function wpstream_live_event_player($channel_id,$poster_show='',$use_chat=''){
324 -
325 - $now = time().rand(0,1000000);
326 - $thumb_id = get_post_thumbnail_id($channel_id);
327 - $thumb = wp_get_attachment_image_src($thumb_id,'small');
328 - $usernamestream = esc_html ( get_option('wpstream_api_username','') );
329 - $autoplay = 'autoplay';
394 + function wpstream_live_event_player($product_id,$poster_show='',$use_chat=''){
330 395
331 - $event_settings = $this->wpestream_return_event_settings($channel_id);
332 - $notes = 'wpstream_live_event_player_note';
333 - $event_status = $this->main->wpstream_live_connection-> wpstream_check_event_status_api_call($channel_id,$notes);
334 - $hls_playback_url = '';
335 - $live_conect_views = '';
396 + $event_settings = $this->wpestream_return_event_settings($product_id);
397 + $live_event_uri = get_post_meta($product_id,'live_event_uri',true);
398 + $api20_event_id = get_post_meta($product_id,'server_id',true);
336 399
337 - if(isset($event_status['status']) && $event_status['status']=='active'){
338 - //live event
339 - if(isset($event_status['hls_playback_url'])){
340 - $hls_playback_url = $event_status['hls_playback_url'];
341 -
342 - update_post_meta($channel_id,'stream_name',$event_status['stream_name']);
343 - update_post_meta($channel_id,'hls_key_retrieval_url',$event_status['hls_key_retrieval_url']);
344 - delete_transient( 'free_event_streamName_'.$event_status['stream_name']);
400 + $thumb_id = get_post_thumbnail_id($product_id);
401 + $thumb = wp_get_attachment_image_src($thumb_id,'small');
345 402
346 - $live_conect_array = explode('live.streamer.wpstream.net',$hls_playback_url);
347 - $live_conect_views = $live_conect_array[0].'live.streamer.wpstream.net';
348 - $live_conect_views = $this->remove_http($live_conect_views);
403 + $chatUrl= get_post_meta($product_id,'statsUrl',true);
349 404
350 - }
351 - if(isset($event_status['chat_url'])){
352 - $chat_url = $event_status['chat_url'];
353 - }
354 -
355 - }else{
356 - // event not live
357 - }
358 -
359 -
360 405
361 -
362 -
363 -
364 -
365 - if(isset($event_settings['autoplay']) && intval($event_settings['autoplay'])==0){
406 + $live_event_uri_final = $this->wpstream_request_hls_player_dynamic('',$product_id);// buleala lu Gabi
407 + $now = time().rand(0,10);
408 + $live_conect_array = explode('live.streamer.wpstream.net',$live_event_uri_final);
409 + $live_conect_views = $live_conect_array[0].'live.streamer.wpstream.net';
410 + $live_conect_views = $this->remove_http($live_conect_views);
411 + $usernamestream = esc_html ( get_option('wpstream_api_username','') );
412 + $autoplay = 'autoplay';
413 + if(intval($event_settings['autoplay'])==0){
366 414 $autoplay='no_autoplay';
367 415 }
368 -
369 - 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.'" > ';
416 +
417 + echo '<div class="wpstream_live_player_wrapper function_wpstream_live_event_player" data-now="'.$now.'" data-me="'.esc_attr($usernamestream).'" data-product-id="'.$product_id.'" id="wpstream_live_player_wrapper'.$now.'" > ';
370 418
371 - if( ( isset($event_settings['view_count'] ) && intval($event_settings['view_count'])==1 ) || !isset($event_settings['view_count']) ){
419 + if(intval($event_settings['view_count'])==1){
372 420 echo '<div id="wpestream_live_counting" class="wpestream_live_counting"></div>';
373 421 }
374 422
375 - $show_wpstream_not_live_mess=' style="display:none;" ';
376 - if(trim($hls_playback_url) ==''){
377 -
378 - $show_wpstream_not_live_mess='';
379 - }
380 -
381 - $message_show= esc_html( get_option('wpstream_you_are_not_live','We are not live at this moment. Please check back later.')) ;
382 - 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>';
423 + $show_wpstream_not_live_mess=' style="display:none;" ';
424 + if(trim($live_event_uri_final) ==''){
425 + $show_wpstream_not_live_mess='';
426 + }
427 +
428 +
429 + 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__('We are not live at this moment. Please check back later.','wpstream').'</div></div>';
383 430
384 - $poster_data='';
385 - if(isset($thumb[0])){
431 +
386 432 $poster_data=' poster="'.$thumb[0].'" ';
387 - }
388 - if($poster_show=='no'){
389 - $poster_data='';
390 - }
391 -
392 - $is_muted='';
393 - if( isset($event_settings['mute']) && intval($event_settings['mute'])==1){
394 - $is_muted=' muted ';
395 - }
433 + if($poster_show=='no'){
434 + $poster_data='';
435 + }
396 436
437 + $is_muted='';
438 + if(intval($event_settings['mute'])==1){
439 + $is_muted=' muted ';
440 + }
441 +
397 442
398 -
443 +
399 444 echo'
400 445 <video id="wpstream-video'.$now.'" '.$poster_data.' class="video-js vjs-default-skin vjs-16-9 vjs-wpstream" playsinline="true" '.$is_muted.' controls data-autoplay='.$autoplay.'>
401 446 <source
402 - src="'.$hls_playback_url.'"
447 + src="'.$live_event_uri_final.'"
403 448 type="application/x-mpegURL">
404 449 </video>';
405 450
406 451 print '<script type="text/javascript">
@@ -405,9 +450,9 @@
405 450
406 451 print '<script type="text/javascript">
407 452 //<![CDATA[
408 453 jQuery(document).ready(function(){
409 - wpstream_player_initialize("'.$now.'","'.$hls_playback_url.'","'.$live_conect_views.'","'.$autoplay.'");';
454 + wpstream_player_initialize("'.$now.'","'.$live_event_uri_final.'","'.$live_conect_views.'","'.$autoplay.'");';
410 455 print'});
411 456 //]]>
412 457 </script>';
413 458 print '</div>';
@@ -412,9 +457,9 @@
412 457 </script>';
413 458 print '</div>';
414 459
415 460
416 - if(trim($hls_playback_url) ==''){
461 + if(trim($live_event_uri_final) ==''){
417 462 // $show_wpstream_not_live_mess='';
418 463 }else{
419 464 print '<script type="text/javascript">
420 465 //<![CDATA[
@@ -419,9 +464,9 @@
419 464 print '<script type="text/javascript">
420 465 //<![CDATA[
421 466 jQuery(document).ready(function(){
422 467 var player_wrapper = jQuery(".wpstream_live_player_wrapper");
423 - wpstream_read_websocket_info("'.$channel_id.'","wpstream_live_player_wrapper'.$now.'", player_wrapper ,"'.$chat_url.'", "'.$hls_playback_url.'");
468 + wpstream_read_websocket_info("'.$product_id.'","wpstream_live_player_wrapper'.$now.'", player_wrapper ,"'.$chatUrl.'", "'.$live_event_uri_final.'");
424 469 });
425 470 //]]>
426 471 </script>';
427 472 }
@@ -427,9 +472,9 @@
427 472 }
428 473
429 474
430 475 if($use_chat=="yes"){
431 - $this->wpstream_connect_to_chat($channel_id);
476 + $this->wpstream_connect_to_chat($product_id);
432 477 }
433 478
434 479 usleep (10000);
435 480
@@ -437,66 +482,48 @@
437 482
438 483
439 484
440 485 /**
441 - *
442 - * Edited in 4.0
443 - *
444 - *
445 486 * Live Event Player
446 487 *
447 488 * @author cretu
448 489 */
449 490
450 - function wpstream_live_event_player_low_latency($channel_id,$poster_show='',$use_chat=''){
451 - $usernamestream = esc_html ( get_option('wpstream_api_username','') );
452 - $thumb_id = get_post_thumbnail_id($channel_id);
491 + function wpstream_live_event_player_low_latency($product_id,$poster_show='',$use_chat=''){
492 + $event_settings = $this->wpestream_return_event_settings($product_id);
493 + $live_event_uri = get_post_meta($product_id,'live_event_uri',true);
494 + $api20_event_id = get_post_meta($product_id,'server_id',true);
495 +
496 + $thumb_id = get_post_thumbnail_id($product_id);
453 497 $thumb = wp_get_attachment_image_src($thumb_id,'small');
498 +
499 + $chatUrl= get_post_meta($product_id,'statsUrl',true);
454 500
455 - $event_settings = $this->wpestream_return_event_settings($channel_id);
456 - $notes = 'wpstream_live_event_player_low_latency_note';
457 - $event_status = $this->main->wpstream_live_connection-> wpstream_check_event_status_api_call($channel_id,$notes);
458 - $hls_playback_url = '';
459 - $live_conect_views = '';
460 - $now = time().rand(0,10);
501 +
502 + //$live_event_uri_final = $this->wpstream_request_hls_player_dynamic('',$product_id);// buleala lu Gabi
461 503
462 504
463 -
464 - if(isset($event_status['status']) && $event_status['status']=='active'){
465 - //live event
466 - if(isset($event_status['sldp_playback_url'])){
467 - $hls_playback_url = $event_status['sldp_playback_url'];
468 -
469 - $live_conect_array = explode('live.streamer.wpstream.net',$hls_playback_url);
470 - $live_conect_views = $live_conect_array[0].'live.streamer.wpstream.net';
471 - $live_conect_views = $this->remove_http($live_conect_views);
505 + $live_event_uri_final= get_post_meta($product_id,'sldpPlaybackUrl',true);
506 + $now = time().rand(0,10);
507 +
508 + $usernamestream = esc_html ( get_option('wpstream_api_username','') );
472 509
473 - }
474 - if(isset($event_status['chat_url'])){
475 - $chat_url =$event_status['chat_url'];
476 - }
477 -
478 - }else{
479 - // event not live
480 - }
481 510
511 +
482 512
483 -
484 -
485 - 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.'" > ';
513 + 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="'.$product_id.'" id="wpstream_live_player_wrapper'.$now.'" > ';
486 514
487 -
488 - if( ( isset($event_settings['view_count'] ) && intval($event_settings['view_count'])==1 ) || !isset($event_settings['view_count']) ){
515 + if(intval($event_settings['view_count'])==1){
489 516 echo '<div id="wpestream_live_counting" class="wpestream_live_counting"></div>';
490 517 }
491 518
492 519 $show_wpstream_not_live_mess=' style="display:none;" ';
493 - if(trim($hls_playback_url) ==''){
520 + if(trim($live_event_uri_final) ==''){
494 521 $show_wpstream_not_live_mess='';
495 522 }
496 523
497 - $message_show= esc_html( get_option('wpstream_you_are_not_live','We are not live at this moment. Please check back later.')) ;
498 - 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>';
524 +
525 + 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__('We are not live at this moment. Please check back later.','wpstream').'</div></div>';
499 526
500 527
501 528 $poster_data=' poster="'.$thumb[0].'" ';
502 529 if($poster_show=='no'){
@@ -504,15 +531,14 @@
504 531 }
505 532
506 533
507 534 $is_muted='';
508 - if( isset($event_settings['mute']) && intval($event_settings['mute'])==1){
509 - $is_muted=' muted ';
535 + if(intval($event_settings['mute'])==1){
536 + $is_muted='muted';
510 537 }
511 538
512 -
513 539 $autoplay='autoplay';
514 - if(isset($event_settings['autoplay']) && intval($event_settings['autoplay'])==0){
540 + if(intval($event_settings['autoplay'])==0){
515 541 $autoplay='no_autoplay';
516 542 }
517 543
518 544 echo'
@@ -522,9 +548,9 @@
522 548 print '<script type="text/javascript">
523 549 //<![CDATA[
524 550 jQuery(document).ready(function(){
525 551 var low_latencyid="wpstream-video'.$now.'";
526 - document.addEventListener("DOMContentLoaded", initPlayer(low_latencyid, "'.$hls_playback_url.'","'.$is_muted.'","'.$autoplay.'" ) ); ';
552 + document.addEventListener("DOMContentLoaded", initPlayer(low_latencyid, "'.$live_event_uri_final.'","'.$is_muted.'","'.$autoplay.'" ) ); ';
527 553 print'});
528 554 //]]>
529 555 </script>';
530 556
@@ -529,9 +555,9 @@
529 555 </script>';
530 556
531 557
532 558
533 - if(trim($hls_playback_url) ==''){
559 + if(trim($live_event_uri_final) ==''){
534 560 // $show_wpstream_not_live_mess='';
535 561 }else{
536 562 print '<script type="text/javascript">
537 563 //<![CDATA[
@@ -536,9 +562,9 @@
536 562 print '<script type="text/javascript">
537 563 //<![CDATA[
538 564 jQuery(document).ready(function(){
539 565 var player_wrapper = jQuery(".wpstream_live_player_wrapper");
540 - wpstream_read_websocket_info("'.$channel_id.'","wpstream_live_player_wrapper'.$now.'", player_wrapper ,"'.$chat_url.'", "'.$hls_playback_url.'");
566 + wpstream_read_websocket_info("'.$product_id.'","wpstream_live_player_wrapper'.$now.'", player_wrapper ,"'.$chatUrl.'", "'.$live_event_uri_final.'");
541 567 });
542 568 //]]>
543 569 </script>';
544 570 }
@@ -544,9 +570,9 @@
544 570 }
545 571
546 572
547 573 if($use_chat=="yes"){
548 - $this->wpstream_connect_to_chat($channel_id);
574 + $this->wpstream_connect_to_chat($product_id);
549 575 }
550 576
551 577 usleep (10000);
552 578
@@ -553,99 +579,128 @@
553 579 }
554 580
555 581
556 582
557 -
558 -
559 - /*
560 - *
561 - * Request HLS player
562 - *
563 - *
564 - *
583 + /**
584 + * HLS PLAYER
585 + *
586 + * @author cretu
565 587 */
566 - public function wpstream_request_video_on_demand_hls_player($video_name,$product_id){
567 - if($video_name==''){
568 - return '';
569 - }
570 -
571 - $transient_name = 'wpstream_video_on_demand_'.$video_name;
572 - $hls_to_return = get_transient( $transient_name );
573 - $hls_to_return = false;
588 + public function wpstream_request_hls_player_dynamic($server_id,$product_id){
589 +
590 + $transient_name = 'hls_to_return_'.$product_id;
591 + $hls_to_return = get_transient( $transient_name );
574 592
575 -
576 - if($hls_to_return==false){
577 -
578 - $access_token = $this->main->wpstream_live_connection->wpstream_get_token();
579 - $url = 'video/info';
593 + if ( false === $hls_to_return || $hls_to_return=='' ) { //ws || $hls_to_return==''
594 +
595 + $token = $this->main->wpstream_live_connection->wpstream_get_token();
596 + $values_array = array();
597 + $values_array['server_id'] = $server_id;
598 +
599 + if($server_id==''){
600 + $this->main->wpstream_live_connection->wpstream_check_event_status_front_player($product_id,$server_id);
601 + $server_id = get_post_meta($product_id,'server_id', true );
602 + $values_array['server_id'] = $server_id;
603 + }
580 604
581 - //corsorigin de check
582 - $local_event_options = get_option('wpstream_user_streaming_global_channel_options') ;
583 - $domain = parse_url ( get_site_url() );
584 - $domain_scheme = 'http';
585 - if(is_ssl()){
586 - $domain_scheme='https';
605 +
606 + if($server_id==''){
607 + delete_transient($transient_name);
608 + return '';exit();
587 609 }
610 +
611 + $url = WPSTREAM_CLUBLINKSSL."://www.".WPSTREAM_CLUBLINK."/wp-json/rcapi/v1/api20-livestrem/ap20_get_player_hls_dynamic/?access_token=".$token;
588 612
589 - $corsorigin='';
590 - if( isset($local_event_options['vod_domain_lock']) ){
591 - if (intval( $local_event_options['vod_domain_lock']) ==0 ){
592 - $corsorigin='*';
593 - }
594 - }else{
595 - $corsorigin='*';
613 +
614 + $arguments = array(
615 + 'method' => 'GET',
616 + 'timeout' => 45,
617 + 'redirection' => 5,
618 + 'httpversion' => '1.0',
619 + 'blocking' => true,
620 + 'headers' => array(),
621 + 'body' => $values_array,
622 + 'cookies' => array()
623 + );
624 + $response = wp_remote_post($url,$arguments);
625 +
626 + $received_data = json_decode( wp_remote_retrieve_body($response) ,true);
627 +
628 +
629 +
630 +
631 + if( isset($response['response']['code']) && $response['response']['code']=='200'){
632 + $hls_to_return = trim($received_data);
633 +
634 +
635 + set_transient( $transient_name, $hls_to_return, 60 );
636 + return $hls_to_return;
637 + }else{
638 + return 'failed connection';
596 639 }
640 + exit();
641 + }else{
642 + return $hls_to_return;
643 + }
597 644
598 - if($corsorigin!='*'){
599 - $corsorigin=$domain_scheme.'://'.$domain['host'];
600 - }
645 + }
601 646
602 - $is_encrypt="false";
603 - if( isset($local_event_options['vod_encrypt']) && intval( $local_event_options['vod_encrypt']) ==1 ){
604 - $is_encrypt="true";
605 - }
606 647
607 - $hlsKeysUrlPrefix = get_site_url().'?wpstream_voddrm=';
608 - $encrypt = $is_encrypt;
609 - $debugDrm = false;
610 648
611 - $curl_post_fields=array(
612 - 'access_token' => $access_token,
613 - 'name' => $video_name,
614 - 'corsOrigin' => $corsorigin,
615 - 'encryptHls' => $encrypt,
616 - 'hlsKeysUrlPrefix' => $hlsKeysUrlPrefix,
617 - 'debugDrm' => $debugDrm,
649 + /**
650 + * HLS PLAYER
651 + *
652 + * @author cretu
653 + */
654 +
655 +
656 + public function wpstream_request_hls_player($product_id){
657 +
658 + $transient_name = 'hls_to_return_'.$product_id;
659 + $hls_to_return = get_transient( $transient_name );
660 +
661 + if ( false === $hls_to_return || $hls_to_return=='' ) {
662 +
663 + $show_id = intval($product_id);
664 + $token = $this->main->wpstream_live_connection->wpstream_get_token();
665 + $values_array = array();
666 + $values_array['show_id'] = $show_id;
667 +
668 + $url = WPSTREAM_CLUBLINKSSL."://www.".WPSTREAM_CLUBLINK."/wp-json/rcapi/v1/videos/ap20_get_player_hls/?access_token=".$token;
669 +
670 +
671 + $arguments = array(
672 + 'method' => 'GET',
673 + 'timeout' => 45,
674 + 'redirection' => 5,
675 + 'httpversion' => '1.0',
676 + 'blocking' => true,
677 + 'headers' => array(),
678 + 'body' => $values_array,
679 + 'cookies' => array()
618 680 );
681 + $response = wp_remote_post($url,$arguments);
682 +
683 + $received_data = json_decode( wp_remote_retrieve_body($response) ,true);
619 684
620 -
621 - $curl_response = $this->main->wpstream_live_connection->wpstream_baker_do_curl_base($url,$curl_post_fields);
622 - $curl_response_decoded = json_decode($curl_response,JSON_OBJECT_AS_ARRAY);
623 -
624 - if($curl_response_decoded['success']){
625 - set_transient( $transient_name, $curl_response_decoded['hlsUrl'] ,300);
626 - $hls_to_return = $curl_response_decoded['hlsUrl'];
627 - if( isset($curl_response_decoded['hlsDecryptionKey']) && isset($curl_response_decoded['hlsDecryptionKeyIndex']) ){
628 - update_post_meta($product_id,'hlsDecryptionKey',$curl_response_decoded['hlsDecryptionKey']);
629 - update_post_meta($product_id,'hlsDecryptionKeyIndex',$curl_response_decoded['hlsDecryptionKeyIndex']);
630 - }else{
631 - delete_post_meta($product_id,'hlsDecryptionKey');
632 - delete_post_meta($product_id,'hlsDecryptionKeyIndex');
633 - }
634 -
635 - }else{
636 - return '';
685 +
686 +
687 + if( isset($response['response']['code']) && $response['response']['code']=='200'){
688 + $hls_to_return = trim($received_data);
689 + set_transient( $transient_name, $hls_to_return, 60 );
690 + return $hls_to_return = trim($received_data);
691 + }else{
692 + return 'failed connection';
637 693 }
638 -
694 + exit();
695 + }else{
696 + return $hls_to_return;
639 697 }
640 -
641 - return $hls_to_return;
642 -
698 +
643 699 }
644 700
645 -
646 -
647 -
701 +
702 +
648 703 /**
649 704 * VODPlayer uri details
650 705 *
651 706 * @author cretu
@@ -658,28 +713,38 @@
658 713 * 1 - free live channel
659 714 * 2 - free video encrypted
660 715 * 3 - free video -not encrypted
661 716 */
662 -
663 -
664 - $free_video_type = intval( get_post_meta($product_id, 'wpstream_product_type', true));
665 - if( ( get_post_type($product_id)=='wpstream_product_vod' && $free_video_type==2 ) || get_post_type($product_id)=='product' ){
717 + $free_video_type = intval( get_post_meta($product_id, 'wpstream_product_type', true));
718 +
719 +
720 + if($free_video_type==2 || get_post_type($product_id)=='product' ){
666 721
667 - /*
668 - * IF vide is encrypted- readed from vod,streaner
669 - *
670 - */
671 -
722 + /* IF vide is encrypted- readed from vod,streaner
723 + */
672 724
673 725 $video_type = 'application/x-mpegURL';
674 726 $video_path = get_post_meta($product_id,'_movie_url',true);
675 - if(get_post_type($product_id)=='wpstream_product_vod'){
727 + if(get_post_type($product_id)=='wpstream_product'){
676 728 $video_path = esc_html(get_post_meta($product_id, 'wpstream_free_video', true));
677 729 }
678 - $video_path_final = $this->wpstream_request_video_on_demand_hls_player($video_path,$product_id);
679 730
731 + $username = esc_html ( get_option('wpstream_api_username','') );
732 + if (filter_var($username, FILTER_VALIDATE_EMAIL)) {
733 + $username = $this->wpstream_retrive_username();
734 + }
735 +
736 + if(strpos($username,'@')!=false){
737 + $username_array= explode('@', $username);
738 + $username=$username_array[0];
739 + }
740 +
741 + $video_path_final = 'https://vod.streamer.wpstream.net/'.$username.'/'.$video_path.'/index.m3u8?'.get_site_url();
742 + if(!is_ssl()){
743 + $video_path_final = 'http://vod.streamer.wpstream.net/'.$username.'/'.$video_path.'/index.m3u8?'.get_site_url();
744 + }
680 745
681 - }else if( get_post_type($product_id)=='wpstream_product_vod' && $free_video_type==3 ){
746 + }else if($free_video_type==3){
682 747
683 748 /* Video is unecrypted - read from local or youtube / vimeo
684 749 */
685 750
@@ -722,28 +787,13 @@
722 787 $thumb_id = get_post_thumbnail_id($product_id);
723 788 $thumb = wp_get_attachment_image_src($thumb_id,'small');
724 789 $usernamestream = esc_html ( get_option('wpstream_api_username','') );
725 790
726 - $poster_thumb = '';
727 - if(isset($thumb[0])){
728 - $poster_thumb=$thumb[0];
729 - }
730 -
731 - $hlsDecryptionKey = get_post_meta($product_id,'hlsDecryptionKey',true);
732 - $hlsDecryptionKeyIndex = get_post_meta($product_id,'hlsDecryptionKeyIndex',true);
733 -
734 -
735 791 $pack = $this->main->wpstream_live_connection->wpstream_request_pack_data_per_user();
736 -
737 -
738 - if(isset($pack['available_data_mb']) && $pack['available_data_mb']>0){
739 -
740 - if($video_path_final==''){
741 - print '<div class="wpstream_vod_notice">This video does not exist or it has been deleted!</div>';
742 - }
743 -
792 +
793 + if(isset($pack['band']) && $pack['band']>0){
744 794 echo '<video id="wpstream-video'.time().'" class="video-js vjs-default-skin vjs-16-9 kuk wpstream_video_on_demand vjs-wpstream" data-me="'.esc_attr($usernamestream).'" data-product-id="'.$product_id.'" controls preload="auto"
745 - poster="'.esc_url($poster_thumb).'" '.$wpstream_data_setup.'>
795 + poster="'.$thumb[0].'" '.$wpstream_data_setup.'>
746 796
747 797 <source src="'.trim($video_path_final).'" type="'.$video_type.'">
748 798 <p class="vjs-no-js">
749 799 To view this video please enable JavaScript, and consider upgrading to a web browser that
@@ -761,137 +811,58 @@
761 811
762 812
763 813
764 814 /**
765 - *
766 - * edited 4.0
767 - *
768 815 * Retreive username for vod path
769 816 *
770 817 * @author cretu
771 818 */
772 819 private function wpstream_retrive_username(){
773 -
774 - return get_option('wpstream_api_username_from_token');
775 - }
776 -
777 - /**
778 - * check if the we can add display the player
779 - *
780 - * @since 3.12
781 - * returns html of the player
782 - */
783 -
784 - public function wpstream_check_if_player_can_dsplay($product_id){
785 - if ( is_user_logged_in() ) {
786 -
787 - $term_list = wp_get_post_terms($product_id, 'product_type');
788 - $current_user = wp_get_current_user();
789 - $subscription_model = esc_html( get_option('wpstream_global_sub','')) ;
790 -
791 -
792 - if($subscription_model==1){ // if we have Neflix mode
793 - if( $term_list[0]->name=='subscription' ){ // if the product loaded is a subscription and we are on netflix mode
794 - return false;
795 - }
796 - if($this->wpstream_in_plugin_check_global_subscription_model($product_id)){
797 - return true;
798 - }
799 - }else{
800 - // ppv mode
801 - if ( wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product_id) ||
802 - ( function_exists('wcs_user_has_subscription') && wcs_user_has_subscription( $current_user->ID, $product_id ,'active') ) ){
803 - return true;
804 - }
820 + $token = $this->main->wpstream_live_connection->wpstream_get_token();
821 +
822 + $url=WPSTREAM_CLUBLINKSSL."://www.".WPSTREAM_CLUBLINK."/wp-json/rcapi/v1/return_login/?access_token=".$token;
823 + $arguments = array(
824 + 'method' => 'GET',
825 + 'timeout' => 45,
826 + 'redirection' => 5,
827 + 'httpversion' => '1.0',
828 + 'blocking' => true,
829 + 'headers' => array(),
830 + 'cookies' => array()
831 + );
832 + $response = wp_remote_post($url,$arguments);
833 + $received_data = json_decode( wp_remote_retrieve_body($response) ,true);
834 + if( isset($response['response']['code']) && $response['response']['code']=='200'){
835 + return ($received_data); die();
836 + }else{
837 + print 'Failed to conbect media server';
838 + die();
805 839 }
806 - return false;
807 -
808 - }
809 - return false;
810 -
811 840 }
812 841
813 842
814 843
815 - /**
816 - * in plugin - check if global subscription model is enabled
817 - *
818 - * @since 3.12
819 - *
820 - */
821 - public function wpstream_in_plugin_check_global_subscription_model($product_id) {
822 844
823 - // $selected_sub= get_post_meta($post->ID,'_wpstream_parent_sub',true);
824 - if( is_user_logged_in() && function_exists('wcs_user_has_subscription') ){
825 -
826 - global $woocommerce;
827 - $current_user = wp_get_current_user();
828 845
829 - $subscription_model = esc_html( get_option('wpstream_global_sub','')) ;
830 - $main_subscription = intval( get_option('wpstream_global_sub_id',''));
831 -
832 - if($subscription_model==1){
833 - $selected_sub= get_post_meta($product_id,'_wpstream_parent_sub',true) ;
834 -
835 - if( is_array($selected_sub) ){
836 -
837 - // we have per product sub
838 - foreach($selected_sub as $key=>$subscrition_id ):
839 - if( wcs_user_has_subscription( $current_user->ID, $subscrition_id ,'active') ) {
840 - return true;
841 - }
842 - endforeach;
843 -
844 - } else if($main_subscription!=0){
845 -
846 - // if we have one main subscription
847 - if( wcs_user_has_subscription( $current_user->ID, $main_subscription ,'active') ) {
848 - return true;
849 - }
850 - }
851 -
852 -
853 - }
854 - return false;
855 -
856 - }
857 - // there is no woo subscription or user not logged in
858 - return false;
859 - }
860 -
861 -
862 -
863 -
864 -
865 -
866 -
867 -
868 -
869 846 /**
870 - *
871 - *
872 - *
873 - *
874 847 * check if the user bought the product and display the player - TO REDo
875 848 *
876 849 * @since 3.0.1
877 850 * returns html of the player
878 - *
879 - *
880 - *
881 - *
882 - *
883 851 */
884 - public function wpstream_user_logged_in_product_already_bought($from_sh_id='') {
885 - global $product;
886 - $product_id = $product->get_id();
887 - $current_user = wp_get_current_user();
852 + public function wpstream_user_logged_in_product_already_bought($from_sh_id='') {
853 +
888 854 if ( is_user_logged_in() ) {
889 -
890 - if($this->wpstream_check_if_player_can_dsplay($product_id) ){
891 -
892 - echo '<div class="wpstream_player_wrapper "><div class="wpstream_player_container">';
855 + global $product;
856 + $current_user = wp_get_current_user();
857 + $product_id = $product->get_id();
893 858
859 +
860 + if ( wc_customer_bought_product( $current_user->user_email, $current_user->ID, $product_id) || ( function_exists('wcs_user_has_subscription') && wcs_user_has_subscription( $current_user->ID, $product_id ,'active') ) ){
861 +
862 +
863 + echo '<div class="wpstream_player_wrapper"><div class="wpstream_player_container">';
864 +
894 865 $is_subscription_live_event = esc_html(get_post_meta($product_id,'_subscript_live_event',true));
895 866 $term_list = wp_get_post_terms($product_id, 'product_type');
896 867
897 868
@@ -901,36 +872,20 @@
901 872 $this->wpstream_video_on_demand_player($product_id);
902 873 }
903 874 echo '</div></div>';
904 875 }else{
905 -
906 -
907 - $term_list = wp_get_post_terms($product_id, 'product_type');
908 - if( $term_list[0]->name=='subscription' ){
909 - if( !wcs_user_has_subscription( $current_user->ID, $product_id ,'active') ) {
910 - $this->wpstream_display_no_buy_message('nobuy',$product_id);
911 - }
912 -
876 + if( get_post_type($product_id) == 'wpstream_product' ){
877 + echo '<div class="wpstream_player_wrapper no_buy"><div class="wpstream_player_container">';
878 + echo '<div class="wpstream_notice">'.__('You did not buy this product!','wpstream').'</div>';
879 + echo '</div></div>';
913 880 }
914 -
915 -
916 -
917 881 }
918 882
919 883
920 - }else{
921 -
922 - $this->wpstream_display_no_buy_message('nolog',$product_id);
923 884 }
924 885 }
925 886
926 -
927 -
928 -
929 -
930 - /**
931 - *
932 - *
887 + /**
933 888 * check if the user bought the product and display the player - TO REDo
934 889 *
935 890 * @since 3.0.1
936 891 * returns html of the player
@@ -941,23 +896,9 @@
941 896 }
942 897
943 898
944 899
945 -
946 -
947 -
948 -
949 -
950 - /**
951 - * coonect to chat
952 - *
953 - * @since 1.12.2
954 - *
955 - */
956 -
957 -
958 -
959 - public function wpstream_connect_to_chat($product_id){
900 + public function wpstream_connect_to_chat($product_id){
960 901 $current_user = wp_get_current_user();
961 902 $userID = $current_user->ID;
962 903 $user_login = $current_user->user_login;
963 904
@@ -962,9 +903,9 @@
962 903 $user_login = $current_user->user_login;
963 904
964 905 $key='';
965 906
966 - $chat_url = get_post_meta($product_id,'chat_url',true);
907 + $chatUrl = get_post_meta($product_id,'chatUrl',true);
967 908
968 909
969 910 wp_enqueue_script( 'sockjs-0.3.min' );
970 911 wp_enqueue_script( 'emojione.min.js' );
@@ -984,9 +925,9 @@
984 925
985 926
986 927 if(!is_user_logged_in()){
987 928 $user_login='';
988 - $chat_url='';
929 + $chatUrl='';
989 930 }
990 931
991 932
992 933 print '<script type="text/javascript">
@@ -999,58 +940,5 @@
999 940 //]]>
1000 941 </script>';
1001 942
1002 943 }
1003 -
1004 -
1005 - /**
1006 - * display no buy Message
1007 - *
1008 - * @since 3.12.2
1009 - *
1010 - */
1011 - public function wpstream_display_no_buy_message($log,$product_id) {
1012 -
1013 - if($log=='sub_active'){
1014 - $message= esc_html( get_option('wpstream_subscription_active','Your Subscription is Active.')) ;
1015 - echo '<div class="wpstream_player_wrapper no_buy"><div class="wpstream_player_container">';
1016 - echo '<div class="wpstream_notice"> '.$message.'</div>';
1017 - echo '</div></div>';
1018 - return;
1019 -
1020 - }else if($log=='nolog'){
1021 - $message= esc_html( get_option('wpstream_product_not_login','You must be logged in to watch this video.')) ;
1022 - }else{
1023 - $message =esc_html( get_option('wpstream_product_not_bought','You did not yet purchase this item.')) ;
1024 - }
1025 - $subscription_model = esc_html( get_option('wpstream_global_sub','')) ;
1026 - if($subscription_model==1){
1027 - $message =esc_html( get_option('wpstream_product_not_subscribe','You did not yet subscribe to this item.'));
1028 - }
1029 -
1030 -
1031 - if( get_post_type($product_id) == 'product' && $subscription_model==0 ){
1032 -
1033 - $term_list = wp_get_post_terms($product_id, 'product_type');
1034 - if( $term_list[0]->name=='video_on_demand' || $term_list[0]->name=='live_stream'){
1035 -
1036 - echo '<div class="wpstream_player_wrapper no_buy"><div class="wpstream_player_container">';
1037 - echo '<div class="wpstream_notice">'.$message.'</div>';
1038 - echo '</div></div>';
1039 -
1040 - }
1041 -
1042 - }else if( get_post_type($product_id) == 'product' && $subscription_model==1 ){
1043 - echo '<div class="wpstream_player_wrapper no_buy"><div class="wpstream_player_container">';
1044 - echo '<div class="wpstream_notice"> '.$message.'</div>';
1045 - echo '</div></div>';
1046 - }
1047 -
1048 -
1049 -
1050 -
1051 -
1052 -
1053 - }
1054 -
1055 -
1056 944 }