Baseline Widely available
HTMLAudioElement
æ¥å£æä¾å¯¹ <audio>
å
ç´ ç屿§è®¿é®åä¸ç³»åææ§å®çæ¹æ³ï¼å®åºäºå¹¶ä» HTMLMediaElement
æ¥å£ç»§æ¿å±æ§åæ¹æ³ã
must be a string
æé 彿°Audio()
å建并è¿åä¸ä¸ªæ°ç HTMLAudioElement
对象ï¼å¦ææä¾é³é¢æä»¶ URLï¼åå¼å§å è½½é³é¢æä»¶ã
没æå
·ä½ç屿§ï¼ä»ç¶ç±» HTMLMediaElement
å HTMLElement
ç»§æ¿å±æ§ã
ä»ç¶ç±» HTMLMediaElement
å HTMLElement
ç»§æ¿æ¹æ³ï¼èªèº«ä¸æä¾æ¹æ³ã
以䏿¹æ³æ¯æªæ ååçï¼è¯·å¿ä½¿ç¨.
mozCurrentSampleOffset()
éæ å å·²å¼ç¨
Returns the number of samples form the beginning of the stream that have been written so far into the audio stream created by calling mozWriteAudio()
.
mozSetup()
éæ å å·²å¼ç¨
Sets up the audio stream to allow writing, given the number of audio channels (1 or 2) and the sample rate in kHz.
mozWriteAudio()
éæ å å·²å¼ç¨
Writes a batch of audio frames to the stream at the current offset, returning the number of bytes actually written to the stream.
ä½ å¯ä»¥å®å
¨ä½¿ç¨ JavaScript ç Audio()
æé 彿°æ¥å建ä¸ä¸ª HTMLAudioElement
ï¼
var audioElement = new Audio("car_horn.wav");
ç¶åä½ å¯ä»¥å¨è¿ä¸ªå
ç´ ä¸è°ç¨ play()
æ¹æ³
夿³¨ï¼ ä¸ä¸ªå¸¸è§çéæ±æ¯å¨é¡µé¢å è½½å马ä¸å»ææ¾é³é¢ï¼ç°ä»£æµè§å¨çé»è®¤èªå¨ææ¾çç¥ä¼é»æ¢è¿ä¸è¡ä¸ºï¼åè§ firefox å chrome å¯»æ¾æä½³å®è·µåè§£å³æ¹æ¡ã
ä¸äºç»å¸¸è¢«ä½¿ç¨ç屿§ï¼å
æ¬ src
ãcurrentTime
ãduration
ãpaused
ãmuted
å volume
ã以ä¸è¿æ®µä»£ç èµå¼é³é¢æä»¶çææ¾æ¶é¿ç»ä¸ä¸ªåéï¼
var audioElement = new Audio("car_horn.wav");
audioElement.addEventListener("loadeddata", () => {
let duration = audioElement.duration;
// duration åéç°å¨åæ¾é³é¢çææ¾æ¶é¿ï¼åä½ç§ï¼
});
äºä»¶
ä»ç¶ç±» HTMLMediaElement
åç¥å
HTMLElement
ç»§æ¿æ¹æ³ãä½¿ç¨ addEventListener()
çå¬äºä»¶æè
èµå¼ä¸ä¸ªäºä»¶çå¬å¨ç»è¿ä¸ªæ¥å£ç oneventname
屿§ã
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4