Код: Выделить всё
Код: Выделить всё
AUDIO
function createCORSRequest(method, url) {
var xhr = new XMLHttpRequest();
if («withCredentials» в xhr) {
// XHR для Chrome/Firefox/Opera/Safari.
xhr.open(method, url, true);
} else if (typeof XDomainRequest != «undefined») {
// XDomainRequest для IE.
xhr = new XDomainRequest();
xhr.open(method, url);
} else {
// CORS не поддерживается.
xhr = null;
return xhr;
Код: Выделить всё
// Helper method to parse the title tag from the response.
function getTitle(text) {
return text.match('(.*)?')[1];
}
// Make the actual CORS request.
function makeCorsRequest() {
// All HTML5 Rocks properties support CORS.
var url = 'http://streaming.radionomy.com/VWClassicRock';
var xhr = createCORSRequest('GET', url);
if (!xhr) {
alert('CORS not supported');
return;
}
// Response handlers.
xhr.onload = function() {
var text = xhr.responseText;
var title = getTitle(text);
alert('Response from CORS request to ' + url + ': ' + title);
};
xhr.onerror = function() {
alert('Woops, there was an error making the request.');
};
xhr.send();
}
makeCorsRequest();
Код: Выделить всё
Код: Выделить всё
. Если я помещу URL-адрес в аудио-тег HTML следующим образом
Код: Выделить всё
AUDIO
Код: Выделить всё
Подробнее здесь: https://stackoverflow.com/questions/252 ... ot-working
Мобильная версия