11< html >
22< head >
3- < script src ="dist/dataparty-browser.js "> </ script >
43 < script src ="node_modules/argon2-browser/dist/argon2-bundled.min.js "> </ script >
54
65 < title > p2p tester</ title >
3231 }
3332
3433 textarea {
35- width : 100 vw ;
34+ width : 95 vw ;
3635 height : 20vh ;
3736 white-space : pre;
3837 overflow-wrap : normal;
@@ -91,6 +90,32 @@ <h2>Offers recieved</h2>
9190 < textarea id ="answerArea "> </ textarea >
9291 </ div >
9392
93+ < div id ="log ">
94+
95+ </ div >
96+
97+
98+
99+ <!--<script>
100+ var log = document.querySelector('#log');
101+ ['log', 'debug', 'info', 'warn', 'error'].forEach(function (verb) {
102+ console[verb] = (function (method, verb, log) {
103+ return function () {
104+ method.apply(console, arguments);
105+ var msg = document.createElement('div');
106+ msg.classList.add(verb);
107+
108+ msg.textContent = verb + ': ' + Array.prototype.slice.call(arguments).join(' ')
109+
110+ //}
111+ log.appendChild(msg);
112+ };
113+ })(console[verb], verb, log);
114+ });
115+ </script> -->
116+
117+ < script src ="dist/dataparty-browser.js "> </ script >
118+
94119< script >
95120
96121let matchMaker = null
@@ -117,16 +142,10 @@ <h2>Offers recieved</h2>
117142} )
118143
119144async function setupDebug ( active ) {
120- // id="trickle-checkbox">
121- // id="half-trickle-checkbox">
122- // id="turn-checkbox">
123145
124146 let offerArea = document . getElementById ( 'offerArea' )
125147 let answerArea = document . getElementById ( 'answerArea' )
126148
127- // let trickleCheckbox = document.getElementById('trickle-checkbox')
128- // let halfTrickleCheckbox = document.getElementById('half-trickle-checkbox')
129- // let turnCheckbox = document.getElementById('turn-checkbox')
130149
131150 active . on ( 'signal' , ( { invite, data} ) => {
132151 answerArea . value += '\n' + JSON . stringify ( data )
@@ -164,20 +183,6 @@ <h2>Offers recieved</h2>
164183 action : 'call'
165184 } )
166185
167- /* pendingInvite.on('stream', invite => {
168- // got remote video stream, now let's show it in a video tag
169- console.log('showing remote video')
170- var video = document.getElementById('remote-video')
171-
172- if ('srcObject' in video) {
173- video.srcObject = invite.incomingStream
174- } else {
175- video.src = window.URL.createObjectURL(invite.incomingStream) // for older browsers
176- }
177-
178- video.play()
179- })*/
180-
181186 pendingInvite . on ( 'state-change' , ( invite ) => {
182187 console . log ( 'state-change' , invite . state , invite )
183188 } )
@@ -269,9 +274,18 @@ <h2>Offers recieved</h2>
269274 } )
270275}
271276
272- init ( ) . catch ( ( err ) => {
273- console . error ( 'crashed' , err )
274- } )
277+ function start ( ) {
278+ init ( ) . catch ( ( err ) => {
279+ console . error ( 'crashed' , err )
280+ } )
281+
282+ }
283+
284+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
285+ localStorage . setItem ( 'debug' , '*' )
286+ start ( )
287+ } ) ;
288+
275289
276290</ script >
277291
0 commit comments