shi11 / RemoteControls

cordova 3 plugin for interacting with ios7 remote controls and metadata
57 stars 41 forks source link

Metadata Help #13

Closed latesnacker closed 9 years ago

latesnacker commented 9 years ago

I cannot get the metadata working

I am using the same code below but I cannot get the metas to work. When I run the app in the ios simulator and watch the console, updateMetas never returns either a success or a fail. What can I be doing wrong that this function never returns and doesn't throw any errors?

console.log(window.remoteControls); //not undefined

var params = [artist, title, album, image, duration, elapsedTime];
  window.remoteControls.updateMetas(function(success){
      console.log(success);
  }, function(fail){
      console.log(fail);
  }, params);
shi11 commented 9 years ago

could be a few things.

LukePulverenti commented 9 years ago

If by chance you're using the telerik wkwbeview plugin, it doesn't work with that.

latesnacker commented 9 years ago

Thank you for the super quick response from both of you.

I am not explicitly waiting for deviceready, but this function only occurs after the user clicks on a button, so that shouldn't be the problem, correct? Also, I am not using the wkwebview plugin.

The plugin is definitely installed, I can even see the remote events getting logged in xCode when I hit the skip button, but I cannot seem to get the metadata to be correct.

shi11 commented 9 years ago

can you share an example of what your metadata looks like? Sometimes if the metadata isn't perfect, it doesn't show up...

On Thu, Jul 16, 2015 at 3:04 PM latesnacker notifications@github.com wrote:

Thank you for the super quick response from both of you.

I am not explicitly waiting for deviceready, but this function only occurs after the user clicks on a button, so that shouldn't be the problem, correct? Also, I am not using the wkwebview plugin.

The plugin is definitely installed, I can even see the remote events getting logged in xCode when I hit the skip button, but I cannot seem to get the metadata to be correct.

— Reply to this email directly or view it on GitHub https://github.com/shi11/RemoteControls/issues/13#issuecomment-122051852 .

latesnacker commented 9 years ago

the exact code looks like this:

var params = ["Joespin", _this.currentSong.song.title, playlist.title, playlist.albumPicture, 180, 5];
                            window.remoteControls.updateMetas(function (success) {
                                console.log(success);
                            }, function (fail) {
                                console.log(fail);
                            }, params);

right before this line, the values of these variables are (this isn't the code, this is debug view of the values): _this.currentSong.song.title = "Miami Lockdown" playlist.title = "Rockin' Pop Moods" playlist.albumPicture = "https://joespinstorage.blob.core.windows.net/thumbnails/rockin_pop_moods.jpeg"

This updating is being done within the context of html5 audio in a playlist. Could it have to do with the playlist? Does this plugin support html5 audio and playlists?

latesnacker commented 9 years ago

Also, here is what the lockscreen looks like on the emulator. The long text is the url of file that is playing, which of course should be the song name.

https://onedrive.live.com/redir?resid=881C574E25663841!220126&authkey=!ANMfWatBns5lads&v=3&ithint=photo%2cpng

shi11 commented 9 years ago

couple thoughts, try removing the single quote in Rockin'. Also check that albumPicture - the link didn't work for me.

On Thu, Jul 16, 2015 at 5:42 PM latesnacker notifications@github.com wrote:

Also, here is what the lockscreen looks like on the emulator. The long text is the url of file that is playing, which of course should be the song name.

https://onedrive.live.com/redir?resid=881C574E25663841!220126&authkey=!ANMfWatBns5lads&v=3&ithint=photo%2cpng

— Reply to this email directly or view it on GitHub https://github.com/shi11/RemoteControls/issues/13#issuecomment-122111570 .

latesnacker commented 9 years ago

Using the code from the readme, I was able to get the metadata set on the launch of the application. But once I play html5 audio, that metadata is overwritten. It does not seem that I can change the metadata while playing audio. I have tried setting the metadata (using the same code from the readme) before and after the audio is set, but either way the metadata is either never set or seems to be overwritten by the html5 audio url.

Is this expected behavior?

shi11 commented 9 years ago

Ah ok, sorry I haven't tested it yet with html5 audio. I've been using the Media plugin. I do think that iOS overrides metadata when using html5. Check out this fork: https://github.com/ghenry22/RemoteControls - he made a change for html5 audio - maybe he can help?