objective c - Music control for info center in iOS using Cordova plugin -


i have tried import following cordova plugin music control in ios: https://github.com/homerours/cordova-music-controls-plugin

with following method:

- (void) create: (cdvinvokedurlcommand *) command {     nsdictionary * musiccontrolsinfodict = [command.arguments objectatindex:0];     musiccontrolsinfo * musiccontrolsinfo = [[musiccontrolsinfo alloc] initwithdictionary:musiccontrolsinfodict];      if (!nsclassfromstring(@"mpnowplayinginfocenter")) {         return;     }      [self.commanddelegate runinbackground:^{         mpnowplayinginfocenter * nowplayinginfocenter =  [mpnowplayinginfocenter defaultcenter];         nsdictionary * nowplayinginfo = nowplayinginfocenter.nowplayinginfo;         nsmutabledictionary * updatednowplayinginfo = [nsmutabledictionary dictionarywithdictionary:nowplayinginfo];          mpmediaitemartwork * mediaitemartwork = [self createcoverartwork:[musiccontrolsinfo cover]];         nsnumber * duration = [nsnumber numberwithint:[musiccontrolsinfo duration]];         nsnumber * elapsed = [nsnumber numberwithint:[musiccontrolsinfo elapsed]];         nsnumber * playbackrate = [nsnumber numberwithbool:[musiccontrolsinfo isplaying]];          if (mediaitemartwork != nil) {             [updatednowplayinginfo setobject:mediaitemartwork forkey:mpmediaitempropertyartwork];         }          [updatednowplayinginfo setobject:[musiccontrolsinfo artist] forkey:mpmediaitempropertyartist];         [updatednowplayinginfo setobject:[musiccontrolsinfo track] forkey:mpmediaitempropertytitle];         [updatednowplayinginfo setobject:[musiccontrolsinfo album] forkey:mpmediaitempropertyalbumtitle];         [updatednowplayinginfo setobject:duration forkey:mpmediaitempropertyplaybackduration];         [updatednowplayinginfo setobject:elapsed forkey:mpnowplayinginfopropertyelapsedplaybacktime];         [updatednowplayinginfo setobject:playbackrate forkey:mpnowplayinginfopropertyplaybackrate];          nowplayinginfocenter.nowplayinginfo = updatednowplayinginfo;     }]; } 

to execute native method, i've tried:

musiccontrols.create({     track   : "title",      artist  : "artist",     cover   : encodeuri(musicpath),     album   : "album" }); 

the plugin has been triggered without problem; however, music control still didn't show in info center.

much appreciate done on ios. thanks!


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -