diff --git a/README.md b/README.md index 150f884..01cab32 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ function onDeviceReady() { artist = "Daft Punk"; title = "One More Time"; album = "Discovery"; - image = "path_within_documents_storage OR url_starting_with_http_or_https"; + image = "path_within_documents_storage OR path_within_library_storage OR url_starting_with_http_or_https"; duration = my_media.getDuration(); elapsedTime = my_media.getElapsedTime(); diff --git a/plugin.xml b/plugin.xml index 9b5817e..a865541 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,7 +1,7 @@ + version="1.0.1"> diff --git a/src/ios/RemoteControls.m b/src/ios/RemoteControls.m index 5c9f5e3..4e5898d 100644 --- a/src/ios/RemoteControls.m +++ b/src/ios/RemoteControls.m @@ -48,17 +48,28 @@ - (void)updateMetas:(CDVInvokedUrlCommand*)command } // cover is relative path to local file else { + //check the documents directory NSString *basePath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *fullPath = [NSString stringWithFormat:@"%@%@", basePath, cover]; BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:fullPath]; + //check the library directory + NSString *basePath2 = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0]; + NSString *fullPath2 = [NSString stringWithFormat:@"%@%@", basePath2, cover]; + BOOL fileExists2 = [[NSFileManager defaultManager] fileExistsAtPath:fullPath2]; + //evaluate if either are true if (fileExists) { image = [UIImage imageNamed:fullPath]; + NSLog(@"Found image in documents"); + } else if (fileExists2) { + image = [UIImage imageNamed:fullPath2]; + NSLog(@"Found image in library"); } } } else { // default named "no-image" image = [UIImage imageNamed:@"no-image"]; + NSLog(@"No valid image found"); } // check whether image is loaded CGImageRef cgref = [image CGImage]; diff --git a/www/RemoteControls.js b/www/RemoteControls.js index 0ed7ba0..327e2a4 100644 --- a/www/RemoteControls.js +++ b/www/RemoteControls.js @@ -23,6 +23,7 @@ remoteControls.updateMetas = function(success, fail, params) { remoteControls.receiveRemoteEvent = function(event) { var ev = document.createEvent('HTMLEvents'); + //console.log("remote event JS "+event); ev.remoteEvent = event; ev.initEvent('remote-event', true, true, arguments); document.dispatchEvent(ev);