From 3641f2f5786bdf05ceb4f6e582478105614a086b Mon Sep 17 00:00:00 2001 From: Brett Pappas Date: Thu, 18 Feb 2016 13:13:25 -0500 Subject: [PATCH] update progress bar info Added now playing support for Duration, Elapsed, Rate --- Classes/NetHoyohoyoTiremotecontrolModule.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Classes/NetHoyohoyoTiremotecontrolModule.m b/Classes/NetHoyohoyoTiremotecontrolModule.m index 2994aac..ab41787 100755 --- a/Classes/NetHoyohoyoTiremotecontrolModule.m +++ b/Classes/NetHoyohoyoTiremotecontrolModule.m @@ -111,7 +111,10 @@ -(void)setNowPlayingInfo:(id)args NSString *albumTitle = [TiUtils stringValue:@"albumTitle" properties:args def:@""]; BOOL *albumArtworkLocal = [TiUtils boolValue:@"albumArtworkLocal" properties:args def:@""]; NSString *albumArtwork = [TiUtils stringValue:@"albumArtwork" properties:args def:nil]; - + NSString *duration = [TiUtils stringValue:@"duration" properties:args def:@""]; + NSString *elapsed = [TiUtils stringValue:@"elapsed" properties:args def:@"0.0"]; + NSString *rate = [TiUtils stringValue:@"rate" properties:args def:@"1.0"]; + Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter"); if (playingInfoCenter) { @@ -139,7 +142,10 @@ -(void)setNowPlayingInfo:(id)args [songInfo setObject:artist forKey:MPMediaItemPropertyArtist]; [songInfo setObject:title forKey:MPMediaItemPropertyTitle]; [songInfo setObject:albumTitle forKey:MPMediaItemPropertyAlbumTitle]; - + [songInfo setObject:duration forKey:MPMediaItemPropertyPlaybackDuration]; + [songInfo setObject:elapsed forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime]; + [songInfo setObject:rate forKey:MPNowPlayingInfoPropertyDefaultPlaybackRate]; + [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:songInfo]; } }