PageSourceSearch

https://indiainclusionsummit.com/wp-content/plugins/wpstream/public/js/start_streaming.js?ver=4.7

js indiainclusionsummit.com collected 2026-09-25 18:42:25 UTC 28,938 bytes, 930 lines download raw bytes

1/*global $, jQuery, wpstream_start_streaming_vars*/
2var counters={};
3
4jQuery(document).ready(function ($) {
5    "use strict";
6    
7    wpstream_check_live_connections();
8    wpestate_start_modal_actions();
9    wpestate_start_modal_error_actions();
10    wpstream_tooltip();
11    wpstream_copy_to_clipboard();
12    // Commenting the following line because we are using the new webcaster
13    wpstream_webcaster_actions();
14    wpstream_save_options_actions();
15    wpstream_bind_start_and_stop();
16
17    wpstream_bind_stats_link();
18    wpstream_adjust_settings_general();
19  
20        
21});
22
23
24
25
26/*
27*
28* genereal settings - low latency vs bitrate vs encrypt
29*
30*/
31
32
33function wpstream_adjust_settings_general(){
34   
35    jQuery('.theme_options_tab_wpstream .wpstream_slider').on('click',function(event){
36        event.stopPropagation();
37        var parent = jQuery(this).parent();
38        var input_element = parent.find('.wpstream_event_option_item');
39        var attr_value = input_element.attr('data-attr-ajaxname');
40      
41
42        if( attr_value === 'adaptive_bitrate' || attr_value==='low_latency'){
43            
44            var timer = setTimeout(function() {
45               
46                if( jQuery('.wpstream-setting-adaptive_bitrate .wpstream_event_option_item').is(':checked') || 
47                    jQuery('.wpstream-setting-low_latency .wpstream_event_option_item').is(':checked') ){
48                    jQuery('.wpstream-setting-encrypt .wpstream_event_option_item') .removeAttr('checked'); 
49                }   
50            }, 300);
51
52        }
53
54        if( attr_value === 'encrypt'){
55            var timer = setTimeout(function() {
56               
57                if( jQuery('.wpstream-setting-encrypt .wpstream_event_option_item').is(':checked') ){
58                    jQuery('.wpstream-setting-low_latency .wpstream_event_option_item') .removeAttr('checked'); 
59                    jQuery('.wpstream-setting-adaptive_bitrate .wpstream_event_option_item') .removeAttr('checked'); 
60                }
61            }, 300);
62
63        }
64
65    });
66}
67
68
69
70
71
72
73
74
75
76
77/*
78*
79* Bind block stats link
80*
81*/
82
83function wpstream_bind_stats_link(){
84 
85    jQuery('.wpstream_statistics_channel,.start_webcaster').each(function(event){
86        var selected_icon = jQuery(this);
87            selected_icon.on('click',function(event){
88                if(selected_icon.hasClass('wpstream_inactive_icon')){
89                    event.preventDefault();
90                    event.stopPropagation();
91                }
92                
93            });
94        
95    })
96
97
98}
99
100
101
102
103/*
104*
105* Bind Start and Stop channel
106*
107*/
108    
109
110function wpstream_bind_start_and_stop(){
111    
112    jQuery('.start_event.wpstream_button').each(function(element){
113        var start_button=jQuery(this);    
114        wpstream_bind_start_event(start_button);
115    });
116
117
118    jQuery('.wpstream_stop_event').each(function(element){
119        var stop_button=jQuery(this);
120        wpstream_bind_stop_event(stop_button);
121    });
122
123}
124
125
126/*
127*
128* Bind start  channel action
129*
130*/
131var start_onboarding='';
132function wpstream_bind_start_event(button){
133   
134    button.click(function(event){
135        var basicStreaming = jQuery('#wpstream_basic_streaming').val() === 'true';
136        if (basicStreaming){
137            console.log("doing basic streaming");
138            if(!confirm(wpstream_start_streaming_vars.basic_streaming_warning)){
139                return false;
140            }
141        }
142        
143        event.preventDefault();
144        button.unbind('click');
145        var ajaxurl             =   wpstream_start_streaming_vars.admin_url + 'admin-ajax.php';
146        var acesta              =   jQuery(this);
147        var notification_area   =   jQuery(this).parent().find('.event_list_unit_notification');
148        var curent_content      =   jQuery(this).parent().find('.server_notification');
149        var is_record           =   false;
150        var is_encrypt          =   false;
151        var show_id             =   parseFloat( jQuery(this).attr('data-show-id') );
152        var nonce               =   jQuery('#wpstream_start_event_nonce').val();
153        var parent              =   jQuery(this).parent();
154        
155        if( jQuery(this).parent().find('.record_event').is(":checked") ){
156            is_record   =   true;
157        }
158        
159        if( jQuery(this).parent().find('.encrypt_event').is(":checked") ){
160            is_encrypt   =   true;
161        }
162        parent.find('.wpstream_show_settings').addClass('wpstream_inactive_icon');
163        jQuery(this).addClass('wpstream_turning_on').empty().html(wpstream_start_streaming_vars.start_streaming_action+'<div class="wpstream_loader"></div><div class="wpstream_tooltip">'+wpstream_start_streaming_vars.turning_on_tooltip+'</div>');
164        parent.find('.wpstream_channel_status').text(wpstream_start_streaming_vars.channel_turning_on);
165
166        jQuery.ajax({
167            type: 'POST',
168            url: ajaxurl,
169            dataType: 'json',
170            timeout: 300000,
171
172            data: {
173                'action'            :   'wpstream_give_me_live_uri',
174                'security'          :   nonce,
175                'show_id'           :   show_id,
176                'is_record'         :   is_record,
177                'is_encrypt'        :   is_encrypt,
178                'basic_streaming'   :   basicStreaming,
179                'start_onboarding'  :   start_onboarding,
180               
181                
182            },
183            success: function (data) {
184                
185              
186       
187                if(data.conected===true){
188             
189                        if(data.event_data==='err1'){
190                        
191                            wpstream_show_error_on_start(wpstream_start_streaming_vars.error1,parent)
192                        
193                        }else if(data.event_data ==='failed event creation'){
194                        
195                            wpstream_show_error_on_start(wpstream_start_streaming_vars.failed_event_creation,parent)
196                        
197                        }else{
198                            curent_content.empty();
199                            var counter =  setInterval( function (){ 
200                            wpstream_check_live_connections_on_start(parent,show_id,data.event_data,data)},10000);
201                            counters['stop'+show_id]=counter;
202                    
203                        }
204                        
205            
206                }else{
207                    wpstream_show_error_on_start(data.error,parent)
208                }
209                
210            },
211            error: function (jqXHR,textStatus,errorThrown) {             
212            }
213        });
214        
215    });
216    
217}
218
219
220/*
221*
222* Bind Stop channel action
223*
224*/
225
226function wpstream_bind_stop_event(button){
227    button.click(function(event){
228
229
230        if(!confirm(wpstream_start_streaming_vars.turn_off_confirm)){
231            return false;
232        }
233        button.unbind('click');
234        
235
236        var ajaxurl             =   wpstream_start_streaming_vars.admin_url + 'admin-ajax.php';
237        var show_id             =   parseFloat( jQuery(this).attr('data-show-id') );
238        var nonce               =   jQuery('#wpstream_start_event_nonce').val();
239        var parent              =   jQuery(this).parent();
240        var thisButton          =   jQuery(this);
241      
242        thisButton.removeClass('wpstream_stop_event');
243        thisButton.addClass('wpstream_turning_on').empty().html(wpstream_start_streaming_vars.stop_streaming_action+'<div class="wpstream_loader"></div><div class="wpstream_tooltip">'+wpstream_start_streaming_vars.turning_off_tooltip+'</div>');
244        parent.find('.wpstream_channel_status').text(wpstream_start_streaming_vars.channel_turning_off);
245        parent.find('.start_webcaster').addClass('wpstream_inactive_icon');
246        parent.find('.wpstream_stream_pro').addClass('wpstream_inactive_icon');
247        parent.find('.wpstream_live_data').addClass('wpstream_inactive_icon');
248
249
250
251        jQuery.ajax({
252            type: 'POST',
253            url: ajaxurl,
254            dataType: 'json',
255            timeout: 300000,
256
257            data: {
258                'action'            :   'wpstream_turn_of_channel',
259                'security'          :   nonce,
260                'show_id'           :   show_id
261               
262                
263            },
264            success: function (data) {
265
266                console.log(data);
267                if(data.conected===true){
268                    
269                    thisButton.unbind('click');
270         
271                    var counter =  setInterval( function (){ 
272                        wpstream_check_live_connections_on_start(parent,show_id,'',data)},10000);
273                        counters["stop"+show_id]=counter;
274
275                }else{
276               
277                    wpstream_show_error_on_stop(data.error,parent)
278                }
279                
280            },
281            error: function (jqXHR,textStatus,errorThrown) {
282             
283            }
284        });
285        
286    
287    
288    });
289    
290}
291
292
293/*
294*
295* Enable copy to clipboard
296*
297*/
298
299function wpstream_enable_cliboard(parent){
300    
301    jQuery(parent).find('.copy_live_uri').click(function(){
302      
303        var value_uri = jQuery(parent).find('.wpstream_live_uri_text').text();
304        var temp = jQuery("<input>");
305        jQuery("body").append(temp);
306        jQuery(temp).val(value_uri).select();
307        document.execCommand("copy");
308        jQuery(temp).remove();
309        
310    });
311    
312    jQuery(parent).find('.copy_live_key').click(function(){
313        var value_uri = jQuery(parent).find('.wpstream_live_key_text').text();
314        var temp = jQuery("<input>");
315        jQuery("body").append(temp);
316        jQuery(temp).val(value_uri).select();
317        document.execCommand("copy");
318        jQuery(temp).remove();
319        
320    });
321}
322
323
324/*
325 *
326 * Check live events/channels on starts 
327 * 
328 * 
329 * 
330*/
331
332
333function wpstream_check_live_connections_on_start( parent,show_id,server_id,data){
334      
335    // server_url is dns change
336  
337    wpstream_check_event_status_in_js(show_id,'wpstream_check_live_connections_on_start',
338        function(server_status){
339      
340            if(server_status.status==='active' ){
341                parent.find('.start_webcaster').attr('data-webcaster-url',server_status.webcaster_url);
342                parent.find('.wpstream_live_uri_text').text(server_status.obs_uri);
343                parent.find('.wpstream_live_key_text').text(server_status.obs_stream);
344
345                wpstream_event_ready_make_actions_visible(parent);
346
347                var larix_rtmp= server_status.obs_uri+server_status.obs_stream;
348                parent.find('.wpstream_larix_rtmp').text(larix_rtmp); 
349
350                var   larix_qr ='larix://set/v1?conn[][url]='+encodeURIComponent(larix_rtmp);
351                parent.find('.wpstream_start_with_larix_mobile').attr('href',larix_qr); 
352
353                parent.find('.wpstream_larix_rtmp').text(larix_rtmp); 
354                parent.find('.larrix_test').text(larix_rtmp); 
355              
356
357                var print_qrcode= "https://qrcode.tec-it.com/API/QRCode?size=small&dpi=110&data="+encodeURIComponent(larix_qr);
358
359
360                parent.find('.print_qrcode').attr('src',print_qrcode); 
361                
362                parent.parent().find('.wpstream_live_data').attr('href',server_status.live_data_url);         
363                clearInterval( counters["stop"+show_id]);
364
365
366                if (typeof wpstream_integration_notifications === 'function') {
367                    wpstream_integration_notifications(show_id);
368                }
369
370                
371            }else if(server_status.status==='stopped' ){    
372             
373                clearInterval( counters["stop"+show_id]);
374                wpstream_event_stopped_make_actions(parent);
375
376            }else if(server_status.status==='error' ){
377               
378                clearInterval( counters["stop"+show_id]);
379                var curent_content = parent.find('.wpstream_channel_status');
380                curent_content.html('<div class="wpstream_channel_status not_ready_to_stream"><span class="dashicons dashicons-dismiss"></span>'+wpstream_start_streaming_vars.failed_event_creation+'</div>');
381            }
382    });
383
384}
385
386
387
388
389/*
390 * check channell id status
391 * 
392 * @param {type} channel_id
393 * @param {type} callback
394 * @returns {undefined}
395 * 
396 * 
397*/
398
399function wpstream_check_event_status_in_js(channel_id,notes,successCallback, errorCallback){
400
401    var ajaxurl             =   wpstream_start_streaming_vars.admin_url + 'admin-ajax.php';
402    jQuery.ajax({
403        type: 'POST',
404        dataType: 'json',
405        url: ajaxurl,
406        timeout: 3000000,
407
408        data: {
409            'action'            :   'wpstream_check_event_status',
410            'channel_id'        :   channel_id,
411            'notes'             :   notes,
412         
413        },
414        success: function (data) {
415
416            var obj = data;
417            var channel_status = obj.status;
418
419            if(channel_status=='active' || channel_status=='stopped'  ){
420                successCallback(obj);
421            }else if(channel_status=='error'){
422                successCallback(obj);
423            }else{
424                successCallback(false);
425            }
426            
427        }, error: function (jqXHR,textStatus,errorThrown) {
428            errorCallback();
429        }
430  });
431}
432
433
434/*
435*
436* Make actions visible on event if ready
437*
438*
439*/
440function wpstream_event_ready_make_actions_visible(parent){
441
442    var actionButton = parent.find('.start_event');
443    parent.addClass('wpstream_show_started');
444    actionButton.unbind('click');
445    wpstream_bind_stop_event(actionButton);
446    
447    actionButton.addClass('wpstream_stop_event').removeClass('start_event').html(wpstream_start_streaming_vars.stop_streaming+'<div class="wpstream_tooltip">'+wpstream_start_streaming_vars.turned_off_tooltip+'</div>');
448    parent.find('.wpstream-button-icon').removeClass('wpstream_inactive_icon');
449    parent.find('.wpstream_show_settings').addClass('wpstream_inactive_icon');
450    const channelStatus = parent.find('.wpstream_channel_status');
451    if ( channelStatus.css('display', 'none') ) {
452        channelStatus.text(wpstream_start_streaming_vars.channel_on);
453        channelStatus.fadeIn(200);
454    }
455
456    var webcasterUrl = parent.find('.start_webcaster').attr('data-webcaster-url');
457    if (webcasterUrl === ""){
458        parent.find('.start_webcaster').addClass('wpstream_inactive_icon');
459        parent.find('.wpstream_tooltip_disabled').text('Browser Broadcasting is not Available for your plan.');
460    }
461
462    //for onboarding
463    var check_against='3';
464    var check_against_camera_icon='5';
465    if(jQuery('#woocommerce-product-data').length>0){
466        check_against='5'
467        check_against_camera_icon='7';
468    }       
469   
470    
471    var bubble_Step =jQuery('#wpstream_onboard_bubble').attr('data-bubble-step');
472
473    if(bubble_Step===check_against){
474        jQuery('#wpstream_onboard_bubble_tile').text('Channel is now ON');
475        jQuery('#wpstream_onboard_bubble_content').text('You are ready to GO LIVE. Click Next to see how.');
476    }
477    if(bubble_Step===check_against_camera_icon){
478        jQuery('#wpstream_onboard_bubble_tile').html('Go LIVE');
479        jQuery('#wpstream_onboard_bubble_content').html('To Go Live now, click the <div class=\"wpstream_sample_icon_settings wpstream_sample_icon_camera\"></div> icon. The broadcast app will open in a new window.');
480        
481        if( jQuery('.event_list_unit .wpstream_button').hasClass('wpstream_stop_event') ){
482            jQuery('.wpstream_sample_icon_camera').css('cursor','pointer');
483          
484            jQuery('.wpstream_sample_icon_camera').on('click',function(){
485                jQuery('.start_webcaster').trigger('click');
486                jQuery(this).unbind('click');
487
488            })   
489        }
490
491    }
492}
493
494function wpstream_event_error_make_actions_visible(parent){
495    var actionButton = parent.find('.start_event');
496    const channelStatus = parent.find('.wpstream_channel_status');
497    actionButton.unbind('click');
498    actionButton.hide();
499    channelStatus.hide();
500
501    parent.find('.server_notification').html('<div class="wpstream_channel_status not_ready_to_stream"><span class="dashicons dashicons-dismiss"></span>'+wpstream_start_streaming_vars.failed_fetching+'</div>');
502}
503
504
505/*
506*
507* Make actions visible on event if stopped
508*
509*
510*/
511function wpstream_event_stopped_make_actions(parent){
512 
513    var  actionButton = parent.find('.wpstream_turning_on');
514    wpstream_bind_start_event(actionButton);
515    parent.removeClass('wpstream_show_started');
516    actionButton.removeClass('wpstream_turning_on');
517    actionButton.addClass('start_event');
518    actionButton.html( wpstream_start_streaming_vars.start_streaming+'<div class="wpstream_tooltip">'+wpstream_start_streaming_vars.turned_on_tooltip+'</div>');
519
520    parent.find('.wpstream-button-icon').removeClass('wpstream_inactive_icon');
521    parent.find('.wpstream_stream_pro').addClass('wpstream_inactive_icon');
522    parent.find('.start_webcaster').addClass('wpstream_inactive_icon');
523    parent.find('.wpstream_statistics_channel').addClass('wpstream_inactive_icon');
524
525    parent.find('.wpstream_channel_status').text(wpstream_start_streaming_vars.channel_off);
526}
527
528
529
530function wpstream_show_error_on_start(text,parent){
531    //You don't have enough data to start a new event!
532    jQuery('.wpstream_error_content').text(text);
533    jQuery('.wpstream_modal_background').show();
534    jQuery('.wpstream_error_modal_notification').show();
535    wpstream_event_stopped_make_actions(parent);
536
537}
538
539function wpstream_show_error_on_stop(text,parent){
540    //You don't have enough data to start a new event!
541    jQuery('.wpstream_error_content').text(text);
542    jQuery('.wpstream_modal_background').show();
543    jQuery('.wpstream_error_modal_notification').show();
544    wpstream_event_ready_make_actions_visible(parent);
545
546}
547
548
549/*
550*
551* Streaming modal trigger functions
552*  
553*
554*/
555function wpestate_start_modal_actions(){
556
557    jQuery('.wpstream_close_modal').on('click',function(event){
558        jQuery(this).parent().hide();
559        jQuery('.wpstream_modal_background').hide();
560    });
561
562    document.addEventListener('keydown', function(event) {
563        if(event.keyCode == 27){
564            jQuery('.wpstream_modal_form').hide();
565            jQuery('.wpstream_modal_background').hide();
566        }
567    });
568
569
570    jQuery('.wpstream-trigger-modal').on('click',function(event){
571
572        if( jQuery(this).hasClass('wpstream_inactive_icon') ) {
573            return;
574        };
575
576        jQuery('.wpstream_modal_background').show();
577        var modal_class=jQuery(this).attr('data-modal');
578        var parent =jQuery(this).closest('.event_list_unit');
579        jQuery('.wpstream_modal_background').show();
580        parent.find("."+modal_class).show();
581    })
582
583    jQuery('.wpstream_external_broadcast_options').change(function(event){
584        var new_option = jQuery(this).val();
585        var parent = jQuery(this).parent();
586
587        parent.find('.external_software_streaming').hide();
588        parent.find('.'+new_option).show();
589    });
590
591
592}
593
594
595
596/*
597*
598* Tooltips for buttons
599*  
600*
601*/ 
602
603function wpstream_tooltip(){
604
605    jQuery( ".wpstream_tooltip_wrapper" ).hover(
606    function() {
607
608        if(jQuery( this ).hasClass('wpstream_inactive_icon')){
609            jQuery( this ).find('.wpstream_tooltip_disabled').css('opacity',1);
610        }else{
611            jQuery( this ).find('.wpstream_tooltip').css('opacity',1);
612        }
613
614
615    }, function() {
616        jQuery( this ).find('.wpstream_tooltip').css('opacity',0);
617        jQuery( this ).find('.wpstream_tooltip_disabled').css('opacity',0);
618    }
619);
620}
621
622/*
623*
624* Modal errors
625*  
626*
627*/ 
628
629
630function wpestate_start_modal_error_actions(){
631    jQuery('.wpstream_error_ok').on('click',function(event){
632        jQuery(this).parent().hide();
633        jQuery('.wpstream_modal_background').hide();
634        jQuery(this).parent().find('.wpstream_error_content').text('');
635    });
636}
637
638
639
640
641/*
642*
643* Copy to Clipboard
644*  
645*
646*/ 
647
648function wpstream_copy_to_clipboard(){
649       
650    jQuery('.copy_live_uri').on('click',function(){
651        var value_uri = jQuery(this).parent().find('.wpstream_live_uri_text').text();
652        var temp = jQuery("<input>");
653        jQuery("body").append(temp);
654        jQuery(temp).val(value_uri).select();
655        document.execCommand("copy");
656        jQuery(temp).remove();
657        
658    });
659    
660    jQuery('.copy_live_key').on('click',function(){
661        var value_uri = jQuery(this).parent().find('.wpstream_live_key_text').text();
662        var temp = jQuery("<input>");
663        jQuery("body").append(temp);
664        jQuery(temp).val(value_uri).select();
665        document.execCommand("copy");
666        jQuery(temp).remove();
667    });
668}
669
670/*
671*
672* Webcaster button action
673*  
674*
675*/ 
676
677function wpstream_webcaster_actions(){
678    jQuery('.start_webcaster').on('click',function(event){
679        if(jQuery(this).hasClass('wpstream_inactive_icon')){
680            return;
681        }
682        var $this = jQuery(this);
683        var ajaxurl = wpstream_start_streaming_vars.admin_url + 'admin-ajax.php';
684        var channelId      = jQuery(this).closest('.event_list_unit').data('show-id');
685        var whipUrl = '';
686
687        jQuery.ajax({
688            type: 'POST',
689            dataType: 'json',
690            url: ajaxurl,
691            timeout: 3000000,
692            data: {
693                'action': 'wpstream_check_whipurl',
694                'channel_id': channelId,
695            },
696            success: function (data) {
697                if( data.success == true ){
698                    whipUrl = data.whip_url;
699
700	                if ( whipUrl !== '' ) {
701		                // Open the new broadcaster in a new window
702		                var broadcasterUrl = wpstream_settings_vars.broadcaster_url + channelId;
703		                window.open(broadcasterUrl, 'wpstream_broadcaster_' + channelId, 'fullscreen=ye
703s');
704	                }
705                } else {
706	                var caster_url = $this.attr('data-webcaster-url');
707	                $this.parent().find('.external_software_streaming').slideUp()
708	                window.open(caster_url, '_blank', 'location=yes,scrollbars=yes,status=yes');
709                }
710            },
711            error: function() {
712				console.log('and here')
713                // fallback to the old broadcaster if the AJAX request fails
714                var caster_url = $this.attr('data-webcaster-url');
715                $this.parent().find('.external_software_streaming').slideUp()
716                window.open(caster_url, '_blank', 'location=yes,scrollbars=yes,status=yes');
717            }
718        });
719    })
720}
721
722
723
724/*
725*
726*  per event - low latency vs bitrate vs encrypt
727*
728*/
729
730
731function wpstream_adjust_settings(input_element){
732
733   
734   
735    var attr_value = input_element.attr('data-attr-ajaxname');
736    console.log(attr_value);
737
738 
739
740    if( attr_value === 'adaptive_bitrate' || attr_value==='low_latency'){
741        console.log('perform ');
742
743        var timer = setTimeout(function() {
744           
745            if( jQuery('.wpstream-setting-adaptive_bitrate .wpstream_event_option_item').is(':checked') || 
746                jQuery('.wpstream-setting-low_latency .wpstream_event_option_item').is(':checked') ){
747                jQuery('.wpstream-setting-encrypt .wpstream_event_option_item') .removeAttr('checked');           
748            }      
749        }, 300);
750
751    }
752
753    if( attr_value === 'encrypt'){
754        console.log('perform2 ');
755
756        var timer = setTimeout(function() {
757           
758            if( jQuery('.wpstream-setting-encrypt .wpstream_event_option_item').is(':checked') ){
759                   
760                jQuery('.wpstream-setting-low_latency .wpstream_event_option_item') .removeAttr('checked'); 
761                jQuery('.wpstream-setting-adaptive_bitrate .wpstream_event_option_item') .removeAttr('checked'); 
762           
763            }
764
765           
766        }, 300);
767
768    }
769
770}
771
772/*
773*
774* Save options actions
775*  
776*
777*/ 
778
779function wpstream_save_options_actions(){
780    jQuery('.wpestate_settings_modal .wpstream_event_option_item').on('click',function(){
781
782        wpstream_adjust_settings(jQuery(this));
783
784        var holder  =   jQuery(this).parents('.wpstream_event_streaming_local');
785        var show_id =   jQuery(this).parents('.event_list_unit').find('.start_event').attr('data-show-id');
786        var optionarray ={};
787        var nonce               =   jQuery('#wpstream_start_event_nonce').val();
788        var timer = setTimeout(function() {
789            holder.find('.wpstream_event_option_item').each(function(){
790                optionarray[jQuery(this).attr('data-attr-ajaxname')]=jQuery(this).prop("checked") ? 1 : 0 ;
791            });
792       
793
794            var myJSON = JSON.stringify(optionarray);
795            jQuery.ajax({
796                type: 'POST',
797                url: ajaxurl,
798                timeout: 300000,
799                data: {
800                    'action'            :   'wpstream_update_local_event_settings',
801                    'show_id'           :   show_id,
802                    'option'            :   optionarray,
803                    'security'          :   nonce
804                                
805                },
806                success: function (data) {
807                },
808                error: function (jqXHR,textStatus,errorThrown) {
809                }
810                
811            });
812        }, 300);
813        
814    });
815    
816}
817
818/*
819*
820* Function to check live connections
821*  
822*
823*/ 
824 
825function wpstream_check_live_connections(){
826    // was .pending_streaming.pending_trigger
827    if( jQuery('.event_list_unit.pending_trigger').length>0 ){
828        jQuery('.event_list_unit.pending_trigger').each(function(){
829            var acesta      =   jQuery(this);
830            var show_id     =   jQuery(this).attr('data-show-id');
831            var server_id   =   jQuery(this).attr('data-server-id');            
832
833            wpstream_check_live_connections_from_database(acesta,show_id,server_id);
834            var counter_long     =   '';
835            counter_long =  setInterval( function (){ wpstream_check_live_connections_from_database(acesta,show_id,server_id)},60000);
836            counters[show_id]=counter_long;
837
838        });
839    }
840 
841}
842
843
844
845  
846/*
847*
848* check live connection
849*
850*
851*/
852
853    
854function wpstream_check_live_connections_from_database( acesta,channel_id,server_id){
855    var server_status = wpstream_check_event_status_in_js(channel_id,'wpstream_check_live_connections_from_database',
856        function(server_status){
857  
858            if(server_status.status==='active' ){
859                
860                acesta.find('.wpstream_ready_to_stream .start_webcaster').attr('data-webcaster-url',server_status.webcaster_url);
861                acesta.find('.wpstream_live_uri_text').text(server_status.obs_uri);
862                acesta.find('.wpstream_live_key_text').text(server_status.obs_stream);
863            
864                wpstream_event_ready_make_actions_visible( acesta );
865
866                var larix_rtmp= server_status.obs_uri+server_status.obs_stream;
867                acesta.find('.wpstream_larix_rtmp').text(larix_rtmp);
868
869                acesta.find('.larrix_test').text(larix_rtmp); 
870
871                var   larix_qr ='larix://set/v1?conn[][url]='+encodeURIComponent(larix_rtmp);
872                acesta.find('.wpstream_start_with_larix_mobile').attr('href',larix_qr); 
873                
874             
875                var print_qrcode= "https://qrcode.tec-it.com/API/QRCode?size=small&dpi=110&data="+encodeURIComponent(larix_qr);
876
877                acesta.find('.print_qrcode').attr('src',print_qrcode); 
878                acesta.find('.wpstream_live_data').attr('href',server_status.live_data_url);
879                clearInterval( counters["stop"+channel_id]);
880         
881            }else if(server_status.status==='error' ){
882                
883                clearInterval( counters["stop"+channel_id]);
884                var curent_content = acesta.find('.wpstream_channel_status ');
885                
886                curent_content.html('<div class="wpstream_channel_status not_ready_to_stream"><span class="dashicons dashicons-dismiss"></span>'+wpstream_start_streaming_vars.failed_event_creation+'</div>');
887            }
888        },
889        function(){
890            wpstream_event_error_make_actions_visible(acesta);
891        }
892        );
893
894}
895
896
897
898/*
899*
900* Check event/channel status
901*
902*
903*/
904
905    
906function wpstream_check_server_status(url_param,callback) {
907
908    var url = url_param ;
909    var status='';
910    jQuery.ajax({
911        url: url,
912        type: "get",
913        cache: false,
914        dataType: 'jsonp', // it is for supporting crossdomain
915        crossDomain : true,
916        asynchronous : false,
917        timeout : 1500, // set a timeout in milliseconds
918        callback:'',
919        complete : function(xhr) {
920    
921            if(xhr.status == "200" || xhr.status == "400") {
922                callback(true);
923            }
924            else {
925                callback(false);
926            }
927        }
928    });
929}
930    

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.