Question

So I am having a web application with domian "www.example.com" that needs to serve audio from "www.example2.com", but for some reason this is not working (the audio just does not stream)

<audio src="http://www.example2.com/song.mp3" controls preload></audio>

Given that if I put the sound source url directly into the browser the audio will be available

Anyone tried this? thanks

Wa'el

Was it helpful?

Solution

Apparently I cannot vote up CyberK's response (don't have the reputation yet to do so) but I agree with him. You cannot do <audio> or <video> cross-domain. I have tried this exact thing on both Chrome and Firefox. There are more than a couple of articles about this. Finding this out for myself today; not happy with the restriction.

http://www.bluishcoder.co.nz/2008/11/video-audio-and-cross-domain-usage.html

OTHER TIPS

I think HTML5 does not allow you to take a source from another hosting provider / server. Maybe it's limited to your domain but I'm not 100% sure... I do remind that there was a little limitation about this html5 element...

You would need to do some tests but I reckon that it does work, but you may have difficulties with certain actions and queries

Example, you may be able to start/pause/stop but not check the title or the length since that could be a form of XSS

FF and Chrome do not support it, but the IE11 do.

I think W3C should have an solution about cross domain, after all it is a completely reasonable request.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top