Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

เล่นไฟล์ WAV บน iOS Safari

iOS Safari ต้องการ Range Requests สำหรับ Audio

WAV ไฟล์ต้องมี HTTP Headers ที่รองรับ Byte Range

Headers ที่จำเป็น

Content-Range: bytes 0-1023/2048
Content-Type: audio/wav
Content-Disposition: attachment; filename="audio.wav"
Content-Length: 2048
Accept-Ranges: bytes

Server ต้องรองรับ Range Request Header และตอบกลับด้วย 206 Partial Content

ทางเลือก: แปลงเป็น MP3/AAC

iOS รองรับ MP3, AAC, MP4 Native ไม่ต้อง Range Requests แนะนำใช้ Format นี้แทน