aadsm / JavaScript-ID3-Reader

ID3 tags reader in JavaScript (ID3v1, ID3v2 and AAC)

Home Page:http://www.aadsm.net/libraries/id3/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: No suitable file reader found on Drag and Drop Audio Files

CodeZeke123 opened this issue · comments

hi! i have a problem reading about files in javascript on drag and drop and it say "Error: No suitable file reader found"

`var jsmediatags = window.jsmediatags

$(document).ready(function() {
var UploadAudioArea= $('#UploadAudioArea')

UploadAudioArea.on('drop', function(e) {
	e.preventDefault()
	
	new jsmediatags.read(e.originalEvent.dataTransfer.files[0].name, {
		onSuccess: function(tag) {
		   var tags = tag.tags
		   console.log(tags.artist + " - " + tags.title + ", " + tags.album)
		},
		onError: function(error) {
			console.log(':(', error.type, error.info);
		}
	})
})
UploadAudioArea.on('dragover', function(e) {
	
	return false
})
UploadAudioArea.on('dragleave', function(e) {
	
	return false
})

})`

untitled

You need to pass the file object, not the name:

new jsmediatags.read(e.originalEvent.dataTransfer.files[0], {