If it is in this component, it is unknown problem.
You could try to reproduce it while recording component's log (hold Shift key -> menu View -> Youtube Source Log -> Right click -> Record). Then inspect recorded file for anomalies or send it to me.
Since it seems to work if you try again, why not add a delay using window.SetTimeout?
Okaaaaaaaaaaaaaay. I have investigated a little more, and here is what I've found:
function on_item_focus_change() {
//GetArt_Immediate();
//GetArt_WithInterval();
}
function on_get_album_art_done(metadb, art_id, image, image_path) {
fb.trace(metadb.path);
fb.trace('image fetched: ' + !!image);
}
function GetArt_Immediate() {
utils.GetAlbumArtAsync(window.ID, fb.GetFocusItem(), 0);
}
function GetArt_WithInterval() {
var albumTimer = window.setInterval(function () {
utils.GetAlbumArtAsync(window.ID, fb.GetFocusItem(), 0);
window.ClearInterval(albumTimer);
albumTimer = null;
}, 200);
}
If GetArt_Immediate() is used, then everything works fine. BUT! If GetArt_WithInterval() is used, then sometimes there will be no image :\
It fails only when metadb is from foo_youtube, there is no problems when used on local tracks.
Problem reproducible both when art is not downloaded and when it was already preloaded.
PS: 'Youtube Source Log' is empty when art is preloaded.
[EDIT]: I think, I'm getting somewhere:
function on_item_focus_change() {
GetArt_Immediate();
GetArt_Immediate();
GetArt_Immediate();
}
When multiple immediate calls are used it fails as well.
So, it might have something to do with file locks: since GetAlbumArtAsync is allegedly asynchronous, each call spawns a thread that tries to access the same file, thus possibly blocking other threads from accessing it.