Clean some console.logs

This commit is contained in:
Ruben van de Ven 2022-06-10 13:13:13 +02:00
parent 89253454f9
commit 95405ddd31

View file

@ -423,12 +423,12 @@ class Annotator extends EventTarget {
this.outPointTimeMs = out_ms; this.outPointTimeMs = out_ms;
// this._seekByTimeMs(this.audioOffset < 0 ? this.audioOffset * 1000 : 0); // this._seekByTimeMs(this.audioOffset < 0 ? this.audioOffset * 1000 : 0);
// draw full stroke of annotation // draw full stroke of annotation
console.log('setInOut'); console.debug('setInOut');
this.drawStrokePosition(this.inPointPosition, this.outPointPosition); this.drawStrokePosition(this.inPointPosition, this.outPointPosition);
console.log([`${this.inPointTimeMs}`, `${this.outPointTimeMs}`]) console.debug([`${this.inPointTimeMs}`, `${this.outPointTimeMs}`])
this.slider.set([this.inPointTimeMs, this.outPointTimeMs]); this.slider.set([this.inPointTimeMs, this.outPointTimeMs]);
// console.log(this.selectedAnnotation); // console.debug(this.selectedAnnotation);
if (this.selectedAnnotation) { if (this.selectedAnnotation) {
this.selectedAnnotation.t_in = in_ms; this.selectedAnnotation.t_in = in_ms;
this.selectedAnnotation.t_out = out_ms; this.selectedAnnotation.t_out = out_ms;
@ -443,7 +443,7 @@ class Annotator extends EventTarget {
this.outPointTimeMs = null; this.outPointTimeMs = null;
this._seekByTimeMs(this.audioOffset < 0 ? this.audioOffset * 1000 : 0); this._seekByTimeMs(this.audioOffset < 0 ? this.audioOffset * 1000 : 0);
// draw full stroke of annotation // draw full stroke of annotation
console.log('reset!'); console.debug('reset!');
this.drawStrokePosition(this.inPointPosition, [Infinity, Infinity]); this.drawStrokePosition(this.inPointPosition, [Infinity, Infinity]);
this.setUpAnnotator(); this.setUpAnnotator();
} }
@ -471,7 +471,7 @@ class Annotator extends EventTarget {
} }
return this.loadStrokes(data, metadata) return this.loadStrokes(data, metadata)
}) })
.catch(e => console.log(e)); .catch(e => console.error(e));
} else { } else {
return this.loadStrokes(data, null); return this.loadStrokes(data, null);
} }
@ -480,7 +480,7 @@ class Annotator extends EventTarget {
// play on click for player // play on click for player
if(this.config.is_player) { if(this.config.is_player) {
this.svgEl.addEventListener('click', (ev) => { this.svgEl.addEventListener('click', (ev) => {
console.log('clicked for play/pause'); console.debug('clicked for play/pause');
this.playPause(); this.playPause();
}); });
} }
@ -492,7 +492,7 @@ class Annotator extends EventTarget {
this.wrapperEl.classList.remove('loading'); this.wrapperEl.classList.remove('loading');
} }
}) })
.catch(e => console.log(e)); .catch(e => console.debug(e));
} }
updateState() { updateState() {
@ -519,7 +519,7 @@ class Annotator extends EventTarget {
setSaved(state) { setSaved(state) {
if (this.state != state) { if (this.state != state) {
console.log('already outdated'); console.debug('already outdated');
} }
else { else {
this.wrapperEl.classList.add('saved'); this.wrapperEl.classList.add('saved');
@ -545,7 +545,7 @@ class Annotator extends EventTarget {
} }
}) })
.catch((error) => { .catch((error) => {
console.log(error); console.error(error);
}); });
} }
@ -661,11 +661,11 @@ class Annotator extends EventTarget {
ttInputEl.focus(); ttInputEl.focus();
const submit = () => { const submit = () => {
console.log(ttInputEl.value); console.debug(ttInputEl.value);
const tcMs = this.formatter.from(ttInputEl.value); const tcMs = this.formatter.from(ttInputEl.value);
let points = this.slider.get(); let points = this.slider.get();
points[i] = tcMs; points[i] = tcMs;
console.log(points); console.debug(points);
this.slider.set(points); this.slider.set(points);
}; };
ttInputEl.addEventListener('keydown', (keyE) => { ttInputEl.addEventListener('keydown', (keyE) => {
@ -702,7 +702,6 @@ class Annotator extends EventTarget {
} }
this.title = null; this.title = null;
console.log(metadata);
if (metadata && metadata.hasOwnProperty('title')) { if (metadata && metadata.hasOwnProperty('title')) {
this.title = metadata.title; this.title = metadata.title;
} }
@ -755,17 +754,15 @@ class Annotator extends EventTarget {
// Probably a wrong order // Probably a wrong order
if (ev.key == 'ArrowLeft' && ev.shiftKey) { if (ev.key == 'ArrowLeft' && ev.shiftKey) {
const p = this._paused; const p = this._paused;
console.log(p);
const diff = ev.ctrlKey ? 10000 : 1000; const diff = ev.ctrlKey ? 10000 : 1000;
this.scrubTo(this._currentTimeMs - diff); this.scrubTo(this._currentTimeMs - diff);
if (!p) { console.log('play!'); this.play(); } // scrubTo() causes a pause(); if (!p) { this.play(); } // scrubTo() causes a pause();
} }
if (ev.key == 'ArrowRight' && ev.shiftKey) { if (ev.key == 'ArrowRight' && ev.shiftKey) {
const p = this._paused; const p = this._paused;
console.log(p);
const diff = ev.ctrlKey ? 10000 : 1000; const diff = ev.ctrlKey ? 10000 : 1000;
this.scrubTo(this._currentTimeMs + diff); this.scrubTo(this._currentTimeMs + diff);
if (!p) { console.log('play!'); this.play(); } // scrubTo() causes a pause(); if (!p) { this.play(); } // scrubTo() causes a pause();
} }
// additional keys only for annotation mode // additional keys only for annotation mode
@ -967,12 +964,12 @@ class Annotator extends EventTarget {
} }
} else { } else {
if (this.audioEl.currentTime !== t_start / 1000) { if (this.audioEl.currentTime !== t_start / 1000) {
console.log(this.audioEl.currentTime, t_start / 1000); console.debug(this.audioEl.currentTime, t_start / 1000);
this.audioEl.currentTime = t_start / 1000; this.audioEl.currentTime = t_start / 1000;
} }
this.audioEl.play(); this.audioEl.play();
// this.audioEl.play(); // play is done in "seeked" evenlistener // this.audioEl.play(); // play is done in "seeked" evenlistener
console.log(this.audioEl.currentTime, t_start, t_in, t_out); console.debug(this.audioEl.currentTime, t_start, t_in, t_out);
} }
this.audioIsPlaying = true; // also state as playing in preroll this.audioIsPlaying = true; // also state as playing in preroll
@ -1115,7 +1112,7 @@ class Annotator extends EventTarget {
// when an outpoint is set, stop playing there // when an outpoint is set, stop playing there
if (this.outPointPosition && (next_path > this.outPointPosition[0] || if (this.outPointPosition && (next_path > this.outPointPosition[0] ||
(next_path == this.outPointPosition[0] && next_point > this.outPointPosition[1]))) { (next_path == this.outPointPosition[0] && next_point > this.outPointPosition[1]))) {
console.log('> out point', this.outPointPosition) console.debug('> out point', this.outPointPosition)
return [null, null]; return [null, null];
} }