[Crashlytics] Added logging of track events
Added logging of track metadata load and track playback events, to aid with crash logging. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
fe0c388ec7
commit
88b7cd6352
|
@ -19,6 +19,8 @@
|
|||
|
||||
#import "Logging.h"
|
||||
|
||||
@import Firebase;
|
||||
|
||||
@implementation PlaybackController
|
||||
|
||||
#define DEFAULT_SEEK 5
|
||||
|
@ -185,6 +187,8 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
|||
if(playbackStatus != CogStatusStopped && playbackStatus != CogStatusStopping)
|
||||
[self stop:self];
|
||||
|
||||
[[FIRCrashlytics crashlytics] logWithFormat:@"Playing track: %@", pe.url];
|
||||
|
||||
DLog(@"PLAYLIST CONTROLLER: %@", [playlistController class]);
|
||||
[playlistController setCurrentEntry:pe];
|
||||
|
||||
|
@ -573,10 +577,13 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
|||
}
|
||||
}
|
||||
|
||||
if(pe)
|
||||
if(pe) {
|
||||
[[FIRCrashlytics crashlytics] logWithFormat:@"Beginning decoding track: %@", pe.url];
|
||||
[player setNextStream:pe.url withUserInfo:pe withRGInfo:makeRGInfo(pe)];
|
||||
else
|
||||
} else {
|
||||
[[FIRCrashlytics crashlytics] log:@"End of playlist reached."];
|
||||
[player setNextStream:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)audioPlayer:(AudioPlayer *)player didBeginStream:(id)userInfo {
|
||||
|
@ -584,6 +591,8 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
|||
|
||||
// Delay the action until this function has returned to the audio thread
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
|
||||
[[FIRCrashlytics crashlytics] logWithFormat:@"Updating UI with track: %@", pe.url];
|
||||
|
||||
[self->playlistController setCurrentEntry:pe];
|
||||
|
||||
if(self->_eq)
|
||||
|
@ -609,15 +618,20 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
|||
}
|
||||
|
||||
if(status == CogStatusStopped) {
|
||||
[[FIRCrashlytics crashlytics] log:@"Stopped."];
|
||||
|
||||
[self setPosition:0];
|
||||
[self setSeekable:NO]; // the player stopped, disable the slider
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:CogPlaybackDidStopNotficiation object:nil];
|
||||
} else // paused
|
||||
{
|
||||
[[FIRCrashlytics crashlytics] log:@"Paused."];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:CogPlaybackDidPauseNotficiation object:nil];
|
||||
}
|
||||
} else if(status == CogStatusPlaying) {
|
||||
[[FIRCrashlytics crashlytics] log:@"Started playing."];
|
||||
|
||||
if(!positionTimer) {
|
||||
positionTimer = [NSTimer timerWithTimeInterval:0.2 target:self selector:@selector(updatePosition:) userInfo:nil repeats:YES];
|
||||
[[NSRunLoop currentRunLoop] addTimer:positionTimer forMode:NSRunLoopCommonModes];
|
||||
|
@ -660,6 +674,7 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
|||
|
||||
- (void)audioPlayer:(AudioPlayer *)player didStopNaturally:(id)userInfo {
|
||||
if([[NSUserDefaults standardUserDefaults] boolForKey:@"quitOnNaturalStop"]) {
|
||||
[[FIRCrashlytics crashlytics] log:@"Terminating due to natural stop."];
|
||||
[NSApp terminate:nil];
|
||||
}
|
||||
}
|
||||
|
@ -674,6 +689,7 @@ NSDictionary *makeRGInfo(PlaylistEntry *pe) {
|
|||
- (void)audioPlayer:(AudioPlayer *)player restartPlaybackAtCurrentPosition:(id)userInfo {
|
||||
PlaylistEntry *pe = [playlistController currentEntry];
|
||||
BOOL paused = playbackStatus == CogStatusPaused;
|
||||
[[FIRCrashlytics crashlytics] logWithFormat:@"Restarting playback of track: %@", pe.url];
|
||||
[player play:pe.url withUserInfo:pe withRGInfo:makeRGInfo(pe) startPaused:paused andSeekTo:pe.seekable ? pe.currentPosition : 0.0];
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
|
||||
#import "RedundantPlaylistDataStore.h"
|
||||
|
||||
@import Firebase;
|
||||
|
||||
extern NSMutableDictionary<NSString *, AlbumArtwork *> *__artworkDictionary;
|
||||
|
||||
@implementation PlaylistLoader
|
||||
|
@ -649,6 +651,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
|||
}
|
||||
|
||||
DLog(@"Loading metadata for %@", weakPe.url);
|
||||
[[FIRCrashlytics crashlytics] logWithFormat:@"Loading metadata for %@", weakPe.url];
|
||||
|
||||
NSDictionary *entryProperties = [AudioPropertiesReader propertiesForURL:weakPe.url];
|
||||
if(entryProperties == nil)
|
||||
|
@ -737,6 +740,7 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
|
|||
PlaylistEntry *pe = [entries objectAtIndex:idx];
|
||||
|
||||
DLog(@"Loading metadata for %@", pe.url);
|
||||
[[FIRCrashlytics crashlytics] logWithFormat:@"Loading metadata for %@", pe.url];
|
||||
|
||||
NSDictionary *entryProperties = [AudioPropertiesReader propertiesForURL:pe.url];
|
||||
if(entryProperties == nil)
|
||||
|
|
Loading…
Reference in New Issue