Send custom HTTP request header with HTML5 audio tag

后端 未结 3 599
-上瘾入骨i
-上瘾入骨i 2020-12-03 15:16

Is it possible to send custom HTTP request headers using the HTML5 audio tag? I\'m especially interested in sending a HTTP Range header, so the webserver will only stream pa

3条回答
  •  攒了一身酷
    2020-12-03 15:53

    To answer the broad question... that will depend on what kind of request exactly.

    What you want[ed] to do is actually very possible. You can simply add a #t=start[,end] Media Fragment to any media url, and the browser will know it will have to only play from these timestamps:

    
    

    And since I came from the future a question that did ask about sending authorization along with the media request, here is a link to some docs about the crossOrigin attribute, which will also make your HTTP request with "custom headers".

提交回复
热议问题