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

사운드 볼륨 조절 커스텀화 #9

Open
mirusu400 opened this issue Nov 25, 2022 · 1 comment
Open

사운드 볼륨 조절 커스텀화 #9

mirusu400 opened this issue Nov 25, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@mirusu400
Copy link
Member

현재의 사운드는 그냥 HTMLMediaElement 를 이용하기때문에 여기의 volume attribute를 지정해서 수정하는 방법밖에 없습니다.

그렇기에, 최소 0부터 최대 1까지밖에 안되고, 이는 이미 KLAS에서 쓰는 UniPlayer에 적용이 되어있습니다.

참고 : https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/volume

이를 해결하기 위해서는 audioContext API를 이용하면 볼륨 확장이 가능하다고 해, 개발 가능성은 있어 보입니다.

참고 : https://github.com/piousdeer/chrome-volume-manager/blob/master/src/background.ts

@mirusu400 mirusu400 added the enhancement New feature or request label Nov 25, 2022
@mirusu400
Copy link
Member Author

사운드 볼륨을 1 이상으로 조절하는 간단한 예제 스니펫입니다

const element = document.getElementsByClassName("vc-vplay-video1")[0]

const audioContext = new AudioContext()
const streamSource = audioContext.createMediaStreamSource(element.captureStream())
const gainNode = audioContext.createGain()

streamSource.connect(gainNode)
gainNode.connect(audioContext.destination)


gainNode.gain.value = 200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant