Skip to content

Showing cross origin error in access of another domain mp3 files tags #64

@php07magic

Description

@php07magic

I am trying to fetch all tags data like album name, artist, song image etc from amazon server. Here is one URL of song that I am passing https://s3.amazonaws.com/clueradiomedia/music/%24uicideBoy%24/Either%20Hated%20Or%20Ignored%20-%20Single/Either%20Hated%20Or%20Ignored.mp3

var customurl = 'https://s3.amazonaws.com/clueradiomedia/music/%24uicideBoy%24/Either%20Hated%20Or%20Ignored%20-%20Single/Either%20Hated%20Or%20Ignored.mp3';

ID3.loadTags(customurl, function() {

    var getfile = customurl;
	var tags = ID3.getAllTags(getfile);
	
	console.log(tags);
	
	alert(tags.artist + " - " + tags.title + ", " + tags.album);

	var image = tags.picture;
	if (image) {
		var base64String = "";
		for (var i = 0; i < image.data.length; i++) {
			base64String += String.fromCharCode(image.data[i]);
		}
		var base64 = "data:" + image.format + ";base64," +
				window.btoa(base64String);
		document.getElementById('picture').setAttribute('src',base64);
	  } else {
		document.getElementById('picture').style.display = "none";
	  }
},{
    tags: ["title","artist","album","picture", "year", "comment", "track", "genre", "lyrics"],
  });

But, when I am hitting above function then its showing me this error "Access to XMLHttpRequest at 'http://s3.amazonaws.com/clueradiomedia/music/%24uicideBoy%24/Either%20Hated%20Or%20Ignored%20-%20Single/Either%20Hated%20Or%20Ignored.mp3' from origin 'http://----' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource."

I am checking the main file but its minified so I can't deduct how to pass request headers for XML request.

Can please suggest me how to pass allow origin headers here?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions