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

volumes don't work #311

Open
mhpsy opened this issue Sep 28, 2024 · 1 comment
Open

volumes don't work #311

mhpsy opened this issue Sep 28, 2024 · 1 comment

Comments

@mhpsy
Copy link

mhpsy commented Sep 28, 2024

I've modified the audio and video volumes in my code, but when I render the final output, the volumes remain at their default settings. Could someone explain why this might be happening and how I can effectively adjust the volumes in my Revideo project? Thank you in advance for your assistance!

this is a very simple code!

  const startAudioRef = yield* addAudio(view, '/daolang/start.wav', {
    play: false
  });

  const videoRef = createRef<Video>();
  const bgRef = createRef<Img>();

  yield view.add(
    <>
      <Rect size={['100%', '100%']} fill={'#000'} />
      <Img ref={bgRef} src={'/bg1.png'} size={['100%', '100%']} opacity={0} />
      <Video ref={videoRef} src={'/daolang/dl_ych.mp4'} size={{ width: 1920, height: 1080 }} play={true} loop time={0.1} />
    </>,
  );

  yield* waitFor(6);

  // this setVolume 0.2,but render is not ok
  videoRef().setVolume(0.2);

  startAudioRef().play();

and show addAudio function

export function* addAudio(
    view: View2D,
    audioUrl: string,
    options?: {
        play?: boolean
        volume?: number
    }
) {
    const audioRef = createRef<Audio>();
    const play = options?.play ?? true;
    const volume = options?.volume ?? 1;

    yield view.add(
        <Audio
            src={audioUrl}
            ref={audioRef}
            play={play}
            volume={volume}
        />
    );

    return audioRef;
}
@justusmattern27
Copy link
Member

you're right - setVolume is curently not supported during exports. A workaround would be to just create a new video tag, make it start at second 6, and adjust its volume prop. But I agree that this should 100% be fixed

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