Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSMutableDictionary *nowPlayingInfo = [[NSMutableDictionary alloc] init];
- [nowPlayingInfo setObject:track.artistName forKey:MPMediaItemPropertyArtist];
- [nowPlayingInfo setObject:track.trackTitle forKey:MPMediaItemPropertyTitle];
- ...
- [nowPlayingInfo setObject:[NSNumber numberWithDouble:self.player.rate] forKey:MPNowPlayingInfoPropertyPlaybackRate];
- [nowPlayingInfo setObject:[NSNumber numberWithDouble:self.currentPlaybackTime] forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime];
- [MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = nowPlayingInfo;
- NSMutableDictionary *nowPlayingInfo = [[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo mutableCopy];
- [nowPlayingInfo setObject:[NSNumber numberWithDouble:self.player.rate] forKey:MPNowPlayingInfoPropertyPlaybackRate];
- [nowPlayingInfo setObject:[NSNumber numberWithDouble:self.currentPlaybackTime] forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime];
- [MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = nowPlayingInfo;
- - (NSTimeInterval)currentPlaybackTime {
- CMTime time = self.player.currentTime;
- if (CMTIME_IS_VALID(time)) {
- return time.value / time.timescale;
- }
- return 0;
- }
- [nowPlayingInfo setObject:[track valueForProperty: MPMediaItemPropertyPlaybackDuration]
- forKey:MPMediaItemPropertyPlaybackDuration];
- - (void) remoteControlReceivedWithEvent: (UIEvent *) receivedEvent
- if (receivedEvent.subtype == UIEventSubtypeRemoteControlBeginSeekingBackward){};
- if (receivedEvent.subtype == UIEventSubtypeRemoteControlBeginSeekingForward){};
- if (receivedEvent.subtype == UIEventSubtypeRemoteControlEndSeekingBackward){};
- if (receivedEvent.subtype == UIEventSubtypeRemoteControlEndSeekingForward){};
- [MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo
- [player currentTime]
- [nowPlayingInfo setObject:[player currentTime]
- forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime];
- [nowPlayingInfo setObject:[[NSNumber alloc] initWithFloat:10]
- forKey:MPNowPlayingInfoPropertyPlaybackRate];
- [player setRate:10]
- MPChangePlaybackPositionCommand *changePlaybackPositionCommand = [[MPRemoteCommandCenter sharedCommandCenter] changePlaybackPositionCommand];
- [changePlaybackPositionCommand addTarget:self action:@selector(changePlaybackPositionEvent:)];
- [[MPRemoteCommandCenter sharedCommandCenter].changePlaybackPositionCommand setEnabled:YES];
- [yourPlayer seekTo:event.positionTime completionHandler:^(BOOL finished) {
- [self updatePlaybackRateMetadata];
- }];
Add Comment
Please, Sign In to add comment