7.1 <audio> 태그
▼ 변환 프로그램: Audacity (윈도우, 맥, 리눅스)
7.3 오디오 태그의 속성, 함수, 이벤트
▼ 참고: http://www.w3.org/2010/05/video/mediaevents.html
▼ 오디오/비디오 함수
▼ 오디오/비디오 속성 - HTML MediaElement 인터페이스의 일부, HTMLAudioElement 객체
▼ 오디오/비디오 이벤트
▼ [예제 7-3] 오디오 특성과 캔버스
▼ 실행결과
7.5 캔버스 오디오 플레이어 만들기
▼ 컨트롤
- 재생/일시정지 버튼(toggle)
- 진행 상태 슬라이더
- 조절 가능한 볼륨 슬라이더
- 반복재생 토글 버튼
▼ [예제 7-6] 사용자 맞춤 오디오 플레이어
7.6 오디오 어플:스페이스 레이더스 게임
▼ [예제7-6] 스페이스 레이더스 게임
♣ 예제소스(한빛미디어): html5canvas_ch7.zip
<!doctype html> <html lang="ko"> <head> <meta charset="UTF-8"> <title>CH7EX1: Basic HTML5 Audio </head> <body>7.2 오디오 형식</body> </html>
Browser | MP3 | Wav | Ogg |
---|---|---|---|
Internet Explorer 9 | YES | NO | NO |
Firefox 4.0 | NO | YES | YES |
Google Chrome 6 | YES | YES | YES |
Apple Safari 5 | YES | YES | NO |
Opera 10.6 | NO | YES | YES |
▼ 변환 프로그램: Audacity (윈도우, 맥, 리눅스)
7.3 오디오 태그의 속성, 함수, 이벤트
▼ 참고: http://www.w3.org/2010/05/video/mediaevents.html
▼ 오디오/비디오 함수
Method | Description |
---|---|
addTextTrack() | Adds a new text track to the audio/video |
canPlayType() | Checks if the browser can play the specified audio/video type |
load() | Re-loads the audio/video element |
play() | Starts playing the audio/video |
pause() | Pauses the currently playing audio/video |
▼ 오디오/비디오 속성 - HTML MediaElement 인터페이스의 일부, HTMLAudioElement 객체
Property | Description |
---|---|
audioTracks | Returns a MultipleTrackList object representing available audio tracks |
autoplay | true/false, 로딩이 끝난 후 자동을 재생할지 여부 |
buffered | Returns a TimeRanges object representing the buffered parts of the audio/video |
controller | Returns the MediaController object representing the current media controller of the audio/video |
controls | true/false, HTML 페이지에 컨트롤을 출력. 캔버스에 컨트롤을 출력하려면 직접 만들어야 한다. |
crossOrigin | 오디오 파일의 URL |
currentSrc | Returns the URL of the current audio/video |
currentTime | 재생 중인 오디오 파일의 현재 재생 위치, 초 단위 |
defaultMuted | Sets or returns if the audio/video is muted by default |
defaultPlaybackRate | Sets or returns the default speed of the audio/video playback |
duration | audio 객체가 가리키는 사운드의 전체 길이, 초 단위 |
ended | true/false, audio객체가 duration까지 모두 재생되면 true로 설정됨 |
error | Returns the current error state of the audio/video |
initialTime | Returns the initial play position of the audio/video |
loop | true/false, currentTime이 duration에 다다르면 오디오 클립을 처음부터 다시 재생할지 결정한다. |
mediaGroup | Sets or returns a the group the audio/video belongs to (used to link multiple audio/video elements) |
muted | true/false, 음소거 할지 여부 |
networkState | Returns the current network state of the audio/video |
paused | true/false, 일시정지 상태인가?, pause() 함수 호출하면 true로 설정됨 |
playbackRate | Sets or returns the speed of the audio/video playback |
played | Returns a TimeRanges object representing the already played parts of the audio/video |
preload | 페이지가 출력되기 전에 미디어 파일을 미리 로드할지 지정. |
readyState | Returns the current ready state of the audio/video |
seekable | Returns a TimeRanges object representing the seekable parts of the audio/video |
seeking | Returns if the user is currently moving/skipping to a new position in the audio/video |
src | Sets or returns the current source of the audio/video element |
startOffsetTime | Returns a Date object representing the current time offset |
textTracks | Returns a TextTrackList object representing the available text tracks |
videoTracks | Returns a VideoTrackList object representing the available video tracks |
volume | 0~1, 볼륨 |
▼ 오디오/비디오 이벤트
Event | Description |
---|---|
abort | Fires when the loading of an audio/video is aborted |
canplay | Fires when the browser can start playing the audio/video |
canplaythrough | 당장 재생을 시작해도 시작~끝까지 재생할 수 있다고 계산되면 발생 |
durationchange | Fires when the duration of the audio/video has been changed |
emptied | Fires when the current playlist is empty |
ended | 재생이 duration에 다다르고 재생을 멈추면 true로 설정 |
error | Fires when an error occurred during the loading of an audio/video |
loadeddata | Fires when the browser can start playing the audio/video for the first time |
loadedmetadata | Fires when the browser has received durations, dimensions and text tracks are ready for the audio/video |
loadstart | Fires when the browser starts looking for media data |
pause | Fires when the audio/video has been paused |
play | Fires when the audio/video has been started or is no longer paused |
playing | 오디오가 재생 중이면 true로 설정 |
progress | 브라우저가 파일을 로드하면서 데이터를 가져올 때 발생 이벤트 (브라우저마다 다양하므로 주의할것) |
ratechange | Fires when the playing speed of the audio/video is changed |
seeked | Fires when the user is finished moving/skipping to a new position in the audio/video |
seeking | Fires when the user starts moving/skipping to a new position in the audio/video |
stalled | Fires when the browser is trying to get media data, but data is not avaliable |
suspend | Fires when the browser is intentionally not getting media data |
timeupdate | Fires when the current playback position has changed |
volumechange | 볼륨속성이나 muted 속성이 변경되면 true |
waiting | Fires when the video stops because it needs to buffer the next frame |
▼ [예제 7-3] 오디오 특성과 캔버스
▼ 실행결과
7.5 캔버스 오디오 플레이어 만들기
▼ 컨트롤
- 재생/일시정지 버튼(toggle)
- 진행 상태 슬라이더
- 조절 가능한 볼륨 슬라이더
- 반복재생 토글 버튼
▼ [예제 7-6] 사용자 맞춤 오디오 플레이어
7.6 오디오 어플:스페이스 레이더스 게임
▼ [예제7-6] 스페이스 레이더스 게임
♣ 예제소스(한빛미디어): html5canvas_ch7.zip
반응형
'HTML5 Canvas' 카테고리의 다른 글
CHAR 6. HTML5 캔버스와 비디오 (0) | 2012.03.13 |
---|---|
CHAP 5. 수학과 물리학을 적용한 애니메이션 -- 미완성 (0) | 2012.03.05 |
CHAR 4. 캔버스에서의 이미지 (0) | 2012.03.01 |
CHAR 3. HTML5 캔버스 문자 API (6) | 2012.02.29 |
HTML5 Canvas 관련 사이트 (0) | 2012.02.27 |