Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no sound when using WebAssemblyRecorder #876

Open
xiaoyao96 opened this issue May 30, 2024 · 0 comments
Open

no sound when using WebAssemblyRecorder #876

xiaoyao96 opened this issue May 30, 2024 · 0 comments

Comments

@xiaoyao96
Copy link

No sound when using WebAssemblyRecorder. How to make it sound ?

The demo is as follows:

<title>WebAssembly Recorder using RecordRTC</title>
<style type="text/css">
body {
  text-align: center;
}

video {
  border-radius: 5px;
  border: 1px solid black;
}
</style>

<h1>WebAssembly Recorder using RecordRTC <span id="version"></span></h1>
<button id="start">Start Recording</button>
<button id="stop" disabled>Stop Recording</button>
<br><br>
<video id="video" controls autoplay playsinline></video>

<!-- web streams API polyfill to support Firefox -->
<script src="https://unpkg.com/@mattiasbuelens/web-streams-polyfill/dist/polyfill.min.js"></script>

<script src="https://www.WebRTC-Experiment.com/RecordRTC.js"></script>

<script>
document.getElementById('version').innerHTML = RecordRTC.version;

var recorder;

document.getElementById('start').onclick = function() {
    this.disabled = true;
    document.getElementById('video').muted = true
    navigator.mediaDevices.getUserMedia({
        video: {
            width: {
                ideal: 640
            },
            height: {
                ideal: 480
            }
        },
        audio: true
    }).then(function(stream) {
        document.getElementById('video').srcObject = stream;

        recorder = RecordRTC(stream, {
            recorderType: WebAssemblyRecorder,
            // workerPath: '../libs/webm-worker.js',
            // webAssemblyPath: '../libs/webm-wasm.wasm',
            width: 640,
            height: 480,
            frameRate: 30
        });
        recorder.startRecording();

        document.getElementById('stop').disabled = false;
    });
};

document.getElementById('stop').onclick = function() {
    document.getElementById('video').srcObject = null;

    this.disabled = true;
    recorder.stopRecording(function(blob) {
        document.getElementById('video').muted = false
        document.getElementById('video').src = blob;
        document.getElementById('start').disabled = false;
    });
}
</script>

<footer style="margin-top: 20px;"><small id="send-message"></small></footer>
<script src="https://www.webrtc-experiment.com/common.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant