Skip to content
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="com.rd11.remote-controls"
version="1.0.0">
version="1.0.1">

<engines>
<engine name="cordova" version=">=3.0.0" />
Expand Down
11 changes: 11 additions & 0 deletions src/ios/RemoteControls.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
1 change: 1 addition & 0 deletions www/RemoteControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down