HTML5 Audio source with special headers

The thing is: I need to play a streaming sound with HTML5 using audio tag, but the problem is that to access that sound I have to request a REST API that need an special header in the request. So the source audio is in: http://mydomain.com/aapi/source/1234 But it only works if I request it with some header like this:

'x-sk-apiKey' : 'APIKey',
'x-sk-version' : '1.0',
'x-sk-client' : 'iPhone',
'x-sk-device-id' : 'device-id'
'x-sk-device-id' : 'device-id'
'x-sk-token' : '12332424r3fwd23r2cdscadscsd234234'

Is it posible to set audio src attribute to some javascript function like:

<script>

onButtonClick(){
  audio = document.getElementById('audio');
  audio.src=ajax.requestWithHeader('http://mydomain.com/aapi/source/1234');
  audio.play();
}
</script>

In this case, setting up something like a PHP proxy for doing the request is not allowed.

Thanks!! Nacho

链接地址: http://www.djcxy.com/p/60738.html

上一篇: C#Web API HTML5音频标签Seekable

下一篇: 带有特殊标题的HTML5音频源