Sha256: 15d85d740ac0555e7e35a15e9b11081196fab54c3bc05485fff6d7436a4a2f0e
Contents?: true
Size: 1.45 KB
Versions: 1
Compression:
Stored size: 1.45 KB
Contents
;(function() { var paths = window.location.pathname.split('/'), channel = paths[ paths.length - 1]; if( channel ) { console.log( 'tune in to channel:', channel ); document.getElementById('smpte_message').innerHTML = 'Establishing uplink...'; var source = new EventSource('../tune_in/' + channel); source.addEventListener('open', function(e) { document.getElementById('smpte_message').innerHTML = 'Awaiting transmission...'; // Connection was opened. console.log('[open]', e); }, false); source.addEventListener('message', function(e) { console.log( '[message]', e.data ); var payload = JSON.parse( e.data ); document.getElementById('smpte').style.display = 'none'; document.getElementById('program').setAttribute('src', payload.url); }, false); source.addEventListener('error', function(e) { if (e.eventPhase == EventSource.CLOSED) { console.log('[closed]', e); document.getElementById('smpte_message').innerHTML = 'Transmission lost...'; document.getElementById('program').setAttribute('src', 'about:blank'); // Move this functionality to a class for better cross-browser support document.getElementById('smpte').style.display = '-webkit-box'; // Connection was closed. } else { console.log('[closed]', e); } }, false); } else { document.getElementById('smpte_message').innerHTML = 'No signal'; } })();
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
network_executive-0.0.3 | app/assets/javascripts/network_executive/set_top_box.js |