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

Pitch change does not affect to the html5 video audio. #1264

Open
rrehltp opened this issue Jul 12, 2024 · 1 comment
Open

Pitch change does not affect to the html5 video audio. #1264

rrehltp opened this issue Jul 12, 2024 · 1 comment

Comments

@rrehltp
Copy link

rrehltp commented Jul 12, 2024

Hi there.

I am building a browser extension that plays video in Chrome and Safari.
I want to change the pitch of the Video audio in the HTML5 video tag.

Here is some codebase that I implemented.

    // Play the video content to start the audio context.
    this.player.play();

    // Initialize the pitch shift effect and set its window size.
    pitchShift = new Tone.PitchShift().toDestination();
    pitchShift.windowSize = 0.01;

    // Create a media source from the video container and connect it to the pitch shift effect.
    const mediaSource = Tone.context.createMediaElementSource(this.player.container);
    Tone.connect(mediaSource, pitchShift);


   pitchSlider.addEventListener('change', (e) => { 
      pitchShift.pitch = parseFloat(e.target.value);
    });

Fortunately, it works well in Chrome but not in Safari.

Is it possible to change the pitch level in Safari for HTML5 video audio?

Expected behavior

I want to change the video audio pitch using a slider bar.

What I've tried
I noticed that Tone.context.state was "suspended", so I implemented the resume() mechanism with video playing.
I also activated the auto-play video in Safari and found that Tone.context.state was changed to "running".
However, the pitch doesn't change in Safari.

Hoping to hear from you soon.
All the best.

@yasz
Copy link

yasz commented Sep 26, 2024

1 hope for ur reply!

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

2 participants