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

record-video extension and html-video-response misparse the base64 string when include_audio is true in init_camera. #3445

Open
kschuler opened this issue Nov 23, 2024 · 0 comments

Comments

@kschuler
Copy link

The record-video extension (and html-video-response) should record audio and video when init-camera has the parameter include_audio: true.

But when include_audio is true, the base64data is no longer accessible due to a misparse of the string. You get something like the string "audiocodecyouspecified;base64" instead of the base64Data. I suspect the additional metadata relating to the audio codec is messing up this part of the plugin:

private updateData() {
    const data = new Blob(this.recordedChunks, {
      type: this.recorder.mimeType,
    });
    const reader = new FileReader();
    reader.addEventListener("load", () => {
      const base64 = (reader.result as string).split(",")[1];
      this.currentTrialData.record_video_data = base64;
      if (this.onUpdateCallback) {
        this.onUpdateCallback();
      }
    });
    reader.readAsDataURL(data);
  }
}

Maybe something as simple as changing .split(",")[1] with .split("base64,")[1] (or similar) would fix the misparse issue?

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