Skip to content

Stream? #104

Description

@ChackThree

does anybody know how to use streams in 2025? all issues related are outdated.

function startWave(stream) {
  const canvas = document.querySelector("canvas");
  const audioCtx = new AudioContext();
  const src = audioCtx.createMediaStreamSource(stream);
  console.log(src);
  console.log(stream);
  let wave = new Wave(src, canvas);
  wave.addAnimation(new wave.animations.Wave({
    lineWidth: 10,
    lineColor: "red",
    count: 20
  }));
  console.log("animating?")
};

document.getElementById("share").addEventListener("click", async () => {
  const stream = await navigator.mediaDevices.getDisplayMedia({
    video: true,
    audio: {
      echoCancellation: false,
      noiseSuppression: false,
      sampleRate: 44100
    }
  });
  const audioStream = new MediaStream(stream.getAudioTracks()); //for non chrome users
  startWave(audioStream);
});

src and stream log fine look fine but im not seeing any animations

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions