이 페이지는 WebGL의 오디오 기능에 대한 정보만 제공합니다. Unity 프로젝트에서 오디오를 사용하는 방법은 오디오 개요를 참조하십시오.
Unity WebGL은 오디오 기능이 제한되어 있고 기본 기능만 지원합니다. Unity는 대개 FMOD를 사용하여 플랫폼용 오디오를 관리하기 때문입니다. 하지만 FMOD는 WebGL이 지원하지 않는 스레드에 의존합니다. 이러한 이유로 Unity는 브라우저가 오디오 재생 및 믹싱을 처리하도록 지원하는 내부 Web Audio API 기반 구현을 사용합니다.
Unity WebGL은 다음 API 클래스를 지원합니다.
클래스 | WebGL 지원 상태 |
---|---|
AudioSouce | WebGL은 일부 API를 지원합니다. 자세한 지원 내용은 AudioSource를 참조하십시오. |
AudioListener | 모든 API가 지원됩니다. |
AudioClip | WebGL은 일부 API를 지원합니다. 자세한 지원 내용은 AudioClip을 참조하십시오. |
SystemInfo.supportsAudio | 브라우저가 WebGL에 대한 오디오 지원을 제공합니다. 이러한 이유로 SystemInfo.supportsAudio 는 항상 true입니다. |
Microphone | 지원되지 않음. |
AudioSource API는 다음을 포함한 기본 포지션 오디오 재생을 지원합니다.
Unity WebGL은 다음 AudioSource API를 지원합니다.
프로퍼티 | 요약 |
---|---|
Clip | 다음에 재생할 오디오 클립을 결정합니다. |
dopplerLevel | AudioSource의 도플러 스케일을 설정합니다. |
ignoreListenerPause | AudioSource가 AudioListener.pause 를 무시하고 오디오를 계속 재생하도록 허용합니다. |
ignoreListenerVolume | 최종 사용자의 AudioSource 볼륨을 무시합니다. |
isPlaying |
AudioSource.clip 이 재생 중이면 true를 반환합니다. |
loop | 애플리케이션이 AudioSource.clip 을 반복하도록 허용합니다. |
maxDistance |
AudioSource.clip 이 감쇠를 멈추거나 들리지 않게 되는 최대 거리를 설정합니다. |
minDistance | AudioSource.clip의 볼륨이 더 이상 증가하지 않는 최소 거리를 설정합니다. 소리가 최소 거리 이상으로 감쇠되기 시작합니다. |
mute | AudioSource를 음소거합니다. |
pitch |
AudioSource.clip 의 피치를 설정합니다. WebGL은 양수 피치 값만 지원합니다. |
playOnAwake | 활성 상태일 때 AudioSource를 재생합니다. |
rolloffMode | 거리에 따른 AudioSource 감쇠를 설정합니다. |
time | 재생 포지션을 초 단위로 설정합니다. |
timeSamples | 펄스 코드 변조(PCM) 샘플의 재생 포지션을 설정합니다. |
velocityUpdateMode | AudioSource가 고정 또는 동적 업데이트 루프에서 업데이트되는지 여부를 설정합니다. |
volume | AudioSource의 볼륨을 설정합니다(0.0–1.0). |
메서드 | 요약 |
---|---|
Pause |
AudioSource.clip 을 일시정지합니다. |
Play |
AudioSource.clip 을 재생합니다. |
PlayDelayed | 지정한 지연 시간(초)으로 AudioSource.clip 을 재생합니다. |
PlayOneShot | AudioClip을 재생하고 volumeScale로 AudioSource 볼륨을 조정합니다. |
PlayScheduled | 지정된 시간에 AudioSource를 재생합니다. |
SetScheduledEndTime | 예약된 AudioSource.clip 이 종료되는 시간을 설정합니다. |
SetScheduledStartTime | 예약된 AudioSource.clip 이 시작하는 시간을 설정합니다. |
Stop |
AudioSource.clip 재생을 중지합니다. |
UnPause | ’AudioSource.clip’의 일시정지를 해제합니다. |
PlayClipAtPoint | 월드 공간의 특정 포지션에서 AudioSource.clip 을 재생합니다. |
Unity WebGL은 브라우저에서 널리 지원되는 AAC 포맷의 AudioClip 파일을 임포트합니다. Unity WebGL은 다음의 AudioClip API를 지원합니다.
프로퍼티 | 요약 |
---|---|
length | 초 단위의 AudioClip 길이입니다. |
loadState | AudioClip과 연결된 오디오 데이터의 현재 로드 상태를 반환합니다. |
samples | 샘플 단위의 AudioClip 길이입니다. |
loadType | 클립의 로드 타입입니다. 인스펙터에서 AudioClip 로드 타입을 설정할 수 있습니다. |
메서드 | 요약 | 추가 정보 |
---|---|---|
AudioClip.Create | 지정된 이름과 길이의 AudioClip을 만듭니다. | Unity WebGL은 AudioClip.Create 를 부분적으로 지원합니다. 브라우저는 동적 스트리밍을 지원하지 않으므로, AudioClip.Create 를 사용하려면 Stream을 false로 설정하십시오. |
AudioClip.SetData | AudioSource.clip의 샘플 데이터를 설정합니다. | Unity WebGL은 AudioClip.SetData 를 부분적으로 지원합니다. 이 메서드는 AudioClip의 콘텐츠를 바꾸는 데만 사용할 수 있습니다. WebGL에서 Unity는 offsetSample 파라미터를 무시합니다. |
Unity WebGL은 압축된 오디오를 지원하지 않습니다.
보안상의 이유로 브라우저는 최종 사용자가 마우스 클릭, 터치 이벤트 또는 키 누름을 통해 애플리케이션 웹 페이지와 상호작용할 때까지 오디오 재생을 허용하지 않습니다. 메인 콘텐츠가 시작되기 전에 최종 사용자가 애플리케이션과 상호작용하고 오디오 재생을 시작할 수 있도록 로딩 화면을 사용하십시오.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.