| @@ -342,19 +342,8 @@ | ||
| 342 | 342 | $to_save_option=array(); |
| 343 | 343 | foreach($option_array as $key=>$value){ |
| 344 | 344 | $to_save_option[sanitize_key($key)]=sanitize_text_field($value); |
| 345 | 345 | } |
| 346 | - | |
| 347 | - if( $to_save_option['low_latency'] == 1 || $to_save_option['adaptive_bitrate'] ==1 ){ | |
| 348 | - $to_save_option['encrypt']=0; | |
| 349 | - } | |
| 350 | - | |
| 351 | - if( $to_save_option['encrypt']==1){ | |
| 352 | - $to_save_option['low_latency'] = 0; | |
| 353 | - $to_save_option['adaptive_bitrate'] =0; | |
| 354 | - } | |
| 355 | - | |
| 356 | - | |
| 357 | 346 | |
| 358 | 347 | update_post_meta ($show_id,'local_event_options',$to_save_option); |
| 359 | 348 | $this->wpstream_update_chanel_on_baker($show_id,$to_save_option); |
| 360 | 349 | |
| @@ -565,29 +554,8 @@ | ||
| 565 | 554 | if( intval( $local_event_options['encrypt']) ==1 ){ |
| 566 | 555 | $is_encrypt="true"; |
| 567 | 556 | } |
| 568 | 557 | |
| 569 | - $low_latency="false"; | |
| 570 | - if( intval( $local_event_options['low_latency']) ==1 ){ | |
| 571 | - $low_latency="true"; | |
| 572 | - } | |
| 573 | - | |
| 574 | - $adaptive_bitrate="false"; | |
| 575 | - if( intval( $local_event_options['adaptive_bitrate']) ==1 ){ | |
| 576 | - $adaptive_bitrate="true"; | |
| 577 | - } | |
| 578 | - | |
| 579 | - if($adaptive_bitrate=="true" || $low_latency=="true" ){ | |
| 580 | - $is_encrypt="false"; | |
| 581 | - } | |
| 582 | - | |
| 583 | - if( $is_encrypt=="true"){ | |
| 584 | - $adaptive_bitrate="false"; | |
| 585 | - $low_latency="false"; | |
| 586 | - } | |
| 587 | - | |
| 588 | - | |
| 589 | - | |
| 590 | 558 | // set record option |
| 591 | 559 | $is_record="false"; |
| 592 | 560 | if( intval( $local_event_options['record']) ==1 ){ |
| 593 | 561 | $is_record="true"; |
| @@ -598,9 +566,9 @@ | ||
| 598 | 566 | $corsorigin='*'; |
| 599 | 567 | } |
| 600 | 568 | |
| 601 | 569 | |
| 602 | - $event_data = $this->wpstream_request_live_stream_uri($channel_id,$is_autostart,$is_record,$is_encrypt,$low_latency,$adaptive_bitrate,$userID,$corsorigin,$on_boarding); | |
| 570 | + $event_data = $this->wpstream_request_live_stream_uri($channel_id,$is_autostart,$is_record,$is_encrypt,$userID,$corsorigin,$on_boarding); | |
| 603 | 571 | |
| 604 | 572 | |
| 605 | 573 | |
| 606 | 574 | if( isset($event_data['success']) && $event_data['success']===true ){ |
| @@ -645,9 +613,9 @@ | ||
| 645 | 613 | * returns live url |
| 646 | 614 | */ |
| 647 | 615 | |
| 648 | 616 | |
| 649 | - public function wpstream_request_live_stream_uri($schannel_id,$is_autostart,$is_record,$is_encrypt,$low_latency,$adaptive_bitrate,$request_by_userid,$corsorigin,$on_boarding){ | |
| 617 | + public function wpstream_request_live_stream_uri($schannel_id,$is_autostart,$is_record,$is_encrypt,$request_by_userid,$corsorigin,$on_boarding){ | |
| 650 | 618 | |
| 651 | 619 | $domain = parse_url ( get_site_url() ); |
| 652 | 620 | $domain_scheme = 'http'; |
| 653 | 621 | if(is_ssl()){ |
| @@ -662,19 +630,9 @@ | ||
| 662 | 630 | if($corsorigin!='*'){ |
| 663 | 631 | $corsorigin=$domain_scheme.'://'.$domain['host']; |
| 664 | 632 | } |
| 665 | 633 | |
| 666 | - $abr='none'; | |
| 667 | - if($adaptive_bitrate=="true"){ | |
| 668 | - $abr='common'; | |
| 669 | - } | |
| 670 | 634 | |
| 671 | - if($low_latency=="true"){ | |
| 672 | - $low_latency=true; | |
| 673 | - }else{ | |
| 674 | - $low_latency = false; | |
| 675 | - } | |
| 676 | - | |
| 677 | 635 | |
| 678 | 636 | $url = 'channel/start'; |
| 679 | 637 | $access_token = $this->wpstream_get_token(); |
| 680 | 638 | |
| @@ -693,10 +651,10 @@ | ||
| 693 | 651 | 'domain' => $domain['host'], |
| 694 | 652 | 'allow_access_from' => $corsorigin, |
| 695 | 653 | 'record' => $is_record, |
| 696 | 654 | 'encrypt' => $is_encrypt, |
| 697 | - 'low_latency' => $low_latency, | |
| 698 | - 'abr' => $abr, | |
| 655 | + 'low_latency' => false, | |
| 656 | + 'abr' => 'none', | |
| 699 | 657 | 'hls_keys_url_prefix' => get_site_url().'?wpstream_livedrm=', |
| 700 | 658 | 'allow_key_access_from' => $domain_ip, |
| 701 | 659 | 'metadata' => json_encode($metadata_array), |
| 702 | 660 | 'autostart' => $is_autostart, |
| @@ -706,9 +664,9 @@ | ||
| 706 | 664 | |
| 707 | 665 | |
| 708 | 666 | $curl_response = $this->wpstream_baker_do_curl_base($url,$curl_post_fields); |
| 709 | 667 | $curl_response_decoded = json_decode($curl_response,JSON_OBJECT_AS_ARRAY); |
| 710 | - // $curl_response_decoded['curl_post_fields']=$curl_post_fields; | |
| 668 | + | |
| 711 | 669 | return $curl_response_decoded; |
| 712 | 670 | |
| 713 | 671 | |
| 714 | 672 | |
| @@ -971,10 +929,13 @@ | ||
| 971 | 929 | */ |
| 972 | 930 | public function wpstream_request_live_stream_for_user($user_id){ |
| 973 | 931 | |
| 974 | 932 | global $wpstream_plugin; |
| 975 | - | |
| 933 | + if( !$wpstream_plugin->main->wpstream_check_user_can_stream() ){ | |
| 934 | + exit('You are not allowed to stream. Code 741.'); | |
| 935 | + } | |
| 976 | 936 | |
| 937 | + | |
| 977 | 938 | $domain = parse_url ( get_site_url() ); |
| 978 | 939 | |
| 979 | 940 | |
| 980 | 941 | $url = 'channel/list'; |
| @@ -1010,9 +971,9 @@ | ||
| 1010 | 971 | global $wpstream_plugin; |
| 1011 | 972 | $return_array=array(); |
| 1012 | 973 | |
| 1013 | 974 | $result = get_transient('wpstream_live_stream_for_user_for_shortcode'); |
| 1014 | - | |
| 975 | + $result==false; | |
| 1015 | 976 | if($result===false){ |
| 1016 | 977 | $result = $this->wpstream_request_live_stream_for_user(''); |
| 1017 | 978 | set_transient('wpstream_live_stream_for_user_for_shortcode',$result,30); |
| 1018 | 979 | } |