3

In my app after I play a video, the default sample rate is changed and the sound becomes chip-munk level.

This answer shows very clear the problem:

// Play a video with audio encoded at 44100 Hz
video.play();

// This will console log 44100
var ctx = new webkitAudioContext();
console.log(ctx.sampleRate);

// Play a video with audio encoded at 48000 Hz
video2.play();

// This will console log 48000
var ctx = new webkitAudioContext();
console.log(ctx.sampleRate);

I could check in the code when the sample rate is changed but before my sound starts I cannot change it. Also this sugests you cannot do that. Refreshing the whole page is also not an option for me.

So is there a way I could properly play my sound after the video?

EDIT:

So I've encoded all the videos and audio to the same sample rate(44100). However, when the app starts on an iPad the first video plays with only 24000 sample rate! although it works fine, another sound starts which is distorted.

Community
  • 1
  • 1
Fofole
  • 3,398
  • 8
  • 38
  • 59

0 Answers0