<commit_before>(function(){
	
	
var CONTROLLER = window.CONTROLLER = function(phone, stream){
	if (!window.phone) window.phone = phone;
	var ctrlChan  = controlChannel(phone.number());
	var isStream  = stream || false;
	var pubnub    = phone.pubnub;
	var userArray = [];
	subscribe();
	
	var CONTROLLER = function(){};
	
	// Get the control version of a users channel
	function controlChannel(number){
		return number + "-ctrl";
	}
	
	// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
	// Setup Phone and Session callbacks.
	// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
	var readycb   = function(session){};
    var receivecb = function(session){};
    var authcb    = function(){};
    var videotogglecb = function(session, isEnabled){};
    var audiotogglecb = function(session, isEnabled){};
    
    CONTROLLER.ready   = function(cb) { readycb   = cb };
    CONTROLLER.auth    = function(cb) { authcb    = cb }
    CONTROLLER.receive = function(cb) { receivecb = cb };
    CONTROLLER.videoToggled = function(cb) { videotogglecb = cb };
    CONTROLLER.audioToggled = function(cb) { audiotogglecb = cb };
	
	phone.ready(function(){ readycb() });
	phone.receive(function(session){
		manage_users(session);
		receivecb(session);
	});
	
	// Require some boolean form of authentication to accept a call
	CONTROLLER.answerCall = function(session, auth, cb){
		auth(acceptCall(session, cb), session);
	}
	
	function acceptCall(session, cb){ // Return function bound to session that needs a boolean.
		return function(accept) {
			if (accept) cb(session);
			else phone.hangup(session.number); 
		}
	}
	
	// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
	// Setup broadcasting, your screen to all.
	// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
	var streamreceivecb = function(m){}; 
	var streamprescb    = function(m){};
	var stream_name = "";
	
	
	CONTROLLER.streamPresence = function(cb){ streamprescb    = cb; }
	CONTROLLER.streamReceive  = function(cb){ streamreceivecb = cb; }
	
	function broadcast(vid){
	    var video = document.createElement('video');
		
        video.src    = URL.createObjectURL(phone.mystream);
        video.volume = 0.0;
        video.play();
	    //vid.innerHTML=""
	    vid.setAttribute( 'autoplay', 'autoplay' );
	    vid.setAttribute( 'data-number', phone.number() );
	    vid.style.cssText ="-moz-transform: scale(-1, 1); \
						 	-webkit-transform: scale(-1, 1); -o-transform: scale(-1, 1); \
							transform: scale(-1, 1); filter: FlipH;";
		vid.appendChild(video);
    };
    
    function stream_subscribe(name){
	    var ch = (name ? name : phone.number()) + "-stream";
	    pubnub.subscribe({
            channel    : ch,
            message    : streamreceivecb,
            presence   : streamprescb,
            connect    : function() { stream_name = ch; console.log("Streaming channel " + ch); }
        });
    }
    
    CONTROLLER.stream = function(){
	    stream_subscribe();
    }
    <commit_msg>Autoplay on addLocalStream<commit_after>(function(){
	
	
var CONTROLLER = window.CONTROLLER = function(phone, stream){
	if (!window.phone) window.phone = phone;
	var ctrlChan  = controlChannel(phone.number());
	var isStream  = stream || false;
	var pubnub    = phone.pubnub;
	var userArray = [];
	subscribe();
	
	var CONTROLLER = function(){};
	
	// Get the control version of a users channel
	function controlChannel(number){
		return number + "-ctrl";
	}
	
	// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
	// Setup Phone and Session callbacks.
	// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
	var readycb   = function(session){};
    var receivecb = function(session){};
    var authcb    = function(){};
    var videotogglecb = function(session, isEnabled){};
    var audiotogglecb = function(session, isEnabled){};
    
    CONTROLLER.ready   = function(cb) { readycb   = cb };
    CONTROLLER.auth    = function(cb) { authcb    = cb }
    CONTROLLER.receive = function(cb) { receivecb = cb };
    CONTROLLER.videoToggled = function(cb) { videotogglecb = cb };
    CONTROLLER.audioToggled = function(cb) { audiotogglecb = cb };
	
	phone.ready(function(){ readycb() });
	phone.receive(function(session){
		manage_users(session);
		receivecb(session);
	});
	
	// Require some boolean form of authentication to accept a call
	CONTROLLER.answerCall = function(session, auth, cb){
		auth(acceptCall(session, cb), session);
	}
	
	function acceptCall(session, cb){ // Return function bound to session that needs a boolean.
		return function(accept) {
			if (accept) cb(session);
			else phone.hangup(session.number); 
		}
	}
	
	// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
	// Setup broadcasting, your screen to all.
	// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
	var streamreceivecb = function(m){}; 
	var streamprescb    = function(m){};
	var stream_name = "";
	
	
	CONTROLLER.streamPresence = function(cb){ streamprescb    = cb; }
	CONTROLLER.streamReceive  = function(cb){ streamreceivecb = cb; }
	
	function broadcast(vid){
	    var video = document.createElement('video');
        video.src    = URL.createObjectURL(phone.mystream);
        video.volume = 0.0;
        video.play();
	    video.setAttribute( 'autoplay', 'autoplay' );
	    video.setAttribute( 'data-number', phone.number() );
	    vid.style.cssText ="-moz-transform: scale(-1, 1); \
						 	-webkit-transform: scale(-1, 1); -o-transform: scale(-1, 1); \
							transform: scale(-1, 1); filter: FlipH;";
		vid.appendChild(video);
    };
    
    function stream_subscribe(name){
	    var ch = (name ? name : phone.number()) + "-stream";
	    pubnub.subscribe({
            channel    : ch,
            message    : streamreceivecb,
            presence   : streamprescb,
            connect    : function() { stream_name = ch; console.log("Streaming channel " + ch); }
        });
    }
    
    CONTROLLER.stream = function(){
	    stream_subscribe();
    }
    
{'fraction_non_alphanumeric': 0.2196001311045559, 'fraction_numerical': 0.0032776138970829235, 'mean_word_length': 2.643582089552239, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4970234', 'n_tokens_mistral': 2166, 'n_tokens_neox': 1868, 'n_words': 405}