File size: 1,220 Bytes
2770657
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
class CompareAudio extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        .comparison-container {
          display: grid;
          grid-template-columns: 1fr 1fr;
          gap: 1rem;
          margin: 1rem 0;
        }
        .audio-column {
          background: rgba(55, 65, 81, 0.5);
          padding: 1rem;
          border-radius: 0.5rem;
        }
        .audio-column h3 {
          margin-top: 0;
          text-align: center;
          color: #d1d5db;
        }
        .waveform {
          width: 100%;
          height: 100px;
          background: #1f2937;
          margin-bottom: 0.5rem;
          border-radius: 0.25rem;
        }
      </style>
      <div class="comparison-container">
        <div class="audio-column">
          <h3>Original</h3>
          <div class="waveform" id="original-wave"></div>
          <audio controls></audio>
        </div>
        <div class="audio-column">
          <h3>Processed</h3>
          <div class="waveform" id="processed-wave"></div>
          <audio controls></audio>
        </div>
      </div>
    `;
  }
}
customElements.define('compare-audio', CompareAudio);