Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS - cover set to relative path to the /www folder doesn't work #66

Open
shawnlan opened this issue May 24, 2017 · 13 comments
Open

iOS - cover set to relative path to the /www folder doesn't work #66

shawnlan opened this issue May 24, 2017 · 13 comments

Comments

@shawnlan
Copy link

I have cover set to this path: assets/img/music-placeholder.png, which is under /www folder. However on iOS this doesn't set the cover image. Any idea?

@EltonFaust
Copy link

Hello,
I am facing the same problem (Android), did you found any solution?

@shawnlan
Copy link
Author

I have no problem with Android. Check your file and path and make sure everything is correct.

@EltonFaust
Copy link

The version of this plugin i was using was outdated sorry :P

@jg33
Copy link

jg33 commented Jul 26, 2017

I'm having this same issue on iOS. @shawnlan- did you figure it out?

@shawnlan
Copy link
Author

I use remote image as a workaround. Not ideal, but at least works.

@jg33
Copy link

jg33 commented Jul 27, 2017 via email

@Remco75
Copy link

Remco75 commented Aug 10, 2017

same here, would be nice to have local file support like android

@pz6tnk
Copy link

pz6tnk commented Dec 25, 2017

The same issue only on iOS

@GitFr33
Copy link

GitFr33 commented Jan 17, 2018

I have the same issue on iOS and android. Remote images work fine. On iOS I can't get any local images to work.

Has anyone found a fix for this?

@GitFr33
Copy link

GitFr33 commented Jan 18, 2018

Has anyone been able to use local images with iOS?

How can I find out about using fullpath ('file:///storage/emulated/...') that is mentioned in the readme? Is it possible to use that as a workaround for images located at www/image_dir_name/image.png?

I am using:
MusicControls version 2.1.4
Cordova version 8.0.0
iPhone5 with iOS 10.3.3 (and iPhone7 simulator iOS 10.2)

@GitFr33
Copy link

GitFr33 commented Jan 25, 2018

line 107 in musicControls.m [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; seemed to be pointing to /var/mobile/Containers/Data/Application/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/Documents instead of /var/containers/Bundle/Application/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/app_name.app/www/

Replacing it with NSString * baseCoverImagePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingString:@"/www/"]; seems to make the iOS version behave the way the Android version does with regard to cover image path.

Please correct me if there is a better way to do this.

@JuanSeBestia
Copy link

It is not necessary, many times it is because the name of the app contains spaces or something like that
(the App)

I did it like this:

iOS
(cordova.file.applicationDirectory + "www / assets / imgs / cover-random.jpg"). replace ("% 20", ""); (if you app contain spaces)
or
(cordova.file.dataDirectory + cover.name) + ".jpg"

Android
assets / imgs / cover-random.jpg
or
this.file.dataDirectory + cover.name ".jpg";

@ghenry22
Copy link
Contributor

ghenry22 commented Feb 1, 2019

As above using full path to the file should work fine, it does for me on iOS and Android for using local images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants